[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/System/IO ErrorEventArgs.cs,NONE,1.1
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/System/IO ErrorEventArgs.cs,NONE,1.1 ErrorEventHandler.cs,NONE,1.1 FileSystemEventArgs.cs,NONE,1.1 FileSystemEventHandler.cs,NONE,1.1 FileSystemWatcher.cs,NONE,1.1 IODescriptionAttribute.cs,NONE,1.1 InternalBufferOverflowException.cs,NONE,1.1 NotifyFilters.cs,NONE,1.1 RenamedEventArgs.cs,NONE,1.1 RenamedEventHandler.cs,NONE,1.1 WaitForChangedResult.cs,NONE,1.1 WatcherChangeTypes.cs,NONE,1.1 |
Date: |
Sat, 24 May 2003 00:20:15 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/System/IO
In directory subversions:/tmp/cvs-serv28867/System/IO
Added Files:
ErrorEventArgs.cs ErrorEventHandler.cs FileSystemEventArgs.cs
FileSystemEventHandler.cs FileSystemWatcher.cs
IODescriptionAttribute.cs InternalBufferOverflowException.cs
NotifyFilters.cs RenamedEventArgs.cs RenamedEventHandler.cs
WaitForChangedResult.cs WatcherChangeTypes.cs
Log Message:
Implement missing classes from the "System.IO" namespace
in the "System" assembly.
--- NEW FILE ---
/*
* ErrorEventArgs.cs - Implementation of the
* "System.IO.ErrorEventArgs" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.IO
{
#if !ECMA_COMPAT
public class ErrorEventArgs : EventArgs
{
// Internal state.
private Exception exception;
// Constructor.
public ErrorEventArgs(Exception exception)
{
this.exception = exception;
}
// Get the exception within this object.
public virtual Exception GetException()
{
return exception;
}
}; // class ErrorEventArgs
#endif // !ECMA_COMPAT
}; // namespace System.IO
--- NEW FILE ---
/*
* ErrorEventHandler.cs - Implementation of the
* "System.IO.ErrorEventHandler" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.IO
{
#if !ECMA_COMPAT
[Serializable]
public delegate void ErrorEventHandler(Object sender, ErrorEventArgs e);
#endif // !ECMA_COMPAT
}; // namespace System.IO
--- NEW FILE ---
/*
* FileSystemEventArgs.cs - Implementation of the
* "System.IO.FileSystemEventArgs" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.IO
{
#if !ECMA_COMPAT
public class FileSystemEventArgs : EventArgs
{
// Internal state.
private WatcherChangeTypes changeType;
internal String directory;
private String name;
// Constructor.
public FileSystemEventArgs(WatcherChangeTypes changeType,
String directory,
String name)
{
this.changeType = changeType;
this.directory = directory;
this.name = name;
}
// Get this object's properties.
public WatcherChangeTypes ChangeType
{
get
{
return changeType;
}
}
public String FullPath
{
get
{
if(directory.EndsWith
(Path.DirectorySeparatorChar.ToString()) ||
directory.EndsWith
(Path.AltDirectorySeparatorChar.ToString()))
{
return directory + name;
}
else
{
return directory +
Path.DirectorySeparatorChar.ToString() +
name;
}
}
}
public String Name
{
get
{
return name;
}
}
}; // class FileSystemEventArgs
#endif // !ECMA_COMPAT
}; // namespace System.IO
--- NEW FILE ---
/*
* FileSystemEventHandler.cs - Implementation of the
* "System.IO.FileSystemEventHandler" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.IO
{
#if !ECMA_COMPAT
[Serializable]
public delegate void FileSystemEventHandler
(Object sender, FileSystemEventArgs e);
#endif // !ECMA_COMPAT
}; // namespace System.IO
--- NEW FILE ---
/*
* FileSystemWatcher.cs - Implementation of the
* "System.IO.FileSystemWatcher" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.IO
{
#if !ECMA_COMPAT
using System.ComponentModel;
using System.Threading;
// File system watching is highly platform-specific, and arguably a
// security weakness. A program could watch for activity on selected
// files even if they cannot access the file's contents. This may
// allow the program to perform traffic analysis to determine what is
// actually happening.
//
// Because of this, we allow programs to register to watch filesystem
// events, but we never actually deliver them. This satisfies the API
// requirements in a platform-neutral fashion without creating a security
// hole at the same time.
public class FileSystemWatcher : Component, ISupportInitialize
{
// Internal state.
private String path;
private String filter;
private bool enableRaisingEvents;
private bool includeSubdirectories;
private int internalBufferSize;
private NotifyFilters notifyFilter;
private Object synchronizingObject;
// Constructors.
public FileSystemWatcher()
{
this.path = String.Empty;
this.filter = "*.*";
this.internalBufferSize = 8192;
this.notifyFilter = NotifyFilters.LastWrite |
NotifyFilters.FileName |
NotifyFilters.DirectoryName;
}
public FileSystemWatcher(String path)
{
if(path == null)
{
throw new ArgumentNullException("path");
}
else if(path.Length == 0)
{
throw new
ArgumentException(S._("IO_InvalidPathname"));
}
this.filter = "*.*";
this.internalBufferSize = 8192;
this.notifyFilter = NotifyFilters.LastWrite |
NotifyFilters.FileName |
NotifyFilters.DirectoryName;
}
public FileSystemWatcher(String path, String filter)
{
if(path == null)
{
throw new ArgumentNullException("path");
}
else if(path.Length == 0)
{
throw new
ArgumentException(S._("IO_InvalidPathname"));
}
if(filter == null)
{
throw new
ArgumentNullException("filter");
}
this.path = path;
this.filter = filter;
this.internalBufferSize = 8192;
this.notifyFilter = NotifyFilters.LastWrite |
NotifyFilters.FileName |
NotifyFilters.DirectoryName;
}
// Get or set this object's properties.
public bool EnableRaisingEvents
{
get
{
return enableRaisingEvents;
}
set
{
enableRaisingEvents = value;
}
}
public String Filter
{
get
{
return filter;
}
set
{
if(filter == null || filter.Length == 0)
{
filter = "*.*";
}
else
{
filter = value;
}
}
}
public bool IncludeSubdirectories
{
get
{
return includeSubdirectories;
}
set
{
includeSubdirectories = value;
}
}
public int InternalBufferSize
{
get
{
return internalBufferSize;
}
set
{
internalBufferSize = value;
}
}
public NotifyFilters NotifyFilter
{
get
{
return notifyFilter;
}
set
{
notifyFilter = value;
}
}
public String Path
{
get
{
return path;
}
set
{
if(path == null || path.Length == 0)
{
throw new
ArgumentException(S._("IO_InvalidPathname"));
}
else
{
path = value;
}
}
}
public override ISite Site
{
get
{
return base.Site;
}
set
{
base.Site = value;
if(value != null && DesignMode)
{
enableRaisingEvents = true;
}
}
}
public Object SynchronizingObject
{
get
{
return synchronizingObject;
}
set
{
synchronizingObject = value;
}
}
// Begin initialization of a watcher.
public virtual void BeginInit() {}
// End initialization of a watcher.
public virtual void EndInit() {}
// Wait for a particular kind of change to occur.
public WaitForChangedResult WaitForChanged(WatcherChangeTypes
changeType)
{
return WaitForChanged(changeType, -1);
}
public WaitForChangedResult WaitForChanged
(WatcherChangeTypes changeType, int timeout)
{
// Because we aren't actually watching, the wait
// is equivalent to a simple timeout.
Thread.Sleep(timeout);
return new WaitForChangedResult(changeType,
true);
}
// Events that are emitted for various filesystem operations.
public event FileSystemEventHandler Changed;
public event FileSystemEventHandler Created;
public event FileSystemEventHandler Deleted;
public event ErrorEventHandler Error;
public event RenamedEventHandler Renamed;
// Dispose of this object.
protected override void Dispose(bool disposing)
{
// Nothing to do in this implementation.
}
// Raise various events.
protected void OnChanged(FileSystemEventArgs e)
{
if(Changed != null)
{
Changed(this, e);
}
}
protected void OnCreated(FileSystemEventArgs e)
{
if(Created != null)
{
Created(this, e);
}
}
protected void OnDeleted(FileSystemEventArgs e)
{
if(Deleted != null)
{
Deleted(this, e);
}
}
protected void OnError(ErrorEventArgs e)
{
if(Error != null)
{
Error(this, e);
}
}
protected void OnRenamed(RenamedEventArgs e)
{
if(Renamed != null)
{
Renamed(this, e);
}
}
}; // class FileSystemWatcher
#endif // !ECMA_COMPAT
}; // namespace System.IO
--- NEW FILE ---
/*
* IODescriptionAttribute.cs - Implementation of the
* "System.IO.ErrorEventArgs" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.IO
{
#if !ECMA_COMPAT
using System.ComponentModel;
[AttributeUsage(AttributeTargets.All)]
public class IODescriptionAttribute : DescriptionAttribute
{
// Constructor.
public IODescriptionAttribute(String description)
: base(description) {}
// Get the description.
public override String Description
{
get
{
return base.Description;
}
}
}; // class IODescriptionAttribute
#endif // !ECMA_COMPAT
}; // namespace System.IO
--- NEW FILE ---
/*
* InternalBufferOverflowException.cs - Implementation of the
* "System.IO.InternalBufferOverflowException" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.IO
{
#if !ECMA_COMPAT
using System.Runtime.Serialization;
[Serializable]
public class InternalBufferOverflowException : Exception
{
// Constructors.
public InternalBufferOverflowException()
: base(S._("Exception_BufferOverflow")) {}
public InternalBufferOverflowException(String msg)
: base(msg) {}
public InternalBufferOverflowException(String msg, Exception inner)
: base(msg, inner) {}
protected InternalBufferOverflowException(SerializationInfo info,
StreamingContext context)
: base(info, context) {}
}; // class InternalBufferOverflowException
#endif // !ECMA_COMPAT
}; // namespace System.IO
--- NEW FILE ---
/*
* NotifyFilters.cs - Implementation of the
* "System.IO.NotifyFilters" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.IO
{
#if !ECMA_COMPAT
[Flags]
public enum NotifyFilters
{
FileName = 0x0001,
DirectoryName = 0x0002,
Attributes = 0x0004,
Size = 0x0008,
LastWrite = 0x0010,
LastAccess = 0x0020,
CreationTime = 0x0040,
Security = 0x0100
}; // enum NotifyFilters
#endif // !ECMA_COMPAT
}; // namespace System.IO
--- NEW FILE ---
/*
* RenamedEventArgs.cs - Implementation of the
* "System.IO.RenamedEventArgs" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.IO
{
#if !ECMA_COMPAT
public class RenamedEventArgs : FileSystemEventArgs
{
// Internal state.
private String oldName;
// Constructor.
public RenamedEventArgs(WatcherChangeTypes changeType,
String directory,
String name,
String oldName)
: base(changeType, directory, name)
{
this.oldName = oldName;
}
// Get this object's properties.
public String OldFullPath
{
get
{
if(directory.EndsWith
(Path.DirectorySeparatorChar.ToString()) ||
directory.EndsWith
(Path.AltDirectorySeparatorChar.ToString()))
{
return directory + oldName;
}
else
{
return directory +
Path.DirectorySeparatorChar.ToString() +
oldName;
}
}
}
public String OldName
{
get
{
return oldName;
}
}
}; // class RenamedEventArgs
#endif // !ECMA_COMPAT
}; // namespace System.IO
--- NEW FILE ---
/*
* RenamedEventHandler.cs - Implementation of the
* "System.IO.RenamedEventHandler" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.IO
{
#if !ECMA_COMPAT
[Serializable]
public delegate void RenamedEventHandler
(Object sender, RenamedEventArgs e);
#endif // !ECMA_COMPAT
}; // namespace System.IO
--- NEW FILE ---
/*
* WaitForChangedResult.cs - Implementation of the
* "System.IO.WaitForChangedResult" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.IO
{
#if !ECMA_COMPAT
public struct WaitForChangedResult
{
// Internal state.
private WatcherChangeTypes changeType;
private String name;
private String oldName;
private bool timedOut;
// Constructor.
internal WaitForChangedResult
(WatcherChangeTypes changeType, bool timedOut)
{
this.changeType = changeType;
this.name = null;
this.oldName = null;
this.timedOut = timedOut;
}
// Get or set this structure's properties.
public WatcherChangeTypes ChangeType
{
get
{
return changeType;
}
set
{
changeType = value;
}
}
public String Name
{
get
{
return name;
}
set
{
name = value;
}
}
public String OldName
{
get
{
return oldName;
}
set
{
oldName = value;
}
}
public bool TimedOut
{
get
{
return timedOut;
}
set
{
timedOut = value;
}
}
}; // struct WaitForChangedResult
#endif // !ECMA_COMPAT
}; // namespace System.IO
--- NEW FILE ---
/*
* WatcherChangeTypes.cs - Implementation of the
* "System.IO.WatcherChangeTypes" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.IO
{
#if !ECMA_COMPAT
[Flags]
public enum WatcherChangeTypes
{
Created = 0x0001,
Deleted = 0x0002,
Changed = 0x0004,
Renamed = 0x0008,
All = 0x000F
}; // enum WatcherChangeTypes
#endif // !ECMA_COMPAT
}; // namespace System.IO
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/System/IO ErrorEventArgs.cs,NONE,1.1 ErrorEventHandler.cs,NONE,1.1 FileSystemEventArgs.cs,NONE,1.1 FileSystemEventHandler.cs,NONE,1.1 FileSystemWatcher.cs,NONE,1.1 IODescriptionAttribute.cs,NONE,1.1 InternalBufferOverflowException.cs,NONE,1.1 NotifyFilters.cs,NONE,1.1 RenamedEventArgs.cs,NONE,1.1 RenamedEventHandler.cs,NONE,1.1 WaitForChangedResult.cs,NONE,1.1 WatcherChangeTypes.cs,NONE,1.1,
Rhys Weatherley <address@hidden> <=