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


C# Options.Add方法代码示例

本文整理汇总了C#中Options.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Options.Add方法的具体用法?C# Options.Add怎么用?C# Options.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Options的用法示例。


在下文中一共展示了Options.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            Console.WriteLine("Stitch Command Line Compiler {0}", Assembly.GetExecutingAssembly().GetName().Version.ToString());
            Console.WriteLine("Copyright (C) 2011 Nathan Palmer");
            Console.WriteLine("http://github.com/nathanpalmer/stitch-aspnet");
            Console.WriteLine();

            try
            {
                var options = new Options();
                var configuration = new Settings();
                options.Add("r=|root=", "Root path (default is working directory)", v => configuration.Root = v);
                options.Add("p=|paths=", "Comma delimited list of paths that should be compiled", v => configuration.Paths = v.Split(','));
                options.Add("d=|dep=", "Comma delimited list of dependencies that should be included", v => configuration.Dependencies = v.Split(','));
                options.Add("i=|identifier=", "Identifier to use for including other files (default is require)", v => configuration.Identifier = v);
                options.Add("c=|compilers=", "Comma delimited list of compilers to use (default is CoffeeScriptCompiler, JavaScriptCompiler)", v => configuration.Compilers = v.Split(',').Select(compiler => (ICompile) Activator.CreateInstance(Type.GetType("Stitch.Compilers." + compiler + ", Stitch.Core"))).ToArray());

                if (args.Length == 0)
                {
                    ShowHelp(options, "No arguments specified.");
                }
                else
                {
                    var extra = options.Parse(args).ToArray();
                    if (extra.Length > 1)
                    {
                        Console.WriteLine("The following arguments did not parse.\r\n\r\n" + string.Join(",", extra));
                    }
                    else if (extra.Length == 1)
                    {
                        var file = new FileInfo(extra[0]);
                        if (file.Exists)
                        {
                            file.Delete();
                        }

                        Console.WriteLine("Generating {0}", file.Name);

                        var package = new Package(
                            configuration.Root,
                            configuration.Paths,
                            configuration.Dependencies,
                            configuration.Identifier ?? "require",
                            configuration.Compilers);

                        File.WriteAllText(file.FullName, package.Compile());
                    }
                    else
                    {
                        ShowHelp(options, "You must specify a destination.");
                        return;
                    }

                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Fatal Exception: " + ex.ToString());
            }
        }
开发者ID:nathanpalmer,项目名称:stitch-aspnet,代码行数:60,代码来源:Program.cs

示例2: GetPendingChangelists

        public static Dictionary<int, Changelist> GetPendingChangelists()
        {
            var repo = GetRepository();

            var options = new Options();
            options.Add("-s", "pending");
            options.Add("-u", AutoDetectP4Setting(P4Setting.P4USER));
            options.Add("-l", ""); // full text description

            return repo.GetChangelists(options).ToDictionary(changelist => changelist.Id);
        }
开发者ID:Art1stical,项目名称:AHRUnrealEngine,代码行数:11,代码来源:PerforceHelper.cs

示例3: AddValue

 public void AddValue()
 {
     var options = new Options();
     options.Add("MyTest", "result");
     Assert.AreEqual(1, options.Count);
     Assert.AreEqual("result", options["MyTest"]);
 }
开发者ID:WestDiscGolf,项目名称:GotConnection,代码行数:7,代码来源:OptionsTest.cs

示例4: ShouldAllowLookupOfAllAddedValuesForEachKey

        public void ShouldAllowLookupOfAllAddedValuesForEachKey()
        {
            var lookup = new Options();

            lookup.Add("A", "A1");
            lookup.Add("B", "B1");
            lookup.Add("A", "A2");
            lookup.Add("A", "A3");

            lookup.Count.ShouldEqual(2);
            lookup.Keys.ShouldEqual("A", "B");
            lookup.Contains("A").ShouldBeTrue();
            lookup.Contains("B").ShouldBeTrue();
            lookup.Contains("C").ShouldBeFalse();
            lookup["A"].ShouldEqual("A1", "A2", "A3");
            lookup["B"].ShouldEqual("B1");
        }
