本文整理汇总了C#中Options.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Options.Save方法的具体用法?C# Options.Save怎么用?C# Options.Save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Options
的用法示例。
在下文中一共展示了Options.Save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SettingsChanged
private void SettingsChanged(object sender, EventArgs e)
{
Options = new Options()
{
Timestamps = cbTimestamps.Checked,
ChatNotifications = cbNotifications.Checked,
MinimizeToTray = cbMinimizeToTray.Checked,
AudioNotification = cbNotificationSound.Checked,
SpaceMessages = cbSpaceMessages.Checked,
JoinLeaveEvents = cbUserEvents.Checked,
WriteMessages = cbWriteMessages.Checked,
RememberFormSize = cbRememberFormSize.Checked,
RememberFont = cbRememberFont.Checked
};
Options.Save();
}
示例2: extractText
// called to extract text from a file
// passed - sourceFileName - full path of file to extract text from
// returns -
// indexText - text that will be used for Lucene indexing, includes metadata
// analysisText - text that will be used for clustering and LSA
// errorFlag - false if an unrecoverable error occurred, else true
// errorText - text of error if one occurred
public void extractText(string docID, string sourceFileName, string title, ref string indexText, ref string analysisText,
List<ErrorDataObject> errObjs, out bool errorFlag)
{
Options dtOptions;
FileConverter fileConverter;
StringBuilder outStringIndex = new StringBuilder();
StringBuilder outStringAnalysis = new StringBuilder();
errorFlag = true;
indexText = "";
analysisText = "";
try
{
// construct temporary file name for xml file output by dtSearch
string targetFileNameDTSearch = @"C:\temp\_DTSearch.txt";
File.Delete(targetFileNameDTSearch);
dtOptions = new Options();
dtOptions.FieldFlags = FieldFlags.dtsoFfOfficeSkipHiddenContent;
dtOptions.BinaryFiles = BinaryFilesSettings.dtsoIndexSkipBinary;
dtOptions.Save();
fileConverter = new FileConverter();
fileConverter.InputFile = sourceFileName;
fileConverter.OutputFile = targetFileNameDTSearch;
fileConverter.OutputFormat = OutputFormats.it_ContentAsXml;
fileConverter.Flags = ConvertFlags.dtsConvertInlineContainer;
fileConverter.Execute();
//check for image file type
TypeId deType = fileConverter.DetectedTypeId;
if (imageTypes.Contains(deType))
{
errObjs.Add(new ErrorDataObject("1002", "Image File Type: " + deType.ToString(), "Warning"));
}
// return if there is a dtSearch error other than file corrupt (10) or file encrypted (17)
JobErrorInfo errorInfo = fileConverter.Errors;
bool fatalError = false;
bool fileMissingOrNoText = false;
int dtErCode = 0;
if (errorInfo != null && errorInfo.Count > 0)
{
for (int i = 0; i < errorInfo.Count; i++)
{
dtErCode = errorInfo.Code(i);
string errorCode = "";
if (dtErCode != 9 && dtErCode != 10 && dtErCode != 17 && dtErCode != 207 && dtErCode != 16 && dtErCode != 21)
{
errObjs.Add(new ErrorDataObject("1005", "Text extraction Error occurred during processing of the document. " + errorInfo.Message(i), "Error"));
fatalError = true;
}
else
{
string errText = "";
if (dtErCode == 10) // dtsErFileCorrupt
{
errorCode = "1013";
errText = "Document is corrupted.";
}
if (dtErCode == 17) // dtsErFileEncrypted
{
errorCode = "1007";
errText = "A component of the document is encrypted.";
}
if (dtErCode == 207) // dtsErContainerItemEncrypted, internal error code
{
errorCode = "1014";
errText = "The document is encrypted.";
string text = errorInfo.Message(i);
if (text != null)
{
int index = text.IndexOf("->");
if (index >= 0)
{
errText = "A component of the document is encrypted. " + text.Substring(index);
}
}
}
if (dtErCode == 9) // dtsErAccFile
{
errorCode = "1010";
errText = "The system cannot access the file specified.";
}
if (dtErCode == 16) // dtsErFileNotFound
{
errorCode = "1011";
errText = "Document file does not exist.";
}
if (dtErCode == 21) // dtsErFileEmpty
{
//.........这里部分代码省略.........