本文整理汇总了C#中WatcherChangeTypes类的典型用法代码示例。如果您正苦于以下问题:C# WatcherChangeTypes类的具体用法?C# WatcherChangeTypes怎么用?C# WatcherChangeTypes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WatcherChangeTypes类属于命名空间,在下文中一共展示了WatcherChangeTypes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FileEvent
public FileEvent(Int64 num, WatcherChangeTypes type, string path, string oldpath)
{
eventnum = num;
eventtype = type;
eventpath = path;
oldevpath = oldpath;
}
示例2: OnFileChanged
private void OnFileChanged(string path, WatcherChangeTypes changeType)
{
if (!_enableEvents) return;
_actions.Enqueue(new TreeChange { Path = path, Type = SimplifyType(changeType) });
_eventFlusher.Change(DebounceInMs, Timeout.Infinite);
}
示例3: FilterIgnored
protected static FileBehavior FilterIgnored(string path, WatcherChangeTypes type)
{
if(Regex.IsMatch(path, Init.Singleton.JsonData.regexIgnoreFiles, RegexOptions.IgnoreCase) || new FileInfo(path).Length <= 0)
return new FileIgnored(path, type);
else
return new FileOK(path, type);
}
示例4: FileTriggerAttribute
/// <summary>
/// Constructs a new instance.
/// </summary>
/// <param name="path">The root path that this trigger is configured to watch for files on.</param>
/// <param name="filter">The optional file filter that will be used.</param>
/// <param name="changeTypes">The <see cref="WatcherChangeTypes"/> that will be used by the file watcher. The Default is Created.</param>
/// <param name="autoDelete">True if processed files should be deleted automatically, false otherwise. The default is False.</param>
public FileTriggerAttribute(string path, string filter, WatcherChangeTypes changeTypes = WatcherChangeTypes.Created, bool autoDelete = false)
{
this.Path = path;
this.Filter = filter;
this.ChangeTypes = changeTypes;
this.AutoDelete = autoDelete;
}
示例5: Changed
protected void Changed(WatcherChangeTypes changeType, IVirtualItem item)
{
if (this.OnChanged != null)
{
this.OnChanged(this, new VirtualItemChangedEventArgs(changeType, item));
}
}
示例6: FileBehavior
protected FileBehavior(string fp, WatcherChangeTypes ct)
{
fullPath = fp;
changeType = ct;
fileDT = new FileInfo(fp).LastWriteTime;
sysTime = DateTime.Now;
}
示例7: WaitForChangedResult
internal WaitForChangedResult(WatcherChangeTypes changeType, string name, string oldName, bool timedOut)
{
ChangeType = changeType;
Name = name;
OldName = oldName;
TimedOut = timedOut;
}
示例8: FilterFileSize
protected static FileBehavior FilterFileSize(string path, WatcherChangeTypes type)
{
if(new FileInfo(path).Length <= Init.Singleton.JsonData.maxSize)
return new FileOK(path, type);
else
return new FileTooLarge(path, type);
}
示例9: TestNestedDirectoriesHelper
public static void TestNestedDirectoriesHelper(
string testDirectory,
WatcherChangeTypes change,
Action<AutoResetEvent, TempDirectory> action,
NotifyFilters changeFilers = NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName)
{
using (var dir = new TempDirectory(testDirectory))
using (var watcher = new FileSystemWatcher())
{
AutoResetEvent createdOccurred = WatchForEvents(watcher, WatcherChangeTypes.Created); // not "using" to avoid race conditions with FSW callbacks
AutoResetEvent eventOccurred = WatchForEvents(watcher, change);
watcher.Path = Path.GetFullPath(dir.Path);
watcher.Filter = "*";
watcher.NotifyFilter = changeFilers;
watcher.IncludeSubdirectories = true;
watcher.EnableRaisingEvents = true;
using (var firstDir = new TempDirectory(Path.Combine(dir.Path, "dir1")))
{
ExpectEvent(createdOccurred, "dir1 created");
using (var nestedDir = new TempDirectory(Path.Combine(firstDir.Path, "nested")))
{
ExpectEvent(createdOccurred, "nested created");
action(eventOccurred, nestedDir);
}
}
}
}
示例10: WaitForChangedResult
internal WaitForChangedResult(WatcherChangeTypes changeType, string name, string oldName, bool timedOut)
{
this.changeType = changeType;
this.name = name;
this.oldName = oldName;
this.timedOut = timedOut;
}
示例11: FileSystemEventArgs
// Constructor.
public FileSystemEventArgs(WatcherChangeTypes changeType,
String directory, String name)
{
this.changeType = changeType;
this.directory = directory;
this.name = name;
}
示例12: FSEvent
/// <summary>
/// A file system event.
/// For instance, a file was renamed.
/// </summary>
public FSEvent(WatcherChangeTypes type, string path) {
if(path == null) {
throw new ArgumentNullException("Argument null in FSEvent Constructor","path");
}
Type = type;
Path = path;
}
示例13: RenamedEventArgs
// Constructor.
public RenamedEventArgs(WatcherChangeTypes changeType,
String directory, String name,
String oldName)
: base(changeType, directory, name)
{
this.oldName = oldName;
}
示例14: HandleChangeInternal
protected override bool HandleChangeInternal(string objectName, WatcherChangeTypes changeType)
{
Trace.TraceInformation("Running MSBuild to compile type script files");
ProcessStartInfo startInfo = new ProcessStartInfo("msbuild.exe");
startInfo.Arguments =
string.Format("\"{0}\" /p:Configuration=Debug,BuildingProject=true /t:CompileTypeScript",
_projectFilePath);
startInfo.CreateNoWindow = true;
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
Process proc = Process.Start(startInfo);
if (null != proc)
{
proc.WaitForExit();
Trace.TraceInformation("MSBuild exited with code {0}", proc.ExitCode);
if (proc.ExitCode != 0)
Console.Beep();
}
else
Trace.TraceWarning("MSBuild executable not found");
RefreshBrowser();
return true;
}
示例15: FileEventArgs
public FileEventArgs(WatcherChangeTypes changeType, string fullname, string name, RenamedEventArgs renameArgs)
{
this.ChangeType = changeType;
this.FullPath = fullname;
this.Name = name;
RenameName = renameArgs;
}