private void start_operation() { string input_clog = CONFIG.GetBasePath() + "clog1"; string clog_inofbn = CONFIG.GetBasePath() + "clog.inofbn"; string clog_inofbnclean = CONFIG.GetBasePath() + "clog.inofbn.clean"; string clog_dbn = CONFIG.GetBasePath() + "clog.dbn"; string clog_dbnclean = CONFIG.GetBasePath() + "clog.dbn.clean"; string clog_fporder = CONFIG.GetBasePath() + "clog.fporder"; string fpdb_input = CONFIG.GetBasePath() + "fpdb1"; string fpdb_dbncleaned = CONFIG.GetBasePath() + "fpdb.dbn.clean"; string fpdb_fporder = CONFIG.GetBasePath() + "fpdb.fporder"; string fpdb_temp = CONFIG.GetBasePath() + "fpdb.temp"; string dedupeScript_a = CONFIG.GetBasePath() + "script.dedupeop.temp"; string dedupeScript = CONFIG.GetBasePath() + "script.dedupeop"; REDDY.ptrRedFS.dedupe_swap_changelog(); if (File.Exists(input_clog) == false) { DEFS.DEBUG("DE", "Input clog does not exist, so no dedupe op now!"); return; } /* * Prepare the changelog. */ print_file(RECORD_TYPE.FINGERPRINT_RECORD_CLOG, DEDUP_SORT_ORDER.DBN_BASED, input_clog, input_clog + ".txt"); m_stage = DEDUP_ENGINE_STAGE.SORT_CLOG_INOFBN; sort_dedupe_file(RECORD_TYPE.FINGERPRINT_RECORD_CLOG, input_clog, clog_inofbn, DEDUP_SORT_ORDER.INO_FBN_BASED); ui.Update_DedupeUI(DEDUP_ENGINE_STAGE.SORT_CLOG_INOFBN, 100); print_file(RECORD_TYPE.FINGERPRINT_RECORD_CLOG, DEDUP_SORT_ORDER.INO_FBN_BASED, clog_inofbn, clog_inofbn + ".txt"); m_stage = DEDUP_ENGINE_STAGE.CLEAN_CLOG_INOFBNSTALES; clean_clog_file_P1(clog_inofbn, clog_inofbnclean); ui.Update_DedupeUI(DEDUP_ENGINE_STAGE.CLEAN_CLOG_INOFBNSTALES, 100); print_file(RECORD_TYPE.FINGERPRINT_RECORD_CLOG, DEDUP_SORT_ORDER.INO_FBN_BASED, clog_inofbnclean, clog_inofbnclean + ".txt"); m_stage = DEDUP_ENGINE_STAGE.SORT_CLOG_DBN; sort_dedupe_file(RECORD_TYPE.FINGERPRINT_RECORD_CLOG, clog_inofbnclean, clog_dbn, DEDUP_SORT_ORDER.DBN_BASED); ui.Update_DedupeUI(DEDUP_ENGINE_STAGE.SORT_CLOG_DBN, 100); //commenting this off for now. print_file(RECORD_TYPE.FINGERPRINT_RECORD_CLOG, DEDUP_SORT_ORDER.DBN_BASED, clog_dbn, clog_dbn + ".txt"); m_stage = DEDUP_ENGINE_STAGE.CLEAN_CLOG_DBNSTALES; clean_clog_file_P2(clog_dbn, clog_dbnclean); ui.Update_DedupeUI(DEDUP_ENGINE_STAGE.CLEAN_CLOG_DBNSTALES, 100); print_file(RECORD_TYPE.FINGERPRINT_RECORD_CLOG, DEDUP_SORT_ORDER.DBN_BASED, clog_dbnclean, clog_dbnclean + ".txt"); m_stage = DEDUP_ENGINE_STAGE.SORT_CLOG_FPORDER; sort_dedupe_file(RECORD_TYPE.FINGERPRINT_RECORD_CLOG, clog_dbnclean, clog_fporder, DEDUP_SORT_ORDER.FINGERPRINT_BASED); print_file(RECORD_TYPE.FINGERPRINT_RECORD_CLOG, DEDUP_SORT_ORDER.FINGERPRINT_BASED, clog_fporder, clog_fporder + ".txt"); ui.Update_DedupeUI(DEDUP_ENGINE_STAGE.SORT_CLOG_FPORDER, 100); remove_file(input_clog); remove_file(clog_inofbn); remove_file(clog_inofbnclean); remove_file(clog_dbn); remove_file(clog_dbnclean); /* * Prepare the fpdb. we have 'clog_fporder' from above steps * We must have a delete log that should be applied to clean the FPDB, */ if (File.Exists(fpdb_input)) { print_file(RECORD_TYPE.FINGERPRINT_RECORD_FPDB, DEDUP_SORT_ORDER.DBN_BASED, fpdb_input, fpdb_input + ".old.txt"); m_stage = DEDUP_ENGINE_STAGE.CLEAN_FPDB_DBNSTALES; clean_fpdb_P1(fpdb_input, fpdb_dbncleaned); remove_file(fpdb_input); ui.Update_DedupeUI(DEDUP_ENGINE_STAGE.CLEAN_FPDB_DBNSTALES, 100); print_file(RECORD_TYPE.FINGERPRINT_RECORD_FPDB, DEDUP_SORT_ORDER.DBN_BASED, fpdb_dbncleaned, fpdb_dbncleaned + ".txt"); m_stage = DEDUP_ENGINE_STAGE.SORT_FPDB_FPORDER; sort_dedupe_file(RECORD_TYPE.FINGERPRINT_RECORD_FPDB, fpdb_dbncleaned, fpdb_fporder, DEDUP_SORT_ORDER.FINGERPRINT_BASED); remove_file(fpdb_dbncleaned); print_file(RECORD_TYPE.FINGERPRINT_RECORD_FPDB, DEDUP_SORT_ORDER.FINGERPRINT_BASED, fpdb_fporder, fpdb_fporder + ".txt"); ui.Update_DedupeUI(DEDUP_ENGINE_STAGE.SORT_FPDB_FPORDER, 100); } /* * Do the dedupe operation. we have 'fpdb_fporder' from above steps. */ m_stage = DEDUP_ENGINE_STAGE.GENERATE_DEDUPE_SCRIPT; GenDedupeScript(fpdb_fporder, clog_fporder, fpdb_temp, dedupeScript_a); print_file(RECORD_TYPE.FINGERPRINT_RECORD_MSG, DEDUP_SORT_ORDER.FINGERPRINT_BASED, dedupeScript_a, dedupeScript_a + ".txt"); print_file(RECORD_TYPE.FINGERPRINT_RECORD_FPDB, DEDUP_SORT_ORDER.FINGERPRINT_BASED, fpdb_temp, fpdb_temp + ".txt"); remove_file(fpdb_fporder); remove_file(clog_fporder); ui.Update_DedupeUI(DEDUP_ENGINE_STAGE.GENERATE_DEDUPE_SCRIPT, 100); /* * Create the new fpdb. */ m_stage = DEDUP_ENGINE_STAGE.SORT_FPDBT_DBN; sort_dedupe_file(RECORD_TYPE.FINGERPRINT_RECORD_FPDB, fpdb_temp, fpdb_input, DEDUP_SORT_ORDER.DBN_BASED); print_file(RECORD_TYPE.FINGERPRINT_RECORD_FPDB, DEDUP_SORT_ORDER.DBN_BASED, fpdb_input, fpdb_input + ".txt"); remove_file(fpdb_temp); ui.Update_DedupeUI(DEDUP_ENGINE_STAGE.SORT_FPDBT_DBN, 100); m_stage = DEDUP_ENGINE_STAGE.SORT_SCRIPT_INOFBN; sort_dedupe_file(RECORD_TYPE.FINGERPRINT_RECORD_MSG, dedupeScript_a, dedupeScript, DEDUP_SORT_ORDER.INO_FBN_BASED); print_file(RECORD_TYPE.FINGERPRINT_RECORD_MSG, DEDUP_SORT_ORDER.INO_FBN_BASED, dedupeScript, dedupeScript + ".txt"); ui.Update_DedupeUI(DEDUP_ENGINE_STAGE.SORT_SCRIPT_INOFBN, 100); //rename the file and get over with it. m_stage = DEDUP_ENGINE_STAGE.DEDUPE_MESSAGES; ACTUAL_DEDUPE(dedupeScript); remove_file(dedupeScript); remove_file(dedupeScript_a); ui.Update_DedupeUI(DEDUP_ENGINE_STAGE.DEDUPE_MESSAGES, 100); m_stage = DEDUP_ENGINE_STAGE.DEDUPE_DONE; System.Threading.Thread.Sleep(2000); ui.Update_DedupeUI(DEDUP_ENGINE_STAGE.DEDUPE_DONE, 100); }
public void Update_DedupeUI(DEDUP_ENGINE_STAGE stage, int i) { if (InvokeRequired) { this.BeginInvoke(new Action <DEDUP_ENGINE_STAGE, int>(Update_DedupeUI), new object[] { stage, i }); return; } switch (stage) { case DEDUP_ENGINE_STAGE.NOT_STARTED: break; case DEDUP_ENGINE_STAGE.SORT_CLOG_INOFBN: pclog_1.Value = i; break; case DEDUP_ENGINE_STAGE.CLEAN_CLOG_INOFBNSTALES: pclog_2.Value = i; break; case DEDUP_ENGINE_STAGE.SORT_CLOG_DBN: pclog_3.Value = i; break; case DEDUP_ENGINE_STAGE.CLEAN_CLOG_DBNSTALES: pclog_4.Value = i; break; case DEDUP_ENGINE_STAGE.SORT_CLOG_FPORDER: pclog_5.Value = i; break; case DEDUP_ENGINE_STAGE.CLEAN_FPDB_DBNSTALES: pfpdb_1.Value = i; break; case DEDUP_ENGINE_STAGE.SORT_FPDB_FPORDER: pfpdb_2.Value = i; break; case DEDUP_ENGINE_STAGE.GENERATE_DEDUPE_SCRIPT: pgen_1.Value = i; break; case DEDUP_ENGINE_STAGE.SORT_FPDBT_DBN: pgen_2.Value = i; break; case DEDUP_ENGINE_STAGE.SORT_SCRIPT_INOFBN: pgen_3.Value = i; break; case DEDUP_ENGINE_STAGE.DEDUPE_MESSAGES: pmsg_1.Value = i; break; case DEDUP_ENGINE_STAGE.DEDUPE_DONE: Close(); break; } }