public static int Main(string[] args) { /*xxxargs = new[] * { * @"ServiceName=AggregatorService", * @"DisplayName=[SED] Aggregator Service", * @"TargetFramework=Net35", * @"BinaryPathName=C:\Users\Public\VSS\SED\TFS\Aggregator\AggregatorService\bin\Debug\AggregatorService.exe" * };*/ if (args == null || args.Length == 0) { DisplayUsage(); return(0); } try { Arguments.Default = ArgumentProperties.Parse(args); PerformChecks(); } catch (Exception e) { return(ErrorHandler.Runtime(e)); } return(RaiseError.ExitCode); }
public void TestReadStringHappy() { string[] args = { "a:b", "c:d", "e:f" }; ArgumentProperties properties = new ArgumentProperties(args, ":"); StringAssert.AreEqualIgnoringCase("b", properties.GetString("a", null)); }
/// <summary> /// Main program. /// </summary> public static int Main(string[] args) { /*xxxargs = new[] * { * @"ProjectName=AggregatorService", * @"RootPath=\\rufrt-vxbuild\e$\CCNET", * @"ReferencesFolderName=References", * };*/ if (args == null || args.Length == 0) { DisplayUsage(); return(0); } try { Arguments.Default = ArgumentProperties.Parse(args); PerformNotifications(); } catch (Exception e) { return(ErrorHandler.Runtime(e)); } return(0); }
public void TestReadStringDefaulted() { string[] args = { "a:b" }; ArgumentProperties properties = new ArgumentProperties(args, ":"); string value = properties.GetString( "notexisting", // wasn't added and shouldn't be found "somedefaultvalue"); // default supplied should be returned StringAssert.AreEqualIgnoringCase("somedefaultvalue", value); }
public void TestReadStringMissingRequired() { string[] args = { "a:b" }; ArgumentProperties properties = new ArgumentProperties(args, ":"); try { string value = properties.GetString( "notexisting", // wasn't added and shouldn't be found null); // no default supplied means required } catch (ArgumentException) { Assert.Pass(); } Assert.Fail("Expected ArgumentException"); }
/// <summary> /// Main program. /// </summary> public static int Main(string[] args) { /*xxx * args = new[] * { * @"ProjectName=CC.Portal.Cloud", * @"CurrentVersion=1.2.3.4", * @"WorkingDirectorySource=\\rufrt-vxbuild\d$\CCNET\CC.Portal.Cloud\WorkingDirectory\Source", * @"WorkingDirectoryRelated=\\rufrt-vxbuild\d$\CCNET\CC.Portal.Cloud\WorkingDirectory\Related", * @"ExternalReferencesPath=\\rufrt-vxbuild\ExternalReferences", * @"InternalReferencesPath=\\rufrt-vxbuild\InternalReferences", * @"PinnedReferencesPath=\\rufrt-vxbuild\PinnedReferences", * @"ProjectType=Azure", * @"UsePinned=" * };*/ if (args == null || args.Length == 0) { DisplayUsage(); return(0); } try { Arguments.Default = ArgumentProperties.Parse(args); CancelReadonly(Arguments.WorkingDirectorySource); CancelReadonly(Arguments.WorkingDirectoryRelated); UpdateAssemblyInfo(); UpdateProjectProperties(); UpdateBinaryReferences(); UpdateProjectReferences(); UpdateServiceDefinition(); } catch (Exception e) { return(ErrorHandler.Runtime(e)); } return(0); }
/// <summary> /// Main program. /// </summary> public static int Main(string[] args) { /*xxxargs = new[] * { * @"ProjectName=CC.PE.Cloud", * @"ReferencesDirectory=\\rufrt-vxbuild\d$\CCNET\CC.PE.Cloud\References", * @"WorkingDirectorySource=\\rufrt-vxbuild\d$\CCNET\CC.PE.Cloud\WorkingDirectory\Source", * @"ExternalReferencesPath=\\rufrt-vxbuild\ExternalReferences", * @"InternalReferencesPath=\\rufrt-vxbuild\InternalReferences", * @"ProjectType=Azure", * @"AssemblyName=CC.PE.Cloud", * @"FriendlyName=UNSPECIFIED", * @"DownloadZone=UNSPECIFIED", * @"VisualStudioVersion=2010", * @"TargetFramework=UNSPECIFIED", * @"TargetPlatform=AnyCPU", * @"RootNamespace=CC.PE.Cloud", * @"SuppressWarnings=", * @"AllowUnsafeBlocks=False", * @"ExpectedVersion=UNSPECIFIED" * };*/ if (args == null || args.Length == 0) { DisplayUsage(); return(0); } try { Arguments.Default = ArgumentProperties.Parse(args); PerformChecks(); } catch (Exception e) { return(ErrorHandler.Runtime(e)); } return(RaiseError.ExitCode); }
/// <summary> /// Main program. /// </summary> public static int Main(string[] args) { /*xxxargs = new[] * { * @"InternalReferencesPath=\\rufrt-vxbuild\d$\InternalReferences - Copy", * @"PublicationStoragePath=\\rufrt-vxbuild\d$\PublicationStorage - Copy", * @"DaysToLive=30", * };*/ if (args == null || args.Length == 0) { DisplayUsage(); return(0); } try { Arguments.Default = ArgumentProperties.Parse(args); var internalReferences = new CleaningFolder( Arguments.InternalReferencesPath, new InternalReferencesObsoleteDetector()); internalReferences.Clean(); var publicationStorage = new CleaningFolder( Arguments.PublicationStoragePath, new PublicationStorageObsoleteDetector()); publicationStorage.Clean(); } catch (Exception e) { return(ErrorHandler.Runtime(e)); } return(0); }
public static int Main(string[] args) { if (args == null || args.Length == 0) { DisplayUsage(); return(0); } try { Arguments.Default = ArgumentProperties.Parse(args); if (!File.Exists(Arguments.DataCoverageFile)) { return(0); } using (CoverageInfo info = CoverageInfo.CreateFromFile(Arguments.DataCoverageFile)) { CoverageDS data = info.BuildDataSet(); string outputXml = Transform(data.GetXml()); XDocument doc = XDocument.Parse(outputXml); ShortenMethodNames(doc); File.WriteAllText(Arguments.XmlCoverageFile, doc.ToString()); } } catch (Exception ex) { Console.Error.WriteLine(ex.ToString()); return(1); } return(0); }
/// <summary> /// Initializes a new instance. /// </summary> public Arguments(string[] args) { m_properties = ArgumentProperties.Parse(args); }
/// <summary> /// Gets reference field from an argument. /// </summary> private static string GetFromArgument(ArgumentProperties args, string key) { string result = null; if (args.Contains(key)) { result = args.GetValue(key); args.Remove(key); } return result; }