Exemple #1
0
 private static void OnDeleted(object sender, FileSystemEventArgs e)
 {
     if (sender == fileWatcher)
     {
         LogingChanges.LogEventInfo(sender, e);
     }
     else if (sender == dirWatcher)
     {
         LogingChanges.LogEventInfo(sender, e);
     }
 }
Exemple #2
0
        private static void OnRenamed(object sender, RenamedEventArgs e)
        {
            var isDirectory = ElementIsDirectory(e);

            if (sender == fileWatcher && !isDirectory)
            {
                LogingChanges.LogOnRenamedInfo(sender, e);
            }
            else if (sender == dirWatcher)
            {
                string temppath = GetTempPath(e.FullPath, DateTime.Now);
                Directory.CreateDirectory(temppath);
                LogingChanges.LogOnRenamedInfo(sender, e);
            }
        }
Exemple #3
0
        private static void OnChanged(object sender, FileSystemEventArgs e)
        {
            var isDirectory = ElementIsDirectory(e);

            if (sender == fileWatcher && !isDirectory)
            {
                LogingChanges.LogEventInfo(sender, e);

                string temppath = GetTempPath(e.FullPath, DateTime.Now);
                string text     = GetDataFromFile(e.FullPath);
                if (!File.Exists(temppath))
                {
                    if (!Directory.Exists(temppath))
                    {
                        CreateDirectoryForFile(temppath);
                    }

                    File.Copy(e.FullPath, temppath);
                }

                WriteDataToFile(temppath, text);
            }
        }
Exemple #4
0
        private static void OnCreated(object sender, FileSystemEventArgs e)
        {
            var isDirectory = ElementIsDirectory(e);

            LogingChanges.LogEventInfo(sender, e);
            string temppath = GetTempPath(e.FullPath, DateTime.Now);

            if (sender == fileWatcher && !isDirectory)
            {
                if (!File.Exists(temppath))
                {
                    if (!Directory.Exists(temppath))
                    {
                        CreateDirectoryForFile(temppath);
                    }

                    File.Create(temppath).Close();
                }
            }
            else if (sender == dirWatcher)
            {
                Directory.CreateDirectory(temppath);
            }
        }