开发者ID:leijiancd,项目名称:fixie,代码行数:17,代码来源:OptionsTests.cs

示例5: CommandLineParser

        public CommandLineParser(params string[] args)
        {
            var queue = new Queue<string>(args);

            var assemblyPaths = new List<string>();
            var options = new Options();
            var errors = new List<string>();

            while (queue.Any())
            {
                var item = queue.Dequeue();

                if (IsKey(item))
                {
                    if (!queue.Any() || IsKey(queue.Peek()))
                    {
                        errors.Add($"Option {item} is missing its required value.");
                        break;
                    }

                    var key = KeyName(item);
                    var value = queue.Dequeue();

                    options.Add(key, value);
                }
                else
                {
                    assemblyPaths.Add(item);
                }
            }

            if (!errors.Any() && !assemblyPaths.Any())
                errors.Add("Missing required test assembly path(s).");

            foreach (var assemblyPath in assemblyPaths)
            {
                if (!File.Exists(assemblyPath))
                    errors.Add("Specified test assembly does not exist: " + assemblyPath);
                else if (!AssemblyDirectoryContainsFixie(assemblyPath))
                    errors.Add($"Specified assembly {assemblyPath} does not appear to be a test assembly. Ensure that it references Fixie.dll and try again.");
            }

            AssemblyPaths = assemblyPaths.ToArray();
            Options = options;
            Errors = errors.ToArray();
        }
开发者ID:jbogard,项目名称:fixie,代码行数:46,代码来源:CommandLineParser.cs

示例6: CommandLineParser

        public CommandLineParser(params string[] args)
        {
            var queue = new Queue<string>(args);

            var assemblyPaths = new List<string>();
            var options = new Options();
            var errors = new List<string>();

            while (queue.Any())
            {
                var item = queue.Dequeue();

                if (IsKey(item))
                {
                    if (!queue.Any() || IsKey(queue.Peek()))
                    {
                        errors.Add($"Option {item} is missing its required value.");
                        break;
                    }

                    var key = KeyName(item);
                    var value = queue.Dequeue();

                    options.Add(key, value);
                }
                else
                {
                    assemblyPaths.Add(item);
                }
            }

            if (!errors.Any() && !assemblyPaths.Any())
                errors.Add("Missing required test assembly path(s).");

            foreach (var assemblyPath in assemblyPaths)
                if (!File.Exists(assemblyPath))
                    errors.Add("Specified test assembly does not exist: " + assemblyPath);

            AssemblyPaths = assemblyPaths.ToArray();
            Options = options;
            Errors = errors.ToArray();
        }
开发者ID:leijiancd,项目名称:fixie,代码行数:42,代码来源:CommandLineParser.cs

示例7: CommandLineParser

        public CommandLineParser(params string[] args)
        {
            var queue = new Queue<string>(args);

            var assemblyPaths = new List<string>();
            var optionList = new Options();
            var errors = new List<string>();

            while (queue.Any())
            {
                var item = queue.Dequeue();

                if (IsKey(item))
                {
                    if (!queue.Any() || IsKey(queue.Peek()))
                    {
                        errors.Add(string.Format("Option {0} is missing its required value.", item));
                        break;
                    }

                    var key = KeyName(item);
                    var value = queue.Dequeue();

                    optionList.Add(key, value);
                }
                else
                {
                    assemblyPaths.Add(item);
                }
            }

            if (!errors.Any() && !assemblyPaths.Any())
                errors.Add("Missing required test assembly path(s).");

            AssemblyPaths = assemblyPaths.ToArray();
            Options = optionList;
            Errors = errors.ToArray();
        }
开发者ID:JohnStov,项目名称:fixie,代码行数:38,代码来源:CommandLineParser.cs

