Пример #1
0
        private void StartServer(object sender, EventArgs e)
        {
            var startTimeSpan             = TimeSpan.Zero;
            var periodTimeSpan            = TimeSpan.FromDays(1);
            Progress <string> progress    = new Progress <string>(text => listView1.Items.Add(text)); //replace listView
            Progress <string> progressDSC = new Progress <string>(text => listView1.Items.Add(text)); //replace listView
            Listener          newlistener;

            newlistener = new Listener();
            DSC DSCManager = new DSC();

            newlistener.serverstart(progress);
            listeners.Add(newlistener);
            listView1.Items.Add("server started at port 5555");
            DSCManager.StartDSC(progressDSC);
            ae.WriteToLog("backup server up", System.Diagnostics.EventLogEntryType.Information,
                          AppEvents.CategoryType.AppStartUp, AppEvents.EventIDType.ExceptionThrown);

            FilesMonitor fm    = new FilesMonitor();
            CompareDirs  cdirs = new CompareDirs();

            fm.StartMonitor(progress);

            /* var timer = new System.Threading.Timer((ee) =>
             * {
             *   cdirs.CompareDirectories();
             * }, null, startTimeSpan, periodTimeSpan);*/

            ae.WriteToLog("file system monitoring enabled", System.Diagnostics.EventLogEntryType.Information,
                          AppEvents.CategoryType.None, AppEvents.EventIDType.ExceptionThrown);
        }
Пример #2
0
        public void serverstart(IProgress <string> progress)
        {
            FileSplitter fs2 = new FileSplitter();

            this.progress = progress;
            DSC obj = new DSC();

            //obj.SearchDSC();
            db = new DbWrapper(ConfigurationManager.AppSettings["dbpath"].ToString() + ConfigurationManager.AppSettings["database"].ToString());
            progress.Report("waiting for connections\n");
            listenThread = new Thread(new ThreadStart(ListenForClients));
            listenThread.Start();
        }