public void UpperSymbolTwoConsecutiveYears() { CopyrightInfo copyright = new CopyrightInfo(true, "X & Y Group", 2006, 2007); Assert.AreEqual("Copyright (C) 2006, 2007 X & Y Group", copyright.ToString()); }
public void LowerSymbolOneYear() { CopyrightInfo copyright = new CopyrightInfo(false, "Authors, Inc.", 2007); Assert.AreEqual("Copyright (c) 2007 Authors, Inc.", copyright.ToString()); }
public void Should_not_grow_when_converted_to_string() { var info = new CopyrightInfo ("ManOnTheMoon, Inc.", 2019); for (int i=0; i<10; i++) { info.ToString().Length.Should().Be(37); } }
public void Should_not_grow_when_converted_to_string() { var info = new CopyrightInfo("ManOnTheMoon, Inc.", 2019); for (int i = 0; i < 10; i++) { info.ToString().Length.Should().Be(37); } }
public void ShouldNotGrowWhenConvertedToString() { var info = new CopyrightInfo ("ManOnTheMoon, Inc.", 2019); for (int i=0; i<10; i++) { info.ToString().Length.Should().Equal(37); } }
public static async Task <int> Main(string[] args) { // take care of static fields informationalVersionAttribute = Attribute.GetCustomAttribute( Assembly.GetEntryAssembly(), typeof(AssemblyInformationalVersionAttribute)) as AssemblyInformationalVersionAttribute; headerInfo = $"nanoFramework Firmware Flasher v{informationalVersionAttribute.InformationalVersion}"; copyrightInfo = new CopyrightInfo(true, $"nanoFramework project contributors", 2019); // need this to be able to use ProcessStart at the location where the .NET Core CLI tool is running from string codeBase = Assembly.GetExecutingAssembly().CodeBase; UriBuilder uri = new UriBuilder(codeBase); var fullPath = Uri.UnescapeDataString(uri.Path); ExecutingPath = Path.GetDirectoryName(fullPath); // check for empty argument collection if (!args.Any()) { // no argument provided, show help text and usage examples // because of short-comings in CommandLine parsing // need to customize the output to provide a consistent output var parser = new Parser(config => config.HelpWriter = null); var result = parser.ParseArguments <Options>(new string[] { "", "" }); var helpText = new HelpText( new HeadingInfo(headerInfo), copyrightInfo) .AddPreOptionsLine("No command was provided.") .AddPreOptionsLine("") .AddPreOptionsLine(HelpText.RenderUsageText(result)) .AddPreOptionsLine("") .AddOptions(result); Console.WriteLine(helpText.ToString()); return((int)ExitCodes.OK); } var parsedArguments = Parser.Default.ParseArguments <Options>(args); await parsedArguments .WithParsedAsync(opts => RunOptionsAndReturnExitCodeAsync(opts)) .WithNotParsedAsync(errors => HandleErrorsAsync(errors)); if (verbosityLevel > VerbosityLevel.Quiet) { OutputError(_exitCode, verbosityLevel > VerbosityLevel.Normal, _extraMessage); } return((int)_exitCode); }
public string GetUsage() { var help = new HelpText(new HeadingInfo(typeof(CompilerOptions).Namespace !)) { AdditionalNewLineAfterOption = true, Copyright = new CopyrightInfo("The Noda Time Authors", 2009) }; help.AddPreOptionsLine("Usage: NodaTime.TzdbCompiler -s <tzdb directory> -w <windowsZone.xml file/dir> -o <output file> [-t ResX/Resource/NodaZoneData]"); help.AddOptions(this); return(help); } }
private void Form1_Load(object sender, EventArgs e) { CheckIfErrorOccured(); TestButton.Dispose(); CopyrightInfo.Dispose(); Saving.CopyCSS(); try { using (FileStream fs = new FileStream(@"ConfigurationFiles\OwnMAttack.txt", FileMode.Open)) { lock (fs) { using (StreamReader sr = new StreamReader(fs, Encoding.Unicode)) { string s = ""; s = sr.ReadToEnd(); OwnMAttack.Text = s; } } } } catch { using (FileStream fs = new FileStream(@"ConfigurationFiles\OwnMAttack.txt", FileMode.Create)) { lock (fs) { using (StreamWriter sw = new StreamWriter(fs, Encoding.Unicode)) { string toSave = OwnMAttack.Text = Microsoft.VisualBasic.Interaction.InputBox("What's your magic attack?\n (Without buffs and weapon)", "Need informations from user to proceed..."); sw.WriteLine(toSave); while (OwnMAttack.Text.Length == 0) { sw.WriteLine(OwnMAttack.Text = Microsoft.VisualBasic.Interaction.InputBox("What's your magic attack?\n(Without buffs and weapon)", "This field cannot be empty!")); } } } } RefreshCalculations(); } }
static void Main(string[] args) { var ass = Assembly.GetExecutingAssembly(); var fvi = FileVersionInfo.GetVersionInfo(ass.Location); var Heading = new HeadingInfo(fvi.FileDescription, ass.GetName().Version.ToString()); var Copyright = new CopyrightInfo(fvi.CompanyName, DateTime.Today.Year); Parser.Default.ParseArguments <Options>(args).WithParsed(o => { Console.WriteLine(Heading.ToString()); Console.WriteLine(Copyright.ToString()); Console.WriteLine(); if (!string.IsNullOrEmpty(o.Excludelist) && File.Exists(o.Excludelist)) { partitions = new List <string>(File.ReadAllLines(o.Excludelist)).ToArray(); } ulong eMMCDumpSize; ulong SectorSize = 0x200; if (o.ImgFile.ToLower().Contains(@"\\.\physicaldrive")) { Logging.Log("Tool is running in Device Dump mode."); Logging.Log("Gathering disk geometry..."); eMMCDumpSize = (ulong)GetDiskSize.GetDiskLength(@"\\.\PhysicalDrive" + o.ImgFile.ToLower().Replace(@"\\.\physicaldrive", "")); SectorSize = (ulong)GetDiskSize.GetDiskSectorSize(@"\\.\PhysicalDrive" + o.ImgFile.ToLower().Replace(@"\\.\physicaldrive", "")); } else { Logging.Log("Tool is running in Image Dump mode."); Logging.Log("Gathering disk image geometry..."); eMMCDumpSize = (ulong)new FileInfo(o.ImgFile).Length; } Logging.Log("Reported source device eMMC size is: " + eMMCDumpSize + " bytes - " + eMMCDumpSize / 1024 / 1024 + "MB - " + eMMCDumpSize / 1024 / 1024 / 1024 + "GB."); Logging.Log("Selected " + SectorSize + "B for the sector size"); ConvertDD2VHD(o.ImgFile, o.VhdFile, partitions, o.Recovery, (int)SectorSize); }); }
private static HelpText GetHelpText(ParserResult <object> parserResult) { var headingInfo = new HeadingInfo("OctopusPuppet.cmd", FileVersion); var copyRightInfo = new CopyrightInfo(true, CompanyName, GetCopyrightStartYear, GetCopyrightEndYear); var helpText = new HelpText(headingInfo, copyRightInfo) { AddEnumValuesToHelpText = true } .AddOptions(parserResult) .AddVerbs(typeof(BranchDeploymentOptions), typeof(MirrorEnvironmentOptions), typeof(RedploymentOptions), typeof(DeployOptions)) .AddPostOptionsLine("EXAMPLE USAGE: ") .AddPostOptionsLine(" OctopusPuppet.Cmd BranchDeployment") .AddPostOptionsLine(" --OctopusUrl \"http://octopus.test.com/\"") .AddPostOptionsLine(" --OctopusApiKey \"API-HAAAS4MM6YBBSAIQVVHCQQUEA0\"") .AddPostOptionsLine(" --TargetEnvironment \"Development\"") .AddPostOptionsLine(" --Branch \"Master\"") .AddPostOptionsLine(" [--ComponentFilterPath \"componentFilter.json\"]") .AddPostOptionsLine(" [--ComponentFilter \"Component filter json base64 encoded\"]") .AddPostOptionsLine(" [--Deploy]") .AddPostOptionsLine(" [--DoNotUseDifferentialDeployment]") .AddPostOptionsLine(" [--UpdateVariables]") .AddPostOptionsLine(" [--EnvironmentDeploymentPath \"environmentDeployment.json\"]") .AddPostOptionsLine(" [--MaximumParallelDeployments 4]") .AddPostOptionsLine(" [--HideDeploymentProgress]") .AddPostOptionsLine("") .AddPostOptionsLine(" OctopusPuppet.Cmd MirrorEnvironment") .AddPostOptionsLine(" --OctopusUrl \"http://octopus.test.com/\"") .AddPostOptionsLine(" --OctopusApiKey \"API-HAAAS4MM6YBBSAIQVVHCQQUEA0\"") .AddPostOptionsLine(" --SourceEnvironment \"Development\"") .AddPostOptionsLine(" --TargetEnvironment \"Test\"") .AddPostOptionsLine(" [--ComponentFilterPath \"componentFilter.json\"]") .AddPostOptionsLine(" [--ComponentFilter \"Component filter json base64 encoded\"]") .AddPostOptionsLine(" [--Deploy]") .AddPostOptionsLine(" [--DoNotUseDifferentialDeployment]") .AddPostOptionsLine(" [--UpdateVariables]") .AddPostOptionsLine(" [--EnvironmentDeploymentPath \"environmentDeployment.json\"]") .AddPostOptionsLine(" [--MaximumParallelDeployments 4]") .AddPostOptionsLine(" [--HideDeploymentProgress]") .AddPostOptionsLine("") .AddPostOptionsLine(" OctopusPuppet.Cmd Redeployment") .AddPostOptionsLine(" --OctopusUrl \"http://octopus.test.com/\"") .AddPostOptionsLine(" --OctopusApiKey \"API-HAAAS4MM6YBBSAIQVVHCQQUEA0\"") .AddPostOptionsLine(" --TargetEnvironment \"Development\"") .AddPostOptionsLine(" [--ComponentFilterPath \"componentFilter.json\"]") .AddPostOptionsLine(" [--ComponentFilter \"Component filter json base64 encoded\"]") .AddPostOptionsLine(" [--Deploy]") .AddPostOptionsLine(" [--UpdateVariables]") .AddPostOptionsLine(" [--EnvironmentDeploymentPath \"environmentDeployment.json\"]") .AddPostOptionsLine(" [--MaximumParallelDeployments 4]") .AddPostOptionsLine(" [--HideDeploymentProgress]") .AddPostOptionsLine("") .AddPostOptionsLine(" OctopusPuppet.Cmd Deploy") .AddPostOptionsLine(" --OctopusUrl \"http://octopus.test.com/\"") .AddPostOptionsLine(" --OctopusApiKey \"API-HAAAS4MM6YBBSAIQVVHCQQUEA0\"") .AddPostOptionsLine(" --EnvironmentDeploymentPath \"environmentDeployment.json\"") .AddPostOptionsLine(" --TargetEnvironment \"Development\"") .AddPostOptionsLine(" [--MaximumParallelDeployments 4]") .AddPostOptionsLine(" [--HideDeploymentProgress]") .AddPostOptionsLine(""); HelpText.DefaultParsingErrorsHandler(parserResult, helpText); return(helpText); }
public void DefaultSymbolTwoNonConsecutiveYears() { var copyright = new CopyrightInfo("W & Z, Inc.", 2005, 2007); Assert.AreEqual("Copyright (C) 2005 - 2007 W & Z, Inc.", copyright.ToString()); }
public void DefaultSymbolSeveralYears() { var copyright = new CopyrightInfo("CommandLine, Ltd", 1999, 2003, 2004, 2007); Assert.AreEqual("Copyright (C) 1999 - 2003, 2004 - 2007 CommandLine, Ltd", copyright.ToString()); }
public void UpperSymbolTwoConsecutiveYears() { var copyright = new CopyrightInfo(true, "X & Y Group", 2006, 2007); copyright.ToString().Should().Equal("Copyright (C) 2006, 2007 X & Y Group"); }
public void UpperSymbolTwoConsecutiveYears() { var copyright = new CopyrightInfo(true, "X & Y Group", 2006, 2007); Assert.AreEqual("Copyright (C) 2006, 2007 X & Y Group", copyright.ToString()); }
public void Upper_symbol_two_consecutive_years() { var copyright = new CopyrightInfo(true, "X & Y Group", 2006, 2007); copyright.ToString().Should().Be("Copyright (C) 2006, 2007 X & Y Group"); }
public void Default_symbol_several_years() { var copyright = new CopyrightInfo("CommandLine, Ltd", 1999, 2003, 2004, 2007); copyright.ToString().Should().Be("Copyright (C) 1999 - 2003, 2004 - 2007 CommandLine, Ltd"); }
public void Lower_symbol_one_year() { var copyright = new CopyrightInfo(false, "Authors, Inc.", 2007); copyright.ToString().Should().Be("Copyright (c) 2007 Authors, Inc."); }
public void Default_symbol_two_non_consecutive_years() { var copyright = new CopyrightInfo("W & Z, Inc.", 2005, 2007); copyright.ToString().Should().Be("Copyright (C) 2005 - 2007 W & Z, Inc."); }
public void DefaultSymbolTwoNonConsecutiveYears() { var copyright = new CopyrightInfo("W & Z, Inc.", 2005, 2007); copyright.ToString().Should().Equal("Copyright (C) 2005 - 2007 W & Z, Inc."); }
public void LowerSymbolOneYear() { var copyright = new CopyrightInfo(false, "Authors, Inc.", 2007); Assert.AreEqual("Copyright (c) 2007 Authors, Inc.", copyright.ToString()); }
public void LowerSymbolOneYear() { var copyright = new CopyrightInfo(false, "Authors, Inc.", 2007); copyright.ToString().Should().Equal("Copyright (c) 2007 Authors, Inc."); }