本文整理汇总了C#中System.IO.FileSystemEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# FileSystemEventArgs类的具体用法?C# FileSystemEventArgs怎么用?C# FileSystemEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FileSystemEventArgs类属于System.IO命名空间,在下文中一共展示了FileSystemEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: m_watcher_Changed
private void m_watcher_Changed(object sender, FileSystemEventArgs e)
{
m_doc = new XmlDocument();
m_doc.Load(m_file);
if (OnFileChange != null)
OnFileChange(this, e);
}
开发者ID:newyorknight,项目名称:jabber.net,代码行数:7,代码来源:ConfigFile.cs
示例2: ConfigurationUpdated
private void ConfigurationUpdated(object sender, FileSystemEventArgs fileSystemEventArgs)
{
if (fileSystemEventArgs.ChangeType != WatcherChangeTypes.Changed) return;
string command = null;
var getCommand = new Func<string>(() =>
{
lock (_watcher)
{
using (var sr = new StreamReader(_filePath))
{
command = sr.ReadLine();
}
using (var sw = new StreamWriter(_filePath, false))
{
sw.Write(String.Empty);
}
return command != null ? command.Trim() : command;
}
});
int maxTries = 0;
while (maxTries < 3)
{
try
{
getCommand();
maxTries = 3;
}
catch (Exception)
{
maxTries++;
Thread.Sleep(1000);
}
}
if (string.IsNullOrEmpty(command)) return;
if (command.StartsWith("STOP:"))
{
var fixtureId = command.Substring(5);
FixtureController.StopFixture(fixtureId);
}
if (command.StartsWith("BLOCK:"))
{
var fixtureId = command.Substring(6);
FixtureController.StopFixture(fixtureId, true);
}
if (command.StartsWith("RESTART:"))
{
var fixtureId = command.Substring("RESTART:".Length);
FixtureController.RestartFixture(fixtureId);
}
}
开发者ID:sportingsolutions,项目名称:SS.Integration.UnifiedDataAPIClient.DotNet,代码行数:60,代码来源:FixtureManager.cs
示例3: FileSystemEvent
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void FileSystemEvent(object sender, FileSystemEventArgs e)
{
if (e.FullPath.ToLower() == _filePath.ToLower())
{
if (e.ChangeType == WatcherChangeTypes.Created)
{
this.PerformInitialRead();
}
else if (e.ChangeType == WatcherChangeTypes.Changed)
{
if (_fileStreamReader.BaseStream.Length < _logLength)
{
// if the log has decreased in size, it got reset.
this.PerformInitialRead();
}
else
{
// there was an additive change to the log
_logLength = _fileStreamReader.BaseStream.Length;
var line = "";
while ((line = _fileStreamReader.ReadLine()) != null)
{
this.WriteToLog(line);
}
}
}
}
}
开发者ID:lt1946,项目名称:NodePowerTools,代码行数:33,代码来源:OutputWindow.xaml.cs
示例4: FileChanged
private void FileChanged(object sender, FileSystemEventArgs e)
{
if (e.ChangeType == WatcherChangeTypes.Changed)
{
this.Dispatcher.Invoke(DispatcherPriority.Normal, new DispatcherCallback(delegate() { this.LoadCore(e.FullPath); }));
}
}
开发者ID:dingxinbei,项目名称:OLdBck,代码行数:7,代码来源:MainWindow.xaml.cs
示例5: ConfigFileWatcherOnChanged
private void ConfigFileWatcherOnChanged(object sender, FileSystemEventArgs args)
{
string methodName = MethodBase.GetCurrentMethod().Name;
logger.InfoFormat("BEGIN: {0}()", methodName);
try
{
DateTime lastWriteTime = File.GetLastWriteTime(args.FullPath);
if (_lastWriteTime.Equals(lastWriteTime))
return;
_lastWriteTime = lastWriteTime;
ClearCache();
OnConfigSectionChanged();
}
catch (Exception e)
{
logger.Error(methodName, e);
}
finally
{
logger.InfoFormat("END: {0}()", methodName);
}
}
开发者ID:wra222,项目名称:testgit,代码行数:25,代码来源:WatchConfigFile.cs
示例6: OnChanged
// Define the event handlers.
private static void OnChanged(object source, FileSystemEventArgs e)
{
signalRHub = GlobalHost.ConnectionManager.GetHubContext<SignalRTargetHub>();
signalRHub.Clients.All.logEvent("", "", ReadFile(@"C:\temp\log.txt"));
// Specify what is done when a file is changed, created, or deleted.
}
开发者ID:santosh-mnrec,项目名称:hackathon,代码行数:8,代码来源:LogHub.cs
示例7: FileChanged
private static void FileChanged(object sender, FileSystemEventArgs e)
{
var fileInfo = new FileInfo(e.FullPath);
string value;
//do not reset for .js files that are output files except if they are renamed or deleted
if (fileInfo.Extension != ".js" || (e.ChangeType == WatcherChangeTypes.Deleted || e.ChangeType == WatcherChangeTypes.Renamed))
{
CoffeeScriptIncludedFilesMap.RemoveKey(fileInfo.FullName);
CoffeeJavascriptOutputMap.TryRemove(fileInfo.FullName, out value);
foreach (var key in CoffeeScriptIncludedFilesMap.GetAllKeysForValue(fileInfo.FullName)) {
CoffeeScriptIncludedFilesMap.RemoveKey(key);
CoffeeJavascriptOutputMap.TryRemove(key, out value);
}
}
//reset for re-compilation if .js is included or embedded
if (fileInfo.Extension == ".js" && CoffeeScriptIncludedFilesMap.GetAllKeysForValue(fileInfo.FullName).Length > 0)
{
foreach (var key in CoffeeScriptIncludedFilesMap.GetAllKeysForValue(fileInfo.FullName))
{
CoffeeScriptIncludedFilesMap.RemoveKey(key);
CoffeeJavascriptOutputMap.TryRemove(key, out value);
}
}
}
开发者ID:creamdog,项目名称:JurassicCoffee,代码行数:26,代码来源:JurassicCoffeeHttpHandler.cs
示例8: OnChanged
private void OnChanged(object sender, FileSystemEventArgs e)
{
if (!m_bDirty)
{
m_bDirty = true;
}
}
开发者ID:cuongpv88,项目名称:work,代码行数:7,代码来源:Form2.cs
示例9: fileSystemWatcher_Changed
static void fileSystemWatcher_Changed(object sender, FileSystemEventArgs e)
{
if (e.Name == FILE_NAME)
{
ReadSettings();
}
}
开发者ID:clearpath,项目名称:BreakTracker,代码行数:7,代码来源:Config.cs
示例10: Watcher_Created
private void Watcher_Created(object sender, FileSystemEventArgs e)
{
string filepathWatchFolder = e.FullPath;
int retry = 5;
while (retry > 0)
{
try
{
if (File.Exists(filepathWatchFolder))
{
using (FileStream fs = new FileStream(filepathWatchFolder, FileMode.Open, FileAccess.Read))
{
// check if the file is complete
}
}
DebugHelper.WriteLine(string.Format("Created {0}", filepathWatchFolder));
Loader.MainForm.UploadUsingFileSystem(filepathWatchFolder);
break;
}
catch
{
if (--retry == 0)
{
DebugHelper.WriteLine("Unable to open file '" + filepathWatchFolder + "'");
}
Thread.Sleep(500);
}
}
}
开发者ID:modulexcite,项目名称:ZScreen_Google_Code,代码行数:29,代码来源:FolderWatcher.cs
示例11: exploitChanged
private void exploitChanged(object sender, FileSystemEventArgs e)
{
try
{
FileInfo f = new FileInfo(e.FullPath);
string date = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString();
string detect = "";
if (f.Length == 73802 && f.Name.Contains(".exe"))
{
detect = "Likely Meterpreter Executable";
w.write(date, e.FullPath, detect);
}
else if (f.Length == 15872 && f.Name.Contains(".exe"))
{
detect = "Likely PSExec Executable";
w.write(date, e.FullPath, detect);
}
else if (f.Length == 148480 && f.Name.Equals("tior.exe"))
{
detect = "BypassUAC Executable";
w.write(date, e.FullPath, detect);
}
else if (f.Length == 61440 && f.Name.Equals("metsvc.exe"))
{
detect = "Metsvc Installation";
w.write(date, e.FullPath, detect);
}
}
catch (Exception)
{
return;
}
}
开发者ID:rvazarkar,项目名称:antipwny,代码行数:35,代码来源:FileWatchers.cs
示例12: FileWatcher_Changed
static void FileWatcher_Changed(object sender, FileSystemEventArgs e)
{
FileChangeType changeType = e.ChangeType == WatcherChangeTypes.Renamed
? FileChangeType.Renamed
: FileChangeType.Modified;
FireFileChangedEvent(e.FullPath, changeType);
}
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:7,代码来源:FileChangeNotificator.cs
示例13: FileSystemWatcherCreated
public void FileSystemWatcherCreated(object sender, FileSystemEventArgs e)
{
Logger.LogInfo("Notified of new SendLink job. Job directory = " + e.FullPath);
string jobDirectory = Path.GetDirectoryName(e.FullPath);
string workingDir = Path.Combine(GetWorkingDirectory(), jobDirectory);
var job = new SkyDoxUploadJob(jobDirectory, _url, workingDir, _userName, "SendLinkJobInfo.xml", new ApiHelper(), _deviceToken);
var uploadJob = new SendLinkJob(job);
if (!_uploadJobs.Any(m => m.Id == uploadJob.Id))
{
uploadJob.OnJobCompleted += uploadJob_OnJobCompleted;
uploadJob.Aborted += uploadJob_OnJobCompleted;
uploadJob.OnError += uploadJob_OnErrorOccurred;
uploadJob.OnJobStatusChanged += UploadJobOnJobStatusChanged;
uploadJob.OnQueueFinalizeJob += uploadJob_OnQueueFinalizeJob;
uploadJob.Execute();
_uploadJobs.Add(uploadJob);
Logger.LogInfo("New SendLink job added to the upload collection and upload started. JobId = " + uploadJob.Id);
if (JobAdded != null)
{
JobAdded(this, new JobEventArgs() {Job = uploadJob});
}
}
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:28,代码来源:SendLinkUploadManager.cs
示例14: Reparse
private async void Reparse(object sender, FileSystemEventArgs e)
{
if (e != null && e.Name.ToLowerInvariant() != _localFileName)
{
return;
}
var tryCount = 0;
const int maxTries = 20;
while (tryCount++ < maxTries)
{
try
{
var text = File.ReadAllText(_file);
Reparse(text);
break;
}
catch (IOException)
{
}
await Task.Delay(100);
}
await UsageRegistry.ResynchronizeAsync();
if (IsProcessingUnusedCssRules)
{
UnusedCssExtension.All(x => x.SnapshotPage());
}
}
开发者ID:NickCraver,项目名称:WebEssentials2013,代码行数:33,代码来源:DocumentBase.cs
示例15: ChangeWatcher
// When files are created or modified in the "cache" directory, this job will be triggered.
public static void ChangeWatcher(
[FileTrigger(@"cache\{name}", "*.txt", WatcherChangeTypes.Created | WatcherChangeTypes.Changed)] string file,
FileSystemEventArgs fileTrigger,
TextWriter log)
{
log.WriteLine(string.Format("Processed input file '{0}'!", fileTrigger.Name));
}
开发者ID:JulianoBrugnago,项目名称:azure-webjobs-sdk-extensions,代码行数:8,代码来源:FileSamples.cs
示例16: FileSystemWatcherChanged
void FileSystemWatcherChanged(object sender, FileSystemEventArgs e)
{
if (!string.IsNullOrEmpty(e.FullPath) && !Path.GetFileName(e.FullPath).Equals("FSFiddler2.log", StringComparison.OrdinalIgnoreCase))
{
Append(e.ChangeType.ToString() + "\t\t" + e.FullPath);
}
}
开发者ID:alienlab,项目名称:FS-Fiddler,代码行数:7,代码来源:Form1.cs
示例17: watcher_Changed
void watcher_Changed(object sender, FileSystemEventArgs e)
{
if (iCounter > 1)
{
iCounter = 0;
}
if (iCounter == 0)
{
Console.WriteLine(e.FullPath + " was changed");
string[] aPath = e.FullPath.Split('\\');
Console.WriteLine(aPath[3].ToString());
//ReadFile(e.FullPath);
//if (System.IO.Directory.Exists(@"C:\Log On Log\Temp\") == false)
//{
// System.IO.Directory.CreateDirectory(@"C:\Log On Log\Temp\");
//}
//try
//{
// File.Copy(e.FullPath, @"C:\Log On Log\Temp\" + aPath[3].ToString(), true);
//}
//catch (System.IO.IOException ioex)
//{
// Console.WriteLine("Copy exception");
//}
FileReader reader = new FileReader(e.FullPath);
string sComputerName = reader.GetComputerName();
Console.WriteLine(sComputerName);
}
iCounter++;
}
开发者ID:kwonger,项目名称:PSSD_Works,代码行数:34,代码来源:Watcher.cs
示例18: watcher_Changed
static void watcher_Changed(object sender, FileSystemEventArgs e)
{
if (e.FullPath == configFile)
{
Init();
}
}
开发者ID:bm776688,项目名称:Beast.Web.Crawler,代码行数:7,代码来源:Crawler.cs
示例19: OnChanged
// Define the event handlers.
private static void OnChanged(object source, FileSystemEventArgs e)
{
// Specify what is done when a file is changed, created, or deleted.
Console.WriteLine("File: " + e.FullPath + " " + e.ChangeType);
if (e.ChangeType == WatcherChangeTypes.Created)
{
var fileInfo = new FileInfo(e.FullPath);
switch (fileInfo.Extension)
{
case ".url":
//create the json file
Task.Run(() => Helpers.GetJsonFromGSheets(e.FullPath));
break;
case ".csv":
//create the json file
var dt = Helpers.GetDataTabletFromCSVFile(e.FullPath);
string jsonText = Helpers.GetJson(dt);
if (!string.IsNullOrEmpty(jsonText) && jsonText != "[]")
File.WriteAllText(e.FullPath.Replace(".csv", ".json"), jsonText, new UTF8Encoding());
break;
default:
break;
}
}
}
开发者ID:gitter-badger,项目名称:ApiFox,代码行数:27,代码来源:WatcherConfig.cs
示例20: ChangeAction
public void ChangeAction(object sender, FileSystemEventArgs e)
{
if (buildTimer.Enabled)
ResetBuildTimer();
else
buildTimer.Enabled = true;
}
开发者ID:idavis,项目名称:Giles,代码行数:7,代码来源:SourceWatcher.cs
注:本文中的System.IO.FileSystemEventArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论