Exemplo n.º 1
0
 private void Fsw_Deleted(object sender, FileSystemEventArgs e)
 {
     try
     {
         FileInfo info  = new FileInfo(e.Name);
         string   owner = fo.GetOwnerofFile(e.Name);
         if (info.Name == "entries.log" || info.Name == "log.log" || info.Name == "error.log")
         {
         }
         else if (info.Extension == ".pf" || info.Extension == ".PF")
         {
             pfcounter++;
             logger._wLogger("Skipping .pf Files...");
             logger._wLogger("Current PF Counter: " + pfcounter);
         }
         else
         {
             if (owner == string.Empty)
             {
                 logger._wLogger("Datei ohne Besitzer gefunden, wird nicht geloggt...");
             }
             else
             {
                 DisplayFiles(WatcherChangeTypes.Deleted, e.Name, owner);
                 counter++;
             }
         }
         //Original Code
     }
     catch (Exception ex)
     {
         log.ExLogger(ex);
     }
 }
Exemplo n.º 2
0
        public string createFileObject(string file)
        {
            try
            {
                //Dies ist die Methode welche aus einem gegebenen File ein FileObject macht.
                FileInfo finfo           = new FileInfo(file);
                string   path            = finfo.FullName;
                long     lenghth         = finfo.Length;
                string   creationTime    = finfo.CreationTime.ToString();
                string   lastwriteTime   = finfo.LastWriteTime.ToString();
                string   lasatAccessTime = finfo.LastAccessTime.ToString();
                string   attributes      = finfo.Attributes.ToString();

                string owner = fo.GetOwnerofFile(file);

                return(path + lenghth + creationTime + lastwriteTime + lasatAccessTime + attributes + owner);
            }
            catch (Exception ex)
            {
                log._eLogger(ex);
                return("");
            }
        }