private void ProcessFileSystemChange(FileSystemEventArgs e) { if (e.ChangeType == WatcherChangeTypes.Changed && Directory.Exists(e.FullPath)) return; if (string.Equals(Path.GetExtension(e.Name), ".lock", StringComparison.OrdinalIgnoreCase)) return; MarkDirty(true); }
private void fileSystemWatcher1_Changed(object sender, System.IO.FileSystemEventArgs e) { EventLog.WriteEntry("NadzornikServis: " + e.FullPath + " " + e.ChangeType.ToString()); }
private void watcher_Created(object sender, System.IO.FileSystemEventArgs e) { RefreshResumeDat(); }
private void RaisePopulateFlag(object sender, System.IO.FileSystemEventArgs e) { fireEvent = true; }
private void RaisePopulateFlag(object sender, System.IO.FileSystemEventArgs e) { // Signal the main thread it's time to populate (cannot run populate somewhere else than on main thread) fireEvent = true; }
/// <summary> /// The event that is raised when a new file is created in the control dir /// </summary> /// <param name="sender">The event sender</param> /// <param name="e">The file event arguments</param> private void m_filewatcher_Created(object sender, System.IO.FileSystemEventArgs e) { //Retry 5 times if the other process is slow on releasing the file lock int retrycount = 5; //Indicator and holder of arguments passed string[] commandline = null; //HACK: Linux has some locking issues //The problem is that there is no atomic open-and-lock operation, so the other process // needs a little time to create+lock the file. This is not really a fix, but an // ugly workaround. This functionality is only used to allow a new instance to signal // the running instance, so errors here would only affect that functionality if (Library.Utility.Utility.IsClientLinux) { System.Threading.Thread.Sleep(1000); } do { try { //If the other process deleted the file, just quit if (!System.IO.File.Exists(e.FullPath)) { return; } List <string> args = new List <string>(); using (System.IO.StreamReader sr = new System.IO.StreamReader(Duplicati.Library.Utility.Utility.IsClientLinux ? UnixSupport.File.OpenExclusive(e.FullPath, System.IO.FileAccess.ReadWrite) : new System.IO.FileStream(e.FullPath, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.None))) while (!sr.EndOfStream) { args.Add(sr.ReadLine()); } commandline = args.ToArray(); //Remove the file to notify the other process that we have correctly processed the call System.IO.File.Delete(e.FullPath); } catch { } //If file-reading failed, wait a little before retry if (commandline == null) { System.Threading.Thread.Sleep(500); retrycount--; } } while (retrycount > 0 && commandline == null); //If this happens, we detected the file, but was unable to read it's contents if (commandline == null) { //There is nothing we can do :( } else { //If we read the data but did not delete the file, the other end still hangs //and waits for us to clean up, so try again. retrycount = 5; while (retrycount > 0 && System.IO.File.Exists(e.FullPath)) { try { System.IO.File.Delete(e.FullPath); } catch { //Wait before the retry System.Threading.Thread.Sleep(500); } retrycount--; } //If this happens, the other process will give an error message if (System.IO.File.Exists(e.FullPath)) { //There is nothing we can do :( } //Finally inform this instance about the call if (SecondInstanceDetected != null) { SecondInstanceDetected(commandline); } } }
private static void W_Changed(object sender, System.IO.FileSystemEventArgs e) { Console.WriteLine(e.Name); }
private void OnFileCreated(object sender, System.IO.FileSystemEventArgs e) => _created?.Invoke(this, e);
protected void mainFileSystemWatcherChanged(object sender, System.IO.FileSystemEventArgs e) { }
void myWatcher_Changed(object sender, System.IO.FileSystemEventArgs e) { Console.WriteLine(String.Format("myWatcher_Changed : {0}, changed : {1}, name : {2}", e.FullPath, e.ChangeType, e.Name)); }
private static void Fsw_Changed(object sender, System.IO.FileSystemEventArgs e) { Console.WriteLine("Filen {0} er rettet", e.Name); }
private static void Fsw_Created1(object sender, System.IO.FileSystemEventArgs e) { Console.WriteLine("A second subscriber"); }
private void _DirectoryWatch_Changed(object sender, System.IO.FileSystemEventArgs e) { //read the file and send to the server ReadAllRecords(); return; }
private void FileSystemWatcher_Changed(object sender, System.IO.FileSystemEventArgs e) { CambiarBotonRefrescar(false); ActualizarDatos(); }
private void HandleFileSystemChanged(object sender, FileSystemEventArgs e) { Action action = () => ProcessFileSystemChange(e); Task.Factory.StartNew(action, CancellationToken.None, TaskCreationOptions.None, SccProviderService.TaskScheduler) .HandleNonCriticalExceptions(); }
void OnChanged(object source, System.IO.FileSystemEventArgs e) { ReadConfig(); }
protected void OnDeleted(System.IO.FileSystemEventArgs e) { throw new NotImplementedException(); }
private static void W_Created(object sender, System.IO.FileSystemEventArgs e) { throw new NotImplementedException(); }
private static void OnChange(object sender, System.IO.FileSystemEventArgs e) { System.Console.WriteLine(e.FullPath.ToString() + " is changed!"); }
public OperationResult DoAction(string path, Dictionary <string, string> parameters, System.IO.FileSystemEventArgs modificationArg) { if (!parameters.ContainsKey("command")) { return(OperationResult.InvalidArgument); } Process pocess = new Process(); pocess.StartInfo.FileName = "%windir%\\System32\\cmd.exe"; pocess.StartInfo.Arguments = String.Format("/c \"{0}\"", parameters["command"].Replace("$TARGET_FILE$", modificationArg.FullPath)); pocess.Start(); return(OperationResult.Success); }
private void watcher_Changed(object sender, System.IO.FileSystemEventArgs e) { Logger.Trace("Restarted delay timer"); mScanDelayTimer.Stop(); mScanDelayTimer.Start(); }
private static void W_Created(object sender, System.IO.FileSystemEventArgs e) { Console.WriteLine("Filen " + e.Name + " er oprettet"); }
private void fileSystemWatcherMessages_Changed(object sender, System.IO.FileSystemEventArgs e) //Refreshes messages when a new msg.msgusr is downloaded via MessageCheck(). { refreshMessages(); System.Threading.Thread.Sleep(30); Console.WriteLine("Refreshing messages!"); }
private void SaveDirectoryFileSystemWatcher_Deleted(object sender, System.IO.FileSystemEventArgs e) { DrawTestPanels(); }
private void fileSystemWatcher1_Changed(object sender, System.IO.FileSystemEventArgs e) { FileSys.Refresh(); DisplayDirs(); }
private static void Fsw_Changed(object sender, System.IO.FileSystemEventArgs e) { Console.WriteLine($"File \"{e.Name}\" was modified"); }
private static void MkvFileCreated(object sender, System.IO.FileSystemEventArgs e) { VideoFile video = VideoFactory.CreateVideoFile(sender, e); SaveVideoToDb(video); }
private void fileSystemWatcher1_Changed(object sender, System.IO.FileSystemEventArgs e) { }
// I have several types of events that can come in, // they just get packaged up into the same "SensorData" // struct, and I worry about the contents later private void FileSystem_Changed( object sender, System.IO.FileSystemEventArgs e ) { EnqueueSensorEvent(new SensorData(sender, e)); }
private void OnChanged(object source, FileSystemEventArgs e) { string fullpath = e.FullPath.Replace('\\', '/'); fileSet[fullpath] = locationRoot; }
protected void OnCreated(System.IO.FileSystemEventArgs e) { }
protected void OnDeleted(System.IO.FileSystemEventArgs e) { }
void m_FileWatcher_Changed(object sender, System.IO.FileSystemEventArgs e) { OnFileChanged(); }