/// <summary> /// Constructor of the class /// </summary> /// <param name="flags">Combine flag values to specify which data should be dumped.</param> /// <param name="outputDir">output directory. emtpy string means, /// same directory as chm file (only if destination = ExternalFile)</param> /// <param name="compressionLevel">compression which should be used</param> public DumpingInfo(DumpingFlags flags, string outputDir, DumpCompression compressionLevel) { _flags = new BitVector32(0); int i = _flags[DumpFlags]; _flags[DumpFlags] = i | (int)flags; _outputDir = outputDir; _compressionLevel = compressionLevel; }
/// <summary> /// Loads viewer preferences from registry /// </summary> private void LoadRegistryPreferences() { RegistryKey regKey = Registry.LocalMachine.CreateSubKey(LM_Key); bool bEnable = bool.Parse(regKey.GetValue("EnableDumping", true).ToString()); _prefDumpOutput = (string)regKey.GetValue("DumpOutputDir", _prefDumpOutput); _prefDumpCompression = (DumpCompression)((int)regKey.GetValue("CompressionLevel", _prefDumpCompression)); _prefDumpFlags = (DumpingFlags)((int)regKey.GetValue("DumpingFlags", _prefDumpFlags)); if (bEnable) { _dmpInfo = new DumpingInfo(_prefDumpFlags, _prefDumpOutput, _prefDumpCompression); } else { _dmpInfo = null; } _prefURLPrefix = (string)regKey.GetValue("ITSUrlPrefix", _prefURLPrefix); _prefUseHH2TreePics = bool.Parse(regKey.GetValue("UseHH2TreePics", _prefUseHH2TreePics).ToString()); }
/// <summary> /// Called if the user clicks OK /// </summary> /// <param name="sender">sender of the event</param> /// <param name="e">event parameter</param> private void btnOK_Click(object sender, System.EventArgs e) { if (chkDEnableDump.Checked) { DumpingFlags flags = 0; if (chkTextTOC.Checked) { flags |= DumpingFlags.DumpTextTOC; } if (chkBinTOC.Checked) { flags |= DumpingFlags.DumpBinaryTOC; } if (chkTextIdx.Checked) { flags |= DumpingFlags.DumpTextIndex; } if (chkBinIdx.Checked) { flags |= DumpingFlags.DumpBinaryIndex; } if (chkStrings.Checked) { flags |= DumpingFlags.DumpStrings; } if (chkUrlstr.Checked) { flags |= DumpingFlags.DumpUrlStr; } if (chkUrltbl.Checked) { flags |= DumpingFlags.DumpUrlTbl; } if (chkTopics.Checked) { flags |= DumpingFlags.DumpTopics; } if (chkFulltext.Checked) { flags |= DumpingFlags.DumpFullText; } DumpCompression compression = (DumpCompression)cbCompression.SelectedIndex; string sPath = ""; if (rbSF.Checked) { sPath = GetSpecialFolderPath(); } else { sPath = txtFolderName.Text; } if (!Directory.Exists(sPath)) { MessageBox.Show("The path \n " + sPath + "\ndould not be found on your PC !", "Path error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } _prefDumpOutput = sPath; _prefDumpCompression = compression; _prefDumpFlags = flags; _dmpInfo = new DumpingInfo(flags, sPath, compression); } else { _dmpInfo = null; } this.DialogResult = DialogResult.OK; this.Close(); }