Ejemplo n.º 1
0
 //-------------------------------------------------------------------------
 public void Save(string filePath)
 {
     var serializer = new SerializerHelper();
     serializer.SaveToFile(this, filePath, Encoding.ASCII);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void restartToolStripMenuItem_Click(object sender, EventArgs e)
 {
     //запустить экзешник для рестарта редактора и
      //ProcessStartInfo psi = new ProcessStartInfo();
      //psi.Arguments =new string[1] { Application.ExecutablePath };
      //psi.FileName = "startApp.exe";
      //Process.Start(psi);
     try
     {
         log.LogMessage("Manual restart");
         SaveSettings();
         if (testUids.Test.Count > 0)
         {
             var serializer = new SerializerHelper();
             serializer.SaveToFile(testUids, Path.Combine(OcrAppConfigDefaults.BaseTempFolder, "testUids.json"), Encoding.Unicode);
         }
     }
     catch (Exception)
     {
     }
     Process.Start("startApp.exe", Application.ExecutablePath);// + " a b c"
     Environment.Exit(0);
     //try
     //{
     //    Application.Restart();
     //}
     //catch (Exception)
     //{
     //}
 }
Ejemplo n.º 3
0
        public Batches CreateDefaultAppConfig()
        {
            Batches batches = new Batches();
            batches.autoStart = AutoStartDefault;
            batches.logLength = LogLengthDefault;
            batches.email = new Batches.Email()
            {
                host = "//smtp.gmail.com",
                port = 587,
                from = "*****@*****.**",
                password = "******",
                emails = @"[email protected]
                        //[email protected]
                        //[email protected]",
                caption = "Bad answers sheet",
                message = "Test"
            };
            Batches.Batch[] b = new Batches.Batch[1];
            b[0] = new Batches.Batch
            {
                inPath = InputFolder,
                configsFolder = ConfigsFolder,
                outPathSuccess = SuccessFolder,
                outPathError = ErrorFolder,
                outPathNotConfident = NotConfidentFolder,
                outPathArchive = ArchiveFolder,
                manualInPath = ManualInputFolder,
                manualErrorsFolder = ManualErrorFolder,
                manualSuccessFolder = ManualSuccessFolder,
                manuaConfigsFolder = ManualConfigsFolder,
                manualOutPathArchive = ManualArchiveFolder,
                manualOutPathNotConfident = ManualNotConfidentFolder,
                manualNextProccessingFolder = ManualNextProccessingFolder,
                notSupportedSheetPath = NotSupportedSheetFolder,
                emptyScansPath = EmptyScansFolder,

                active = ActiveDefault,
                autoRunEditorOnError = AutoRunEditorOnErrorDefault,
                smartResize = SmartResizeDefault,
                dual_control_bar_codes = DualControlDefault,
                fileMask = SupportedExtensionsDefault,
                percent_confident_text = PercentConfidentTextDefault,
                fontName = FontNameDefault,

                notSupportedSheets = NotSupportedSheetsDefault,
                removeEmptyScans = RemoveEmptyScansDefault,
                emptyScanDarknessPercent = EmptyScanDarknessPercentDefault,
            };
            b[0].outputFileValues = new Batches.OutputFileValue[2];
            b[0].outputFileValues[0].position = 7;
            b[0].outputFileValues[0].value = "EDOCOCR";
            b[0].outputFileValues[1].position = 8;
            b[0].outputFileValues[1].value = 1;

            batches.batches = b;
            var serializer = new SerializerHelper();
            serializer.SaveToFile(batches, OcrAppConfig.AppConfigFileName, Encoding.Unicode);
            return batches;
        }
Ejemplo n.º 4
0
 //-------------------------------------------------------------------------
 private void EditorForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     log.LogMessage("Closing");
     SaveSettings();
     ioHelper.ReDelete();
     var serializer = new SerializerHelper();
     serializer.SaveToFile(testUids, Path.Combine(OcrAppConfigDefaults.BaseTempFolder, "testUids.json"), Encoding.Unicode);
     if (ioHelper.ReDeleteList.Count > 0)
     {
         string message = "ioHelper.ReDeleteList.Count = " + ioHelper.ReDeleteList.Count;
         log.LogMessage(message);
         new ErrorRestart(KeyProgram.eDoctrinaOcrEd).SendErrorMail(message);
     }
 }