Exemplo n.º 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();
                }
            }
        }
Exemplo n.º 2
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();
                }
            }
        }
Exemplo n.º 3
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();
                }
            }
        }