protected void PrintCommand(Command c) { if (AdditionalOptions.ContainsKey("PrintCommand") && (bool)AdditionalOptions["PrintCommand"] == true) { Info("Executing command {0} {1} in working directory {2}.", c.Text, string.Join(" ", c.CommandOptions), c.WorkingDirectory); } }
protected override void Execute(CodeActivityContext context) { #region Workflow Arguments var switchInvokePowerShell = SwitchInvokePowerShell.Get(context); var powerShellScriptPath = PowerShellScriptPath.Get(context); var nuGetExeFilePath = NuGetExeFilePath.Get(context); var nuSpecFilePath = NuSpecFilePath.Get(context); var basePath = BasePath.Get(context); var outputDirectory = OutputDirectory.Get(context); var version = Version.Get(context); var switchInvokePush = SwitchInvokePush.Get(context); var apiKey = ApiKey.Get(context); var pushDestination = PushDestination.Get(context); var additionalOptions = AdditionalOptions.Get(context); #endregion var resultMessages = SummarizePropertyValues(switchInvokePowerShell, powerShellScriptPath, nuGetExeFilePath, nuSpecFilePath, basePath, outputDirectory, version, switchInvokePush, apiKey, pushDestination, additionalOptions); for (var i = 0; i < resultMessages.Length - 1; i++) { // Write to the log context.WriteBuildMessage(resultMessages[i], BuildMessageImportance.High); } }
public IHttpActionResult PutAdditionalOptions(int id, AdditionalOptions additionalOptions) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != additionalOptions.AdditionalOptionsId) { return(BadRequest()); } db.Entry(additionalOptions).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AdditionalOptionsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
/// <summary> /// Searches an XML file with an XPath expression /// </summary> /// <param name="context"></param> protected override void Execute(CodeActivityContext context) { // get the value of the FilePath var packageInfoFilePath = context.GetValue(PackageInfoFilePath); var packageIndex = context.GetValue(PackageIndex); var outputDirectoryFromBldDef = context.GetValue(OutputDirectoryFromBldDef); var switchInvokePushFromBldDef = context.GetValue(SwitchInvokePushFromBldDef); var pushDestinationFromBldDef = context.GetValue(PushDestinationFromBldDef); var switchInvokePowerShellFromBldDef = context.GetValue(SwitchInvokePowerShellFromBldDef); var versionFromBldDef = context.GetValue(VersionFromBldDef); var basePathFromBldDef = context.GetValue(BasePathFromBldDef); var additionalOptionsFromBldDef = context.GetValue(AdditionalOptionsFromBldDef); var powerShellScriptPathFromBldDef = context.GetValue(PowerShellScriptPathFromBldDef); var packageData = Execute(packageInfoFilePath, packageIndex, basePathFromBldDef, additionalOptionsFromBldDef, outputDirectoryFromBldDef, switchInvokePushFromBldDef, pushDestinationFromBldDef, switchInvokePowerShellFromBldDef, powerShellScriptPathFromBldDef, versionFromBldDef); Name.Set(context, packageData.Name); AdditionalOptions.Set(context, packageData.AdditionalOptions); BasePath.Set(context, packageData.BasePath); NuSpecFilePath.Set(context, packageData.NuSpecFilePath); PowerShellScriptPath.Set(context, packageData.PowerShellScriptPath); Version.Set(context, packageData.Version); OutputDirectory.Set(context, packageData.OutputDirectory); SwitchInvokePush.Set(context, packageData.SwitchInvokePush); PushDestination.Set(context, packageData.PushDestination); SwitchInvokePowerShell.Set(context, packageData.SwitchInvokePowerShell); }
internal MatchContext CreateMatchContext(string subject) { var context = new MatchContext { Subject = subject, StartIndex = StartIndex, AdditionalOptions = AdditionalOptions.ToPatternOptions(), CalloutHandler = WrapCallout(OnCallout) }; if (_matchLimit != null) { context.MatchLimit = _matchLimit.GetValueOrDefault(); } if (_recursionLimit != null) { context.RecursionLimit = _recursionLimit.GetValueOrDefault(); } if (OffsetLimit != null) { context.OffsetLimit = OffsetLimit.GetValueOrDefault(); } return(context); }
public MenuCommand GetMenuCommandOption(string MenuCommandName) { if (MenuCommandName.Contains(" ")) { MenuCommandName = MenuCommandName.Substring(0, MenuCommandName.IndexOf(" ")); } return(AdditionalOptions.FirstOrDefault(O => MenuCommandName.ToLower() == O.Name.ToLower())); }
public object Clone() { var copy = (DataTablesConfiguration)MemberwiseClone(); copy.Order = Order.Select(o => (IList <string>)o.Select(c => (string)c.Clone()).ToList()).ToList(); copy.AdditionalOptions = AdditionalOptions.DeepClone(); copy.Columns = Columns.Select(c => (DataTablesConfigurationColumn)c.Clone()).ToList(); return(copy); }
public IHttpActionResult GetAdditionalOptions(int id) { AdditionalOptions additionalOptions = db.AdditionalOptions.Find(id); if (additionalOptions == null) { return(NotFound()); } return(Ok(additionalOptions)); }
public Capture[] ToCaptures(string path, out string cfamilyLanguage) { var p = new Capture() { Executable = "cl.exe", Cwd = Path.GetDirectoryName(AbsoluteFilePath), CompilerVersion = CompilerVersion, X64 = IsPlatformX64(PlatformName), StdOut = "", }; var c = new Capture() { Executable = p.Executable, Cwd = p.Cwd, Env = new List <string>(), Cmd = new List <string>(), }; c.Env.Add("INCLUDE=" + IncludeDirectories); c.Cmd.Add(c.Executable); Add(c.Cmd, "true".Equals(IgnoreStandardIncludePath) ? "/X" : ""); AddRange(c.Cmd, "/I", AdditionalIncludeDirectories.Split(';')); AddRange(c.Cmd, "/FI", ForcedIncludeFiles.Split(';')); Add(c.Cmd, ConvertPrecompiledHeader(PrecompiledHeader, PrecompiledHeaderFile)); Add(c.Cmd, "true".Equals(UndefineAllPreprocessorDefinitions) ? "/u" : ""); AddRange(c.Cmd, "/D", PreprocessorDefinitions.Split(';')); AddRange(c.Cmd, "/U", UndefinePreprocessorDefinitions.Split(';')); Add(c.Cmd, ConvertCompileAsAndGetLanguage(CompileAs, path, out cfamilyLanguage)); Add(c.Cmd, ConvertCompileAsManaged(CompileAsManaged)); Add(c.Cmd, "true".Equals(CompileAsWinRT) ? "/ZW" : ""); Add(c.Cmd, "true".Equals(DisableLanguageExtensions) ? "/Za" : ""); // defines macro "__STDC__" when compiling C Add(c.Cmd, "false".Equals(TreatWChar_tAsBuiltInType) ? "/Zc:wchar_t-" : ""); // undefines macros "_NATIVE_WCHAR_T_DEFINED" and "_WCHAR_T_DEFINED" Add(c.Cmd, "false".Equals(ForceConformanceInForLoopScope) ? "/Zc:forScope-" : ""); Add(c.Cmd, "true".Equals(OpenMPSupport) ? "/openmp" : ""); Add(c.Cmd, ConvertRuntimeLibrary(RuntimeLibrary)); Add(c.Cmd, ConvertExceptionHandling(ExceptionHandling)); Add(c.Cmd, ConvertEnableEnhancedInstructionSet(EnableEnhancedInstructionSet)); Add(c.Cmd, "true".Equals(OmitDefaultLibName) ? "/Zl" : ""); // defines macro "_VC_NODEFAULTLIB" Add(c.Cmd, "false".Equals(RuntimeTypeInfo) ? "/GR-" : ""); // undefines macro "_CPPRTTI" Add(c.Cmd, ConvertBasicRuntimeChecks(BasicRuntimeChecks)); Add(c.Cmd, ConvertLanguageStandard(LanguageStandard)); // TODO Q: what if it contains space in double quotes? AddRange(c.Cmd, AdditionalOptions.Split(' ')); c.Cmd.Add(AbsoluteFilePath); return(new Capture[] { p, c }); }
public IHttpActionResult PostAdditionalOptions(AdditionalOptions additionalOptions) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.AdditionalOptions.Add(additionalOptions); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = additionalOptions.AdditionalOptionsId }, additionalOptions)); }
public override void Refresh() { MenuCommand setCommand = GetTaskMenuSetCommand(task, CovenantClient); AdditionalOptions[AdditionalOptions.IndexOf( this.AdditionalOptions.FirstOrDefault(MC => MC.Name == "Set") )] = setCommand; AdditionalOptions[AdditionalOptions.IndexOf( this.AdditionalOptions.FirstOrDefault(MC => MC.Name == "Unset") )] = new MenuCommandGenericUnset(setCommand.Parameters.FirstOrDefault(P => P.Name == "Option").Values); this.SetupMenuAutoComplete(); }
public IHttpActionResult DeleteAdditionalOptions(int id) { AdditionalOptions additionalOptions = db.AdditionalOptions.Find(id); if (additionalOptions == null) { return(NotFound()); } db.AdditionalOptions.Remove(additionalOptions); db.SaveChanges(); return(Ok(additionalOptions)); }
protected override void Execute(CodeActivityContext context) { #region Extract Workflow Argument Values // The file path of the nuget.exe - if null or empty then // assume nuget is "installed" on the build server and in the path var nuGetExeFilePath = NuGetExeFilePath.Get(context); // The path of the nuspec file var nuSpecFilePath = NuSpecFilePath.Get(context); // The folder location of the files to be packed var basePath = BasePath.Get(context); // The folder location of the files to be packed var outputDirectory = OutputDirectory.Get(context); // The destination location if deployment is to be done var versionNumber = VersionNumber.Get(context); // command line options to append (as is) to the nuget command line var additionalOptions = AdditionalOptions.Get(context); #endregion context.WriteBuildMessage(string.Format("In CallNuGetPackageCommandLine:"), BuildMessageImportance.High); context.WriteBuildMessage(string.Format("nuGetExeFilePath: {0}", nuGetExeFilePath), BuildMessageImportance.High); context.WriteBuildMessage(string.Format("basePath: {0}", basePath), BuildMessageImportance.High); context.WriteBuildMessage(string.Format("outputDirectory: {0}", outputDirectory), BuildMessageImportance.High); context.WriteBuildMessage(string.Format("versionNumber: {0}", versionNumber), BuildMessageImportance.High); context.WriteBuildMessage(string.Format("additionalOptions: {0}", additionalOptions), BuildMessageImportance.High); // Don't assume that DI will have happened. If the value is null then create the default object.);) if (NuGetProcess == null) { NuGetProcess = new NuGetProcess(); } // Call the method that will do the work var results = NuGetPackaging(nuGetExeFilePath, nuSpecFilePath, outputDirectory, basePath, versionNumber, additionalOptions, context); // Send the result back to the workflow NuGetPackagingResult.Set(context, results); }
public override bool ValidateMenuParameters(string[] parameters, bool forwardEntrance = true) { try { if (forwardEntrance) { if (parameters.Length != 1) { EliteConsole.PrintFormattedErrorLine("Must specify a Task Name."); EliteConsole.PrintFormattedErrorLine("Usage: Task <task_name>"); return(false); } GruntTask gruntTask = this.CovenantClient.ApiGrunttasksByTasknameGet(parameters[0]); if (gruntTask == null) { EliteConsole.PrintFormattedErrorLine("Specified invalid Task Name: " + parameters[0]); EliteConsole.PrintFormattedErrorLine("Usage: Task <task_name>"); return(false); } this.Task = gruntTask; this.MenuTitle = this.Task.Name; } MenuCommand setCommand = GetTaskMenuSetCommand(this.Task.Name, CovenantClient); setCommand.Parameters.FirstOrDefault(P => P.Name == "Option").Values = this.Task.Options .Select(TO => new MenuCommandParameterValue { Value = TO.Name }) .ToList(); this.AdditionalOptions[AdditionalOptions.IndexOf( this.AdditionalOptions.FirstOrDefault(MC => MC.Name == "Set") )] = setCommand; AdditionalOptions[AdditionalOptions.IndexOf( this.AdditionalOptions.FirstOrDefault(MC => MC.Name == "Unset") )] = new MenuCommandGenericUnset(setCommand.Parameters.FirstOrDefault(P => P.Name == "Option").Values); this.Refresh(); } catch (HttpOperationException e) { EliteConsole.PrintFormattedWarningLine("CovenantException: " + e.Response.Content); } return(true); }
public override void Refresh() { this.Task = this.CovenantClient.ApiGrunttasksByIdGet(this.Task.Id ?? default); this.Grunt = this.CovenantClient.ApiGruntsByIdGet(this.Grunt.Id ?? default); var setoptionparam = this.AdditionalOptions.FirstOrDefault(AO => AO.Name == "Set") .Parameters .FirstOrDefault(P => P.Name == "Option"); setoptionparam.Values = this.Task.Options.Select(TO => new MenuCommandParameterValue { Value = TO.Name }).ToList(); List <string> filePathTasks = new List <string> { "Assembly", "AssemblyReflect", "Upload", "ShellCode" }; if (filePathTasks.Contains(this.Task.Name)) { var filepaths = Utilities.GetFilesForPath(Common.EliteDataFolder); if (!setoptionparam.Values.Select(V => V.Value).Contains("LocalFilePath")) { setoptionparam.Values.Add(new MenuCommandParameterValue { Value = "LocalFilePath", NextValueSuggestions = filepaths }); } else { setoptionparam.Values.FirstOrDefault(V => V.Value == "LocalFilePath").NextValueSuggestions = filepaths; } } this.AdditionalOptions[AdditionalOptions.IndexOf( this.AdditionalOptions.FirstOrDefault(MC => MC.Name == "Unset") )] = new MenuCommandGenericUnset(setoptionparam.Values); this.SetupMenuAutoComplete(); }
public void Create(AdditionalOptions options) { this.repo.Add(options); this.repo.SaveChanges(); }
protected override StageResult Init() { if (!Success(base.Init(), out StageResult r)) { return(r); } if (JavaHome.IsEmpty()) { if (AdditionalOptions.ContainsKey("JAVA_HOME")) { JavaHome = (string)AdditionalOptions["JAVA_HOME"]; } else if ((JavaHome = Environment.GetEnvironmentVariable("JAVA_HOME")).IsEmpty()) { Error("The java-home or JAVA_HOME option was not specified and the JAVA_HOME environment variable does not exist."); return(StageResult.INVALID_OPTIONS); } } if (!Directory.Exists(JavaHome)) { Error("The Java home directory specified does not exist: {0}.", JavaHome); return(StageResult.INVALID_OPTIONS); } if (ClassPath.IsEmpty()) { if (AdditionalOptions.ContainsKey("STANFORD_CLASSIFIER_JAR")) { ClassPath = (string)AdditionalOptions["STANFORD_CLASSIFIER_JAR"]; } else if ((ClassPath = Environment.GetEnvironmentVariable("STANFORD_CLASSIFIER_JAR")).IsEmpty()) { Error("The class-path option was not specified and the STANFORD_CLASSIFIER_JAR environment variable does not exist."); return(StageResult.INVALID_OPTIONS); } } if (!File.Exists(ClassPath)) { Error("The .jar archive path specified does not exist: {0}.", ClassPath); return(StageResult.INVALID_OPTIONS); } if (BinaryLogisticClassifier && !AdditionalOptions.ContainsKey("useBinary")) { AdditionalOptions.Add("useBinary", true); } if (WithKFoldCrossValidation) { ClassifierProperties.Add("crossValidationFolds", 10); Info("Using 10-fold cross validation"); } Command version = new Command(Path.Combine(JavaHome, "bin"), "java", "-version"); Task c = version.Run(); if (!version.Started) { Error("Could not detect Java version."); return(StageResult.FAILED); } else { c.Wait(); if (c.IsCompleted && version.Success) { Info(version.ErrorText.Replace(Environment.NewLine, " ")); } if (c.IsCompleted && !version.Success) { Error("Could not detect Java version: {0}", version.OutputText); return(StageResult.FAILED); } } foreach (KeyValuePair <string, object> kv in AdditionalOptions) { if (ClassifierProperties.ContainsKey(kv.Key)) { ClassifierProperties[kv.Key] = kv.Value; } else { ClassifierProperties.Add(kv.Key, kv.Value); } Info("Using additional classifier property {0}={1}.", kv.Key, kv.Value); } if (ClassifierProperties.ContainsKey("useNB")) { ClassifierProperties.Remove("useBinary"); } return(StageResult.SUCCESS); }
public MainController(Repository repository, IOptions <AdditionalOptions> opt) { _options = opt.Value; _repository = repository; }
/// <summary> /// Initializes a new instance of the <see cref="SearchRequest"/> class. /// </summary> public SearchRequest() { NullValueHandling = NullValueHandling.Include; Options = new AdditionalOptions(); }