示例8: PerformDefaultActions

        /// <summary>
        /// Perform actions which can be automated, such as moving and deleting files.
        /// </summary>
        private void PerformDefaultActions()
        {
            if (CheckConnect())
            {
                using (Connection P4Connection = P4Repository.Connection)
                {
                    AddDeleteFilesToDefaultChangeList(P4Connection);
                    AddMoveFilesToDefaultChangeList(P4Connection);

                    //if there are files to move or delete submit them otherwise delete the changelist
                    try
                    {
                        Options SubmitOptions = new Options();

                        //Add a description
                        SubmitOptions.Add("-d", String.Format(Settings.Default.MoveDeleteChangelistDescription, _connectionDetails.UserSavedStatePreferredLanguage));

                        SubmitResults DeleteMoveSubmitResults = P4Connection.Client.SubmitFiles(SubmitOptions, null);

                        log.Info(String.Format("Delete and move files submitted in CL# {0}, Files affected:", DeleteMoveSubmitResults.ChangeIdAfterSubmit));
                        foreach (var SubmittedFile in DeleteMoveSubmitResults.Files)
                        {
                            log.Info(String.Format("\t{0}:\t{1}({2})", SubmittedFile.Action, SubmittedFile.File.DepotPath, SubmittedFile.File.Version));
                        }
                    }
                    catch (P4Exception ex)
                    {
                        //Swallow No files to submit error
                        if (ex.ErrorCode != 806427698)
                        {
                            log.Error("Error in submitting move delete changelist:");
                            log.Error(ex.Message);
                        }
                    }
                }
            }
        }
开发者ID:Art1stical,项目名称:AHRUnrealEngine,代码行数:40,代码来源:UnrealDocTranslatorForm.cs

示例9: GetIntFileSpecForFileChangelist

        /// <summary>
        /// Get the FileSpec for a depot file given a changelist
        /// </summary>
        /// <param name="depotFileName">The file name in current depot location</param>
        /// <param name="changelist">The language file's changelist to be used to find an older version of the int file</param>
        /// <param name="checkForRenameMove">Check if the file has changed names due to a move/rename</param>
        /// <returns>FileSpec which may have a different depotfilename than that passed into function if the file has been moved since changelist</returns>
        private FileSpec GetIntFileSpecForFileChangelist(string depotFileName, int changelist, bool checkForRenameMove)
        {
            if (!CheckConnect())
            {
                return null;
            }

            if (checkForRenameMove)
            {
                PathSpec HistoryPathSpec = new DepotPath(depotFileName) as PathSpec;

                FileSpec[] HistoryFiles = new FileSpec[1];
                HistoryFiles[0] = new FileSpec(HistoryPathSpec, VersionSpec.Head);

                Options Opts = new Options();
                Opts.Add("-i", "");
                IList<FileHistory> History = P4Repository.GetFileHistory(Opts, HistoryFiles);

                // walk through history until we find the first changelist older than the specified changelist
                foreach (FileHistory Item in History)
                {
                    if (Item.ChangelistId > changelist)
                    {
                        continue;
                    }

                    // use the depot filename at this revision
                    HistoryPathSpec = Item.DepotPath;
                    break;
                }

                return new FileSpec(HistoryPathSpec, new ChangelistIdVersion(changelist));
            }
            else
            {
                return new FileSpec(new DepotPath(depotFileName) as PathSpec, new ChangelistIdVersion(changelist));
            }
        }
开发者ID:Art1stical,项目名称:AHRUnrealEngine,代码行数:45,代码来源:UnrealDocTranslatorForm.cs

