Пример #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);
     }
 }
Пример #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);
            }
        }
Пример #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);
            }
        }
Пример #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);
            }
        }