static void CommandLineBuildOnCheckinIOS() { const BuildTarget target = BuildTarget.iPhone; // Get build scenes. string[] levels = GetBuildScenes(); const string locationPathName = "iOSbuild"; const BuildOptions options = BuildOptions.None; // Get command line arguments (if passed in to build job). CommandLineData commandLineData = GetCommandLineData(IoSdefaultBundleId); PlayerSettings.iOS.scriptCallOptimization = ScriptCallOptimizationLevel.FastButNoExceptions; var shortBundleVersion = CommandLineReader.GetCustomArgument("ShortBundleVersion"); if (shortBundleVersion == String.Empty) { shortBundleVersion = commandLineData.BuildVersion; } PlayerSettings.shortBundleVersion = shortBundleVersion; if (commandLineData.StreamingAssetsEnabled == "true") { BuildPipelineBuildAssetBundle(BuildTarget.iPhone); DeleteMasterAssetResources(); } // Build all scenes. BuildPipelineBuildPlayer(levels, locationPathName, target, options, commandLineData); }
static void Main(string[] args) { var commandLineProcessor = new CommandLineProcessor(args); if (commandLineProcessor.HasArgs) { var commandLineReader = new CommandLineReader(commandLineProcessor); commandLineReader.ProcessCommandLine( string.Join(' ', args), commandLineProcessor.Eval); } else { var prompt = $"{Green}> "; //RunSampleCLI("(f=yellow,exec=[[System.IO.Path.GetFileName(System.Environment.CurrentDirectory)]]) > "); //var returnCode = TerminalSample.Run(new string[] { "help" ,"-v","find" }, prompt); //var returnCode = TerminalSample.Run(new string[] { "find","c:","-file","*.txt" }, prompt); //var returnCode = TerminalSample.Run(new string[] { "find","c:","-file","filename","-contains","content" }, prompt); //var returnCode = TerminalSample.Run(new string[] { "help" }, prompt); //var returnCode = TerminalSample.Run(new string[] { "find" , @"""c:\\documents and settings""" , "-attr" , "-top"}, prompt); //var returnCode = TerminalSample.Run(new string[] { "find" , "c:\\" , "-pat" , "*.sys" , "-attr" , "-top"}, prompt); //var returnCode = TerminalSample.Run("find d:\\ -attr -dir -pat *prestashop*", prompt); //var returnCode = TerminalSample.Run("module -load \"C: \Users\franc\Documents\Visual Studio 2019\Projects\Applications\dotnet-console-sdk\dotnet-console-sdk-sample\bin\Debug\netcoreapp3.1\dotnet-console-sdk.dll\"", prompt); var returnCode = TerminalSample.Run("", prompt); Environment.Exit(returnCode); } }
public static void BuildAndroid() { //mine custom arguments from commandline PlayerSettings.keyaliasPass = CommandLineReader.GetCustomArgument("keystorePass"); PlayerSettings.keystorePass = CommandLineReader.GetCustomArgument("keystorePass"); PlayerSettings.Android.keyaliasName = CommandLineReader.GetCustomArgument("keyAlias"); PlayerSettings.Android.keyaliasPass = CommandLineReader.GetCustomArgument("keystorePass"); PlayerSettings.Android.keystoreName = CommandLineReader.GetCustomArgument("keystoreName"); PlayerSettings.Android.keystorePass = CommandLineReader.GetCustomArgument("keystorePass"); string bundleVersionCode = CommandLineReader.GetCustomArgument("bundleVersionCode"); PlayerSettings.Android.bundleVersionCode = Convert.ToInt32(bundleVersionCode); PlayerSettings.bundleVersion = CommandLineReader.GetCustomArgument("bundleVersion"); PlayerSettings.bundleIdentifier = CommandLineReader.GetCustomArgument("bundleId"); Debug.Log("Build android:"); Debug.Log(" keystoreName:" + PlayerSettings.Android.keystoreName); Debug.Log(" keyaliasName:" + PlayerSettings.Android.keyaliasName); Debug.Log(" bundleVersion:" + PlayerSettings.bundleVersion); Debug.Log(" bundleVersionCode:" + PlayerSettings.Android.bundleVersionCode); Debug.Log(" bundleIdentifier:" + PlayerSettings.bundleIdentifier); string[] levels = FindEnabledEditorScenes(); string product = CommandLineReader.GetCustomArgument("product", "SWCCG") + ".apk"; string path = "Builds/Devices/Android/" + product; BuildOptions opts = BuildOptions.None; BuildPipeline.BuildPlayer(levels, path, BuildTarget.Android, opts); }
public void Can_read_various_parameters() { var commandLine = new CommandLine { { "files", "first.txt" }, { "files", "second.txt" }, { "build", "debug" }, { "canWrite" }, { "canBuild" }, }; var cmdln = new CommandLineReader <ITestParameter>(commandLine); var actualFiles = cmdln.GetItem(x => x.Files); var actualBuild = cmdln.GetItem(x => x.Build); var canWrite = cmdln.GetItem(x => x.CanWrite); var canBuild = cmdln.GetItem(x => x.CanBuild); //var async = cmdln.GetItem(x => x.Async); Assert.Equal(new[] { "first.txt", "second.txt" }, actualFiles); Assert.Equal("debug", actualBuild); Assert.Equal(true, canWrite); Assert.Equal(true, canBuild); //Assert.Equal(true, async); }
public void ShouldParseVerbWithMultipleParameters() { var args = new[] { "transfer", "user1", "user2" }; var settings = CommandLineReader.Parse <VerbWithMultipleParametersSetting>(args); Assert.Equal(new[] { "user1", "user2" }, settings.Transfer); }
public void ShouldAssignArgsToArgsProperty() { var args = new[] { "arg1", "arg2" }; var settings = CommandLineReader.Parse <ArgsSetting>(args); Assert.Equal(new[] { "arg1", "arg2" }, settings.Args); }
public void CanReadSomeIntValues() { var reader = new CommandLineReader("/a:1", "-b:2", "-c=3"); reader.Get("a", 0).Should().Be(1); reader.Get("b", 0).Should().Be(2); reader.Get("c", 0).Should().Be(3); reader.Get("d", 0).Should().Be(0); }
public void ShouldAcceptLinuxPath() { var args = new[] { "--output", "/var/test" }; var settings = CommandLineReader.Parse <LinuxPathSetting>(args); Assert.Equal("/var/test", settings.Output); }
public void ShouldParseVerbWithSingleParameter() { var args = new[] { "new", "project" }; var settings = CommandLineReader.Parse <VerbWithSingleParameterSetting>(args); Assert.Equal("project", settings.New); }
public void CanReadSomeNullableIntValues() { var reader = new CommandLineReader("/a:1", "-b:2", "--c", "3"); reader.Get<int?>("a").Should().Be(1); reader.Get<int?>("b").Should().Be(2); reader.Get<int?>("c").Should().Be(3); reader.Get<int?>("d").Should().Be(null); }
static void Main(string[] args) { ClearScreen(); var commandLineProcessor = new CommandLineProcessor(args); var commandLineReader = new CommandLineReader(commandLineProcessor); var returnCode = commandLineReader.ReadCommandLine(); Environment.Exit(returnCode); }
public void CanReadSomeNullableIntValues() { var reader = new CommandLineReader("/a:1", "-b:2", "--c", "3"); reader.Get <int?>("a").Should().Be(1); reader.Get <int?>("b").Should().Be(2); reader.Get <int?>("c").Should().Be(3); reader.Get <int?>("d").Should().Be(null); }
public void CanReadSomeIntValues() { var reader = new CommandLineReader("/a:1", "-b:2", "-c=3"); reader.Get("a", 0).Should().Be(1); reader.Get("b", 0).Should().Be(2); reader.Get("c", 0).Should().Be(3); reader.Get("d", 0).Should().Be(0); }
public void ShouldParseSingleVerbAsBoolean() { var args = new[] { "verb", "-param1", "--param2", "/param3" }; var settings = CommandLineReader.Parse <SingleVerbSetting>(args); Assert.True(settings.Verb); Assert.True(settings.Param1); Assert.True(settings.Param2); Assert.True(settings.Param3); }
// Use this for initialization void Start() { CommandLineReader.parse(System.Environment.CommandLine); if (CommandLineReader.hasOption("editor")) { SceneManager.LoadScene("ModelEditor"); } else { SceneManager.LoadScene("Game"); } }
static string GetMobileRepoPath() { string path = CommandLineReader.GetCustomArgument("mobile.repo"); if (path == "") { Debug.Log("no CLI arg for path"); path = EditorPrefs.GetString(KONG_DIR_PREF_KEY, kongMobileDir); } Debug.Log("using path " + path); return(path); }
private static CommandLineData GetCommandLineData(string defaultBundleId) { string environment = CommandLineReader.GetCustomArgument("GameServer"); string svnrevision = CommandLineReader.GetCustomArgument("SvnRevision"); string version = CommandLineReader.GetCustomArgument("Version"); // Opportunity to override the default bundle ID. string overrideBundleId = CommandLineReader.GetCustomArgument("BundleID"); string streamingAssetsEnabled = CommandLineReader.GetCustomArgument("StreamingAssetsEnabled"); string bundleId = (0 == overrideBundleId.Length) ? defaultBundleId : overrideBundleId; return(new CommandLineData(environment, svnrevision, version, bundleId, streamingAssetsEnabled)); }
static void ExportAndroidProject() { string output = "BuildAndroid/"; string keyaliasPass = CommandLineReader.GetCustomArgument("keyaliasPass"); string keystorePass = CommandLineReader.GetCustomArgument("keystorePass"); if (Directory.Exists("BuildAndroid/" + BuildName + "/assets/bin") == true) { Directory.Delete("BuildAndroid/" + BuildName + "/assets/bin", true); } GenericBuild(PackageScenes, output, BuildTarget.Android, BuildOptions.AcceptExternalModificationsToPlayer); }
public DDoSStopCommand(Agent agent, CommandLineReader repl) : base("ddos-stop", "Stops an ongoing DDOS attack.") { _agent = agent; _repl = repl; Options = new OptionSet() { "usage: ddos-stop sessionid", "", "Stops an ongoing DDOS attack identified by its sessionid", "eg: ddos-stop 2343256490123552", { "help|h|?","Show this message and exit.", v => ShowHelp = v != null }, }; _repl.AddAutocompletionWords("ddos-stop"); }
static void PerformMacOSXBuild() { string buildPath = CommandLineReader.GetCustomArgument("path"); bool appendBuild = CommandLineReader.GetCustomArgument("append") == "true"; if (appendBuild) { GenericBuild(SCENES, buildPath, BuildTarget.iOS, BuildOptions.AcceptExternalModificationsToPlayer); } else { GenericBuild(SCENES, buildPath, BuildTarget.iOS, BuildOptions.None); } }
public ExecuteCommand(Agent agent, CommandLineReader repl) : base("execute", "Execute a shell command in all the peers") { _repl = repl; Options = new OptionSet() { "usage: execute command", "", "Execute a shell command in all the peers. It doesn't return the output.", "eg: execute copy ~my.tmp c:\\Program Files (x86)\\Notepad++\\unistall.exe", { "help|h|?", "Show this message and exit.", v => ShowHelp = v != null }, }; _repl.AddAutocompletionWords("execute"); }
public BackdoorCommand(Agent agent, CommandLineReader repl) : base("backdoor", "Opens a session with a remote agent to execute commands.") { _agent = agent; _repl = repl; Options = new OptionSet() { "usage: backdoor <identifier>", "", "Opens a session with a remote agent to execute shell commands.", "eg: backdoor 028d9a9a9b76a755f6262409d86c7e05", { "help|h|?", "Show this message and exit.", v => ShowHelp = v != null }, }; _repl.AddAutocompletionWords("backdoor"); }
public AddNodeCommand(Agent agent, CommandLineReader repl) : base("add-node", "Add node and connect to it.") { _agent = agent; _repl = repl; Options = new OptionSet() { "usage: add-node endpoint", "", "Tries to connect to a bot in the specified endpoint (ipaddress:port).", "eg: add-node 78.13.81.9:8080", { "help|h|?", "Show this message and exit.", v => ShowHelp = v != null }, }; _repl.AddAutocompletionWords("add-node", "127.0.0.1"); }
public DebugCommand(Agent agent, CommandLineReader repl) : base("debug", "Allows to perform diagnostic tasks") { _agent = agent; _repl = repl; Options = new OptionSet() { "usage: debug command", "", "Execute diagnostic commands.", "eg: debug get-peer-list", { "help|h|?", "Show this message and exit.", v => ShowHelp = v != null } }; _repl.AddAutocompletionWords("debug", "get-peer-list", "clear-peer-list"); }
static void Main(string[] args) { Out.Echo(ANSI.RIS); Out.ClearScreen(); var commandLineProcessor = new CommandLineProcessor( args, new OrbitalShellCommandLineProcessorSettings()); var commandLineReader = new CommandLineReader( commandLineProcessor); commandLineProcessor.Initialize(); var returnCode = commandLineReader.ReadCommandLine(); Environment.Exit(returnCode); }
public static void BuildIOS() { //mine custom arguments from commandline PlayerSettings.bundleVersion = CommandLineReader.GetCustomArgument("bundleVersion", "1.0.0"); PlayerSettings.bundleIdentifier = CommandLineReader.GetCustomArgument("bundleId"); PlayerSettings.iPhoneBundleIdentifier = CommandLineReader.GetCustomArgument("bundleId"); Debug.Log("Build iOS:"); Debug.Log(" bundleVersion:" + PlayerSettings.bundleVersion + " bundleId:" + PlayerSettings.iPhoneBundleIdentifier); string[] levels = FindEnabledEditorScenes(); string path = "Builds/Devices/IOS"; BuildOptions opts = BuildOptions.SymlinkLibraries; BuildPipeline.BuildPlayer(levels, path, BuildTarget.iPhone, opts); }
static void Init() { exportDir = CommandLineReader.GetCustomArgument("exportDir"); UnityEditor.PlayerSettings.applicationIdentifier = CommandLineReader.GetCustomArgument("applicationIdentifier"); UnityEditor.PlayerSettings.companyName = CommandLineReader.GetCustomArgument("companyName"); UnityEditor.PlayerSettings.productName = CommandLineReader.GetCustomArgument("productName"); UnityEditor.PlayerSettings.bundleVersion = CommandLineReader.GetCustomArgument("bundleVersion"); UnityEditor.PlayerSettings.iOS.buildNumber = CommandLineReader.GetCustomArgument("iOS.buildNumber"); UnityEditor.PlayerSettings.Android.bundleVersionCode = int.Parse(CommandLineReader.GetCustomArgument("Android.bundleVersionCode")); UnityEditor.PlayerSettings.Android.keystorePass = CommandLineReader.GetCustomArgument("Android.keystorePass"); UnityEditor.PlayerSettings.Android.keyaliasName = CommandLineReader.GetCustomArgument("Android.keyaliasName"); UnityEditor.PlayerSettings.Android.keyaliasPass = CommandLineReader.GetCustomArgument("Android.keyaliasPass"); UnityEditor.PlayerSettings.Android.useAPKExpansionFiles = bool.Parse(CommandLineReader.GetCustomArgument("Android.useAPKExpansionFiles")); UnityEditor.PlayerSettings.SetScriptingDefineSymbolsForGroup(UnityEditor.BuildTargetGroup.iOS, CommandLineReader.GetCustomArgument("iOS.ScriptingDefineSymbols")); UnityEditor.PlayerSettings.SetScriptingDefineSymbolsForGroup(UnityEditor.BuildTargetGroup.Android, CommandLineReader.GetCustomArgument("Android.ScriptingDefineSymbols")); }
public DDoSStartCommand(Agent agent, CommandLineReader repl) : base("ddos-start", "Perform DDOS attack against specified target.") { _agent = agent; _repl = repl; Options = new OptionSet() { "usage: ddos-start --type:attack-type --target:ipaddress:port", "", "Performs a DDoS attack against the specified target ip:port endpoint.", "eg: ddos --type:httpflood --target:212.54.13.87:80", { "type=", "{type} of attack [httpflood | udpflood | tcpsynflood].", x => Type = x }, { "target=", "{target} to attack (ipaddress:port endpoint)", x => Target = x }, { "help|h|?", "Show this message and exit.", v => ShowHelp = v != null }, }; _repl.AddAutocompletionWords("ddos-start", "--type", "--target", "synflood", "udpflood", "httpflood"); }
public IHostBuilder InitializeServices(IHostBuilder hostBuilder) { hostBuilder.ConfigureServices( (_, services) => services .AddScoped <IShellArgsOptionBuilder, ShellArgsOptionBuilder>() .AddScoped <IShellBootstrap, ShellBootstrap>() .AddScoped <ICommandLineProcessor, CommandLineProcessor>() .AddScoped <IServiceProviderScope, ServiceProviderScope>( serviceProvider => new ServiceProviderScope(ScopedServiceProvider) ) .AddScoped <ICommandsAlias, CommandsAlias>() .AddScoped <IModuleSet, ModuleSet>() .AddScoped <ICommandBatchProcessor, CommandBatchProcessor>() .AddScoped <ISyntaxAnalyser, SyntaxAnalyser>() .AddScoped <IModuleManager, ModuleManager>() .AddScoped <IModuleCommandManager, ModuleCommandManager>() .AddScoped <IHookManager, HookManager>() .AddScoped <IExternalParserExtension, CommandLineProcessorExternalParserExtension>() .AddScoped <ICommandLineReader, CommandLineReader>( serviceProvider => { var clr = new CommandLineReader(); clr.Initialize( null, serviceProvider.GetRequiredService <ICommandLineProcessor>()); return(clr); }) .AddScoped <IShellServiceHost, ShellServiceHost>() ); return(hostBuilder); }
private static void CommandLineBuildOnCheckinAndroid() { const BuildTarget target = BuildTarget.Android; // Get build scenes. string[] levels = GetBuildScenes(); string locationPathName = CommandLineReader.GetCustomArgument("APKPath"); const BuildOptions options = BuildOptions.None; // Android specific command line arguments parsed first. string versionCode = CommandLineReader.GetCustomArgument("VersionCode"); int verCode; if (Int32.TryParse(versionCode, out verCode)) { PlayerSettings.Android.bundleVersionCode = verCode; } // Get command line arguments (if passed in to build job). CommandLineData commandLineData = GetCommandLineData(AndroidDefaultBundleId); string homeDirectory = CommandLineReader.GetCustomArgument("HomeDirectory"); if (!homeDirectory.EndsWith("Assets")) { homeDirectory += "\\Assets"; } //ensure deployment script is up to date with correct version code and bundle info. string apkName = Path.GetFileNameWithoutExtension(locationPathName); //WriteVersionCodeAndAPKNameToScript(commandLineData.Environment, verCode, apkName, homeDirectory); if (commandLineData.StreamingAssetsEnabled == "true") { BuildPipelineBuildAssetBundle(BuildTarget.Android); DeleteMasterAssetResources(); } // Build all scenes. BuildPipelineBuildPlayer(levels, locationPathName, target, options, commandLineData); }
private static bool Prepare(string[] args, out DyaOptions options) { try { var config = ConfigReader.Read(Path.Combine(FS.GetStartupPath(), "config.json")); options = CommandLineReader.Read <DyaOptions>(args, config); } catch (DyaException ex) { Printer.Header(); Printer.LineFeed(); Printer.Error(ex.Message); options = null; return(false); } Printer.NoLogo = options.NoLogo; return(true); }
static void SetVersion() { string version = CommandLineReader.GetCustomArgument("mobile.sdk.version"); if (version != "") { PlayerSettings.bundleVersion = version; } string tag = CommandLineReader.GetCustomArgument("mobile.sdk.tag"); if (tag != "") { PlayerSettings.productName = "AngryBots-" + tag; } else { PlayerSettings.productName = "AngryBots"; } }
public void CanReadSomeDateTimeValues() { var reader = new CommandLineReader("/a:11/11/2000"); reader.Get("a", DateTime.Now).Should().Be(new DateTime(2000, 11, 11)); }
public void CanReadInvalidFormatValues() { var reader = new CommandLineReader("/a:asdasd"); reader.Get("a", new DateTime(2000, 11, 11)).Should().Be(new DateTime(2000, 11, 11)); }
public void CanReadEnumValues() { var reader = new CommandLineReader("/a:machine"); reader.Get<EnvironmentVariableTarget>("a").Should().Be(EnvironmentVariableTarget.Machine); }