示例10: Main

        static int Main(string[] args)
        {
            try
            {
                var directories = new List<string>();
                var files = new List<string>();

                var programCommand = Command.None;
                Func<CompositionContractInfo, bool> contractPredicate = c => false;
                Func<CompositionInfo, PartDefinitionInfo, bool> partPredicate = (ci, p) => false;
                var verbose = false;
                var whitelist = new RejectionWhitelist();

                var opts = new Options();
                
                opts.Add<string>("dir", @"C:\MyApp\Parts", "Specify directories to search for parts.",
                    d => directories.Add(d));
                opts.Add<string>("file", "MyParts.dll", "Specify assemblies to search for parts.",
                    f => files.Add(f));
                opts.AddSwitch("verbose", "Print verbose information on each part.",
                    () => verbose = true);

                var programCommandGroup = new ExclusiveGroup();

                opts.Add<string>("type", "MyNamespace.MyType", "Print details of the given part type.", t => {
                        programCommand = Command.PrintParts;
                        partPredicate = AddToPredicate(partPredicate, (ci, p) => p == ci.GetPartDefinitionInfo(t));
                    },
                    programCommandGroup);

                opts.Add<string>("importers", "MyContract", "List importers of the given contract.", i => {
                        programCommand = Command.PrintParts;
                        partPredicate = AddToPredicate(partPredicate, (ci, p) => p.ImportsContract(i));
                    },
                    programCommandGroup);

                opts.Add<string>("exporters", "MyContract", "List exporters of the given contract.", e => {
                        programCommand = Command.PrintParts;
                        partPredicate = AddToPredicate(partPredicate, (ci, p) => p.ExportsContract(e));
                    },
                    programCommandGroup);

                opts.AddSwitch("rejected", "List all rejected parts.", () => {
                        programCommand = Command.PrintParts;
                        partPredicate = AddToPredicate(partPredicate, (ci, p) => p.IsRejected);
                    },
                    programCommandGroup);

                opts.AddSwitch("causes", "List root causes - parts with errors not related to the rejection of other parts.", () => {
                        programCommand = Command.PrintParts;
                        partPredicate = AddToPredicate(partPredicate, (ci, p) => p.IsPrimaryRejection);
                    },
                    programCommandGroup);

                opts.Add<string>("whitelist", "RejectionWhitelist.txt", "Specify parts that may be validly rejected; requres the /rejected or /causes commands.",
                    w => whitelist = new RejectionWhitelist(w));

                opts.AddSwitch("parts", "List all parts found in the source assemblies.", () => {
                        programCommand = Command.PrintParts;
                        partPredicate = AddToPredicate(partPredicate, (ci, p) => true);
                    },
                    programCommandGroup);

                opts.AddSwitch("?", "Print usage.",
                    () => programCommand = Command.PrintUsage, programCommandGroup);

                var contractsSubgroup = new InclusiveSubroup(programCommandGroup);
                opts.AddSwitch("imports", "Find imported contracts.", () => {
                        programCommand = Command.PrintContracts;
                        contractPredicate = AddToPredicate(contractPredicate, c => c.Importers.Any());
                    },
                    contractsSubgroup);

                opts.AddSwitch("exports", "Find exported contracts.", () => {
                        programCommand = Command.PrintContracts;
                        contractPredicate = AddToPredicate(contractPredicate, c => c.Exporters.Any());
                    },
                    contractsSubgroup);

                opts.Parse(args);

                return Run(directories, files, programCommand, contractPredicate, partPredicate, verbose, whitelist, opts);
            }
            catch (Exception ex)
            {
                Console.Write("Error: ");
                Console.WriteLine(ex.Message);
                return 1;
            }
        }
开发者ID:ibratoev,项目名称:MEF.NET35,代码行数:90,代码来源:Program.cs

示例11: GetWorkspaces

        /// <summary>
        /// Gets list of workspaces for a given server and user</summary>
        /// <param name="serverAddress">Server address</param>
        /// <param name="userId">User ID</param>
        /// <returns>List of workspaces</returns>
        public IEnumerable<string> GetWorkspaces(string serverAddress, string userId)
        {
            var result = new List<string>();
            try
            {
                var server = new Server(new ServerAddress(serverAddress));
                var repository = new Repository(server);
                
                // This call ensures internal P4Server is set for repository.Connection,
                //  otherwise GetUsers() call will fail.
                repository.Connection.Connect(ConnectionOptions);

                if (CheckLogin(repository.Connection))
                {
                    var opts = new Options();
                    opts.Add("-u", userId); //The -u user flag lists client workspaces that are owned by the  specified user. 

                    foreach (var client in repository.GetClients(opts))
                        result.Add(client.Name);
                }

            }
            catch (P4Exception ex)
            {
                switch (ex.ErrorLevel)
                {
                    case ErrorSeverity.E_WARN:
                        Outputs.WriteLine(OutputMessageType.Warning, ex.Message);
                        break;
                    case ErrorSeverity.E_FAILED:
                        Outputs.WriteLine(OutputMessageType.Error, ex.Message);
                        break;
                    case ErrorSeverity.E_INFO:
                        Outputs.WriteLine(OutputMessageType.Info, ex.Message);
                        break;
                }
                if (ThrowExceptions)
                    throw;
            }
          
            return result;
        }
