示例#1
0
        /// <summary>
        /// fileSysetmWatcher_Changed: Fired when the Watcher object detects a folder/file change event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        //Invoke when a  changed event would be performed

        void fileSysetmWatcher_Changed(object sender, FileSystemEventArgs e, WatchedFolder folder)
        {
            if (Global.GetFileExtention(e.FullPath))
            {
                Global.WriteLog(e.ChangeType + ": " + e.FullPath, EventLogEntryType.Information);

                SPHelper.AddFileToSPLib(e.FullPath, folder.SpSite, folder.SpLib);
            }
        }
示例#2
0
 //Invoke when a Create event would be performed
 void fileSysetmWatcher_created(object sender, FileSystemEventArgs e, WatchedFolder folder)
 {
     if (Global.GetFileExtention(e.FullPath))
     {
         Global.WriteLog(string.Format("New File {0} Created On {1} ",
                                       DateTime.Now.ToString("dd MMMM yyyy hh:mm:ss"), e.FullPath), EventLogEntryType.Information);
         SPHelper.AddFileToSPLib(e.FullPath, folder.SpSite, folder.SpLib);
     }
     else
     {
         try
         {
             Global.WriteLog(string.Format("New File {0} Created On {1} ",
                                           DateTime.Now.ToString("dd MMMM yyyy hh:mm:ss"), e.FullPath), EventLogEntryType.Information);
         }
         catch (Exception ex)
         {
             Global.WriteLog(string.Format("Error On File {0} Created On {1} :: {2} ", DateTime.Now.ToString("dd MMMM yyyy hh:mm:ss"), e.FullPath, ex.Message),
                             EventLogEntryType.Information);
         }
     }
     return;
 }
示例#3
0
        /// <summary>
        /// fileSysetmWatcher_deleted: Fired when the Watcher object detects a folder/file delete event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void fileSysetmWatcher_deleted(object sender, FileSystemEventArgs e, WatchedFolder folder)
        {
            SPHelper.DeleteFileToSPLib(e.Name, folder.SpSite, folder.SpLib);

            Global.WriteLog("deleted:" + e.FullPath, EventLogEntryType.Information);
        }