Example #1
0
 private void btnGetUtmFromSourceFile_Click(object sender, EventArgs e)
 {
     SafeRun(delegate
     {
         LoadDraft draft = new LoadDraft(Config.LOADLIST_STAGE1_PATH);
         List <string> listRecordStrings = new List <string>();
         List <string> guessedDates      = new List <string>();
         LoadListRecord listRecord       = new LoadListRecord();
         foreach (LoadDraftRecord draftRecord in draft.records)
         {
             try
             {
                 listRecord.InitByUtmSourceFile(draftRecord.filePath, draftRecord.fileType, tbSrcProj.Text.Trim(), tbDestProj.Text.Trim());
                 guessedDates.Add(listRecord.guessedDate);
                 listRecordStrings.Add(listRecord.ToString());
             }
             catch (Exception)
             {
                 ShowMessage("failed to get meta info from " + draftRecord.filePath);
                 ShowMessage("rename to " + draftRecord.filePath + ".damaged");
                 File.Move(draftRecord.filePath, draftRecord.filePath + ".damaged");
             }
         }
         File.WriteAllLines(Config.LOADLIST_STAGE2_PATH, listRecordStrings);
         guessedDates.Sort();
         File.WriteAllLines(Config.LOADLIST_STAGE2_DATE_PATH, guessedDates);
         ShowMessage("Stage 2: result saved to " + Config.LOADLIST_STAGE2_PATH);
         ShowMessage("Stage 2: guessed source dates saved to " + Config.LOADLIST_STAGE2_DATE_PATH);
     });
 }
Example #2
0
 private void btnScanDir_Click(object sender, EventArgs e)
 {
     SafeRun(delegate
     {
         LoadDraft draft = new LoadDraft(tbScanDirPathToScan.Text.Trim(), tbScanDirPathEndsWith.Text.Trim(), cbScanDirOnly1SubDir.Checked);
         draft.Save(Config.LOADLIST_STAGE1_PATH);
         ShowMessage("Stage 1: result saved to " + Config.LOADLIST_STAGE1_PATH);
     });
 }
Example #3
0
        private void btnFixDoqqHeader_Click(object sender, EventArgs e)
        {
            SafeRun(delegate
            {
                int headerLength = Int32.Parse(tbFixDoqqHeaderLength.Text);
                int lineLength   = Int32.Parse(tbFixDoqqLineLength.Text);
                if (headerLength == 0 || lineLength == 0)
                {
                    throw new Exception("Error: neither header length nor line length can be 0");
                }

                LoadDraft draft = new LoadDraft(Config.LOADLIST_STAGE1_PATH);
                foreach (LoadDraftRecord rec in draft.records)
                {
                    rec.FixDoqqHeader(headerLength, lineLength);
                }

                ShowMessage("Fix success!");
            });
        }