开发者ID:GeertVL,项目名称:ATF,代码行数:47,代码来源:ConnectionManager.cs

示例12: CommandLineParser

        public CommandLineParser(params string[] args)
        {
            var queue = new Queue<string>(args);

            var assemblyPaths = new List<string>();
            var optionList = new Options();
            var errors = new List<string>();

            while (queue.Any())
            {
                var item = queue.Dequeue();

                if (IsKey(item))
                {
                    var key = KeyName(item);

                    key = CorrectlyCasedKey(key);

                    if (key == null)
                    {
                        errors.Add(string.Format("Option {0} is not recognized.", item));
                        break;
                    }

                    if (!queue.Any() || IsKey(queue.Peek()))
                    {
                        errors.Add(string.Format("Option {0} is missing its required value.", item));
                        break;
                    }

                    var value = queue.Dequeue();

                    if (key == CommandLineOption.Parameter)
                    {
                        if (value.Contains("="))
                        {
                            var equalSignIndex = value.IndexOf('=');

                            if (equalSignIndex == 0)
                            {
                                errors.Add(string.Format("Custom parameter {0} is missing its required key.", value));
                                break;
                            }

                            key = value.Substring(0, equalSignIndex);
                            value = value.Substring(equalSignIndex + 1);
                        }
                        else
                        {
                            key = value;
                            value = "on";
                        }
                    }

                    optionList.Add(key, value);
                }
                else
                {
                    assemblyPaths.Add(item);
                }
            }

            if (!errors.Any() && !assemblyPaths.Any())
                errors.Add("Missing required test assembly path(s).");

            AssemblyPaths = assemblyPaths.ToArray();
            Options = optionList;
            Errors = errors.ToArray();
        }
开发者ID:scichelli,项目名称:fixie,代码行数:69,代码来源:CommandLineParser.cs

示例13: QueryChangelists

		/// <summary>
		/// Query the server for multiple changelists in a range specified by the query parameter
		/// </summary>
		/// <param name="InQuery">Changelist query representing a start and end changelist number to query the Perforce server for changelists between</param>
		/// <return>Returns a list of changelists</return>
        public IList<Changelist> QueryChangelists(P4ChangelistSpanQuery InQuery)
		{
            IList<Changelist> ChangelistRecordSet = null;

			// Only attempt to query if actually connected
			if (ConnectionStatus == EP4ConnectionStatus.P4CS_Connected)
			{
				try
				{
                    Options options = new Options();
                    
                    //Extended descriptions
                    options.Add("-l",null);

                    //Only submitted changelists
                    options.Add("-s", "submitted");

                    //Filter by user
                    if (!string.IsNullOrWhiteSpace(InQuery.FilterUser))
                    {
                        options.Add("-u", InQuery.FilterUser);
                    }

                    ChangelistRecordSet = mP4Repository.GetChangelists(options, InQuery.FileFilter);
				}
				catch (P4Exception E)
				{
					Console.WriteLine("Error running Perforce command!\n{0}", E.Message);
				}
			}
            return ChangelistRecordSet;
		}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:37,代码来源:P4Inquirer.cs

示例14: SelectFeatures

        public override IEnumerable<string> SelectFeatures(Prediction prediction)
        {
            _libLinear.LoadClassificationModelFiles();

            string logPath = Path.Combine(Model.ModelDirectory, "feature_selection_log.txt");
            System.IO.File.Delete(logPath);

            int nullClass = -1;
            foreach (string unmappedLabel in _libLinear.Labels)
                if (unmappedLabel == PointPrediction.NullLabel)
                    if (nullClass == -1)
                        nullClass = int.Parse(_libLinear.GetMappedLabel(unmappedLabel));
                    else
                        throw new Exception("Multiple null classes in label map");

            if (nullClass == -1)
                throw new Exception("Failed to find null class");

            string featureSelectionTrainingPath = Path.GetTempFileName();

            using (FileStream compressedTrainingInstancesFile = new FileStream(CompressedTrainingInstancesPath, FileMode.Open, FileAccess.Read))
            using (GZipStream compressedTrainingInstancesGzip = new GZipStream(compressedTrainingInstancesFile, CompressionMode.Decompress))
            using (StreamReader trainingInstancesFile = new StreamReader(compressedTrainingInstancesGzip))
            using (FileStream compressedTrainingInstanceLocationsFile = new FileStream(CompressedTrainingInstanceLocationsPath, FileMode.Open, FileAccess.Read))
            using (GZipStream compressedTrainingInstanceLocationsGzip = new GZipStream(compressedTrainingInstanceLocationsFile, CompressionMode.Decompress))
            using (StreamReader trainingInstanceLocationsFile = new StreamReader(compressedTrainingInstanceLocationsGzip))
            using (StreamWriter featureSelectionTrainingFile = new StreamWriter(featureSelectionTrainingPath))
            {
                try
                {
                    string instance;
                    while ((instance = trainingInstancesFile.ReadLine()) != null)
                    {
                        string location = trainingInstanceLocationsFile.ReadLine();
                        if (location == null)
                            throw new Exception("Missing location for training instance");

                        featureSelectionTrainingFile.WriteLine(instance + " # " + location);
                    }

                    if ((instance = trainingInstanceLocationsFile.ReadToEnd()) != null && (instance = instance.Trim()) != "")
                        throw new Exception("Extra training instance locations:  " + instance);

                    trainingInstancesFile.Close();
                    trainingInstanceLocationsFile.Close();
                    featureSelectionTrainingFile.Close();
                }
                catch (Exception ex)
                {
                    throw new Exception("Failed to read training instances:  " + ex.Message);
                }
            }

            string groupNamePath = Path.GetTempFileName();
            Dictionary<string, string> groupNameFeatureId = new Dictionary<string, string>();
            using (StreamWriter groupNameFile = new StreamWriter(groupNamePath))
            {
                foreach (PTL.ATT.Models.Feature feature in Model.Features)
                {
                    int featureNumber;
                    if (_libLinear.TryGetFeatureNumber(feature.Id, out featureNumber))
                    {
                        string groupName = feature.ToString().ReplacePunctuation(" ").RemoveRepeatedWhitespace().Replace(' ', '_').Trim('_');
                        groupNameFile.WriteLine(featureNumber + " " + groupName);
                        groupNameFeatureId.Add(groupName, feature.Id);
                    }
                }
                groupNameFile.Close();
            }

            Options featureSelectionOptions = new Options();
            featureSelectionOptions.Add(FeatureSelector.Option.ExitOnErrorAction, FeatureSelector.ExitOnErrorAction.ThrowException.ToString());
            featureSelectionOptions.Add(FeatureSelector.Option.FeatureFilters, typeof(ZeroVectorFeatureFilter).FullName + "," + typeof(CosineSimilarityFeatureFilter).FullName);
            featureSelectionOptions.Add(FeatureSelector.Option.FloatingSelection, false.ToString());
            featureSelectionOptions.Add(FeatureSelector.Option.GroupNamePath, groupNamePath);
            featureSelectionOptions.Add(FeatureSelector.Option.LogPath, logPath);
            featureSelectionOptions.Add(FeatureSelector.Option.MaxThreads, Configuration.ProcessorCount.ToString());
            featureSelectionOptions.Add(FeatureSelector.Option.PerformanceIncreaseRequirement, float.Epsilon.ToString());
            featureSelectionOptions.Add(FeatureSelector.Option.Scorer, typeof(SurveillancePlotScorer).FullName);
            featureSelectionOptions.Add(FeatureSelector.Option.TrainingInstancesInMemory, true.ToString());
            featureSelectionOptions.Add(FeatureSelector.Option.TrainingInstancesPath, featureSelectionTrainingPath);
            featureSelectionOptions.Add(FeatureSelector.Option.Verbosity, FeatureSelector.Verbosity.Debug.ToString());
            featureSelectionOptions.Add(SurveillancePlotScorer.Option.IgnoredSurveillanceClasses, nullClass.ToString());
            featureSelectionOptions.Add(CommonWrapper.Option.ClassifyExePath, Configuration.ClassifierTypeOptions[GetType()]["predict"]);
            featureSelectionOptions.Add(CommonWrapper.Option.TrainExePath, Configuration.ClassifierTypeOptions[GetType()]["train"]);
            featureSelectionOptions.Add(LibLinearWrapper.Option.IgnoredProbabilisticClasses, nullClass.ToString());
            featureSelectionOptions.Add(LibLinearWrapper.Option.SumInstanceProbabilities, true.ToString());
            featureSelectionOptions.Add(CrossFoldValidator.Option.RandomizeInstanceBlocks, true.ToString());
            featureSelectionOptions.Add(CrossFoldValidator.Option.InstanceBlockRandomizationSeed, (498734983).ToString());
            featureSelectionOptions.Add(CrossFoldValidator.Option.NumFolds, (2).ToString());
            featureSelectionOptions.Add(CosineSimilarityFeatureFilter.Option.Threshold, (0.98).ToString());

            if (_positiveClassWeighting == PositiveClassWeighting.NegativePositiveRatio)
            {
                using (FileStream compressedTrainingInstancesFile = new FileStream(CompressedTrainingInstancesPath, FileMode.Open, FileAccess.Read))
                using (GZipStream compressedTrainingInstancesGzip = new GZipStream(compressedTrainingInstancesFile, CompressionMode.Decompress))
                using (StreamReader compressedTrainingInstancesReader = new StreamReader(compressedTrainingInstancesGzip))
                {
                    Dictionary<int, float> classWeight = GetPerClassWeights(compressedTrainingInstancesReader);
                    foreach (int classNum in classWeight.Keys)
//.........这里部分代码省略.........
开发者ID:ilMagnifico,项目名称:asymmetric-threat-tracker,代码行数:101,代码来源:LibLinear.cs

示例15: submitAllToolStripMenuItem_Click

        /// <summary>
        /// Submit all in the default changelist
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void submitAllToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (CheckConnect())
            {
                using (Connection P4Connection = P4Repository.Connection)
                {
                    try
                    {
                        //revert unchanged files.
                        List<FileSpec> FileSpecsToRevert = new List<FileSpec>();
                        foreach (string File in FilesCheckedOut)
                        {
                            FileSpecsToRevert.Add(new FileSpec(new DepotPath(File), null, null, null));
                        }

                        Options RevertOptions = new Options();

                        //Only files  that are open for edit or integrate and are unchanged or missing
                        RevertOptions.Add("-a", null);

                        P4Connection.Client.RevertFiles(RevertOptions, FileSpecsToRevert.ToArray());

                        // Submit remaining changelist
                        Options SubmitOptions = new Options();

                        //Add a description
                        SubmitOptions.Add("-d", String.Format(Settings.Default.SubmitChangelistDescription, _connectionDetails.UserSavedStatePreferredLanguage));

                        SubmitResults UpdatesInsertsSubmitResults = P4Connection.Client.SubmitFiles(SubmitOptions, null);

                        log.Info(String.Format("Updated and New files submitted in CL# {0}, Files affected:", UpdatesInsertsSubmitResults.ChangeIdAfterSubmit));
                        foreach (var SubmittedFile in UpdatesInsertsSubmitResults.Files)
                        {
                            log.Info(String.Format("\t{0}:\t{1}({2})", SubmittedFile.Action, SubmittedFile.File.DepotPath, SubmittedFile.File.Version));
                        }

                        //Clear checked out files.
                        FilesCheckedOut.Clear();

                        //Mark lines black text
                        foreach (ListViewItem line in FileListView.Items)
                        {
                            line.ForeColor = Color.Black;
                        }
                    }
                    catch (P4Exception ex)
                    {
                        //Swallow No files to submit error
                        if (ex.ErrorCode != 806427698)
                        {
                            log.Error("Error in submitting changelist:");
                            log.Error(ex.Message);
                        }
                    }
                }
            }
        }
开发者ID:Art1stical,项目名称:AHRUnrealEngine,代码行数:62,代码来源:UnrealDocTranslatorForm.cs


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