Exemple #1
0
 public void AddReport(ActionReportContainer container)
 {
     lock (this.report.SyncRoot)
     {
         this.report.Add(container);
     }
 }
        private void DirectoryExistsFailure(string oFile)
        {
            IReporter             reporter  = ReporterManager.GetReporter();
            ActionReportContainer container = new ActionReportContainer(ActionType.Copy, ActionReportResult.Failed,
                                                                        "The source directory " + Path.GetDirectoryName(oFile) + " does not exist.  It cannot be watched.");

            reporter.AddReport(container);
            this.reporter.AddReport(container);
        }
Exemple #3
0
        public ActionReportContainer[] GetFullReport()
        {
            ActionReportContainer[] arry = new ActionReportContainer[this.report.Count];
            int i = 0;

            foreach (ActionReportContainer container in this.report)
            {
                arry[i++] = container;
            }
            return(arry);
        }
Exemple #4
0
        public void AddReport(ActionReportContainer container)
        {
            this.report.Add(container);

            WriteLog(container);
            if (container.ActionResult != ActionReportResult.Noted)
            {
                //FileHistoryBO.WriteFileHistory( container );
                //TODO: FirstReporter.AddReport()
            }
        }
 private void Copy(string oFile, string cFile)
 {
     try {
         this.copier.Copy(oFile, cFile, true);
         this.reporter.AddReport(
             new ActionReportContainer(ActionType.Copy, ActionReportResult.Succeeded, "Copy succeeded", oFile, cFile));
     }
     catch (Exception ex) {
         IReporter             reporter  = ReporterManager.GetReporter();
         ActionReportContainer container = new ActionReportContainer(
             ActionType.Copy, ActionReportResult.Failed, ex.ToString(), oFile, cFile);
         reporter.AddReport(container);
         this.reporter.AddReport(container);
     }
 }
Exemple #6
0
        private void WriteLog(ActionReportContainer container)
        {
            ConfigurationBO cbo     = (ConfigurationBO)SingletonManager.GetSingleton(typeof(ConfigurationBO));
            string          logfile = SharedBO.GetLogFile();
            StreamWriter    sw      = null;

            FileInfo fi = new FileInfo(logfile);

            lock (this.SyncRoot)
            {
                try
                {
                    sw = fi.AppendText();

                    if (container.OriginalPath.CompareTo("") != 0)
                    {
                        sw.WriteLine("File: \t\t" + container.OriginalPath);
                    }
                    if (container.CopyPath.CompareTo("") != 0)
                    {
                        sw.WriteLine("Copy to:\t" + container.CopyPath);
                    }
                    sw.WriteLine("Action: \t\t" + container.Action.ToString());
                    sw.WriteLine("Result: \t\t" + container.ActionResult.ToString());
                    sw.WriteLine("Comment:\t" + container.ActionResultDescription);
                    sw.WriteLine("Occured at:\t" + container.OccuredAt.ToString("f"));
                    sw.Flush();
                }
                catch (Exception)
                {
                    //TODO: IReporter.FirstReporter.WriteLog()
                    //System.Windows.Forms.Form eForm = new LlamaCarbonCopy.Controls.Forms.ErrorMessageForm(
                    //  String.Format(
                    //  OBBO.blah(),
                    //  logfile),
                    //  OBBO.err()
                    //  );
                    //eForm.ShowDialog();
                }
                finally
                {
                    if (sw != null)
                    {
                        sw.Close();
                    }
                }
            }
        }