当前位置: 首页>>代码示例>>C#>>正文


C# Options.Save方法代码示例

本文整理汇总了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();
        }
开发者ID:banksyhf,项目名称:Auxilium-2,代码行数:17,代码来源:frmOptions.cs

示例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
                            {
//.........这里部分代码省略.........
开发者ID:kmrgithub,项目名称:KRSrcWorkflow,代码行数:101,代码来源:ExtractTextAndMetadata.cs


注:本文中的Options.Save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。