Exemple #1
0
        private static void OnCreated(object sender, FileSystemEventArgs e)
        {
            while (true)
            {
                try
                {
                    var attributes = ElementISDirectory(e as RenamedEventArgs);

                    if (sender == fileWatcher && !((attributes)))
                    {
                        LogingFile.LogEventInfo(sender, e);
                        string temppath = GetTempPath(e);

                        if (!File.Exists(temppath))
                        {
                            File.Create(temppath).Close();
                        }
                    }
                    else if (sender == dirWatcher)
                    {
                        string temppath = GetTempPath(e);
                        Directory.CreateDirectory(temppath);

                        LogingFile.LogEventInfo(sender, e);
                    }

                    return;
                }

                catch
                {
                    SleepEvent();
                }
            }
        }
Exemple #2
0
        private static void OnRenamed(object sender, RenamedEventArgs e)
        {
            while (true)
            {
                try
                {
                    var attributes = ElementISDirectory(e);

                    if (sender == fileWatcher && !((attributes)))
                    {
                        LogingFile.LogOnRenamedInfo(sender, e);
                    }
                    else if (sender == dirWatcher)
                    {
                        string temppath = GetTempPath(e);
                        Directory.CreateDirectory(temppath);
                        LogingFile.LogOnRenamedInfo(sender, e);
                    }

                    return;
                }

                catch
                {
                    SleepEvent();
                }
            }
        }
Exemple #3
0
        private static void OnChanged(object sender, FileSystemEventArgs e)
        {
            while (true)
            {
                try
                {
                    var attributes = ElementISDirectory(e as RenamedEventArgs);

                    if (sender == fileWatcher && !attributes)
                    {
                        LogingFile.LogEventInfo(sender, e);

                        string temppath = GetTempPath(e);

                        if (!File.Exists(temppath))
                        {
                            File.Copy(e.FullPath, temppath);
                        }
                    }

                    return;
                }

                catch
                {
                    SleepEvent();
                }
            }
        }
Exemple #4
0
        private static void OnDeleted(object sender, FileSystemEventArgs e)
        {
            while (true)
            {
                try
                {
                    if (sender == fileWatcher)
                    {
                        LogingFile.LogEventInfo(sender, e);
                    }
                    else if (sender == dirWatcher)
                    {
                        LogingFile.LogEventInfo(sender, e);
                    }
                }

                catch
                {
                    SleepEvent();
                }
            }
        }