Exemple #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);
            }
        }
Exemple #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;
 }