コード例 #1
0
        public void TestParse()
        {
            var arguments = new Dictionary <string, string>()
            {
                { "someKey", "someValue" },
                { "secondKey", "secondValue" }
            };

            var formattedArguments = new List <string>();

            foreach (var kvp in arguments)
            {
                formattedArguments.Add(string.Format("--{0}", kvp.Key));
                formattedArguments.Add(kvp.Value);
            }

            var launchArguments = LaunchArguments.Parse(formattedArguments.ToArray());

            Assert.IsFalse(launchArguments.ContainsKey("nonexisting"));

            foreach (var kvp in arguments)
            {
                Assert.IsTrue(launchArguments.ContainsKey(kvp.Key));
                Assert.AreEqual(kvp.Value, launchArguments[kvp.Key]);
            }

            AssertFailParse("Invalid launch argument count", new string[] { "asd" });
            AssertFailParse("Invalid argument format", new string[] { "asd", "asd" });
            AssertFailParse("Invalid argument key length", new string[] { "--", "wef" });
            AssertFailParse("Invalid argument key", new string[] { "---", "wefkwop" });
        }
コード例 #2
0
        public static void ReadLauncherSettings(LaunchArguments launchArguments)
        {
            try
            {
                _instance = new Settings
                {
                    ApiHost             = launchArguments.api != null ? launchArguments.api.baseUrl : _instance.ApiHost,
                    WebHost             = launchArguments.web != null ? launchArguments.web.baseUrl : _instance.WebHost,
                    RabbitMqHost        = launchArguments.rabbitmq != null?launchArguments.rabbitmq.host.Split(':')[0] : _instance.RabbitMqHost,
                    RabbitMqPort        = launchArguments.rabbitmq != null?launchArguments.rabbitmq.host.Split(':')[1] : _instance.RabbitMqPort,
                    RabbitMqUserName    = launchArguments.rabbitmq != null ? launchArguments.rabbitmq.login : _instance.RabbitMqUserName,
                    RabbitMqPass        = launchArguments.rabbitmq != null ? launchArguments.rabbitmq.password : _instance.RabbitMqPass,
                    Language            = launchArguments.lang ?? _instance.Language ?? LanguageManager.DefaultLanguage,
                    Multiplayer         = false,
                    HighlightEnabled    = true,
                    TouchHapticsEnabled = false,
                    GrabHapticsEnabled  = false,
                    UseHapticsEnabled   = false,
                    OnboardingMode      = launchArguments.onboarding
                };

                LanguageManager.Instance.ChangeLanguage(launchArguments.lang);
            }
            catch (Exception e)
            {
                LauncherErrorManager.Instance.ShowFatal(
                    ErrorHelper.GetErrorDescByCode(Varwin.Errors.ErrorCode.ReadStartupArgsError), e.StackTrace);
            }
        }
コード例 #3
0
ファイル: BlankLoadScreen.cs プロジェクト: huwpascoe/OpenRA
        public void StartGame(Arguments args)
        {
            Launch = new LaunchArguments(args);
            Ui.ResetAll();
            Game.Settings.Save();

            if (Launch.Benchmark)
            {
                Log.AddChannel("cpu", "cpu.csv");
                Log.Write("cpu", "tick;time [ms]");

                Log.AddChannel("render", "render.csv");
                Log.Write("render", "frame;time [ms]");

                Console.WriteLine("Saving benchmark data into {0}".F(Path.Combine(Platform.SupportDir, "Logs")));

                Game.BenchmarkMode = true;
            }

            // Join a server directly
            var connect = Launch.GetConnectAddress();

            if (!string.IsNullOrEmpty(connect))
            {
                var parts = connect.Split(':');

                if (parts.Length == 2)
                {
                    var host = parts[0];
                    var port = Exts.ParseIntegerInvariant(parts[1]);
                    Game.LoadShellMap();
                    Game.RemoteDirectConnect(host, port);
                    return;
                }
            }

            // Load a replay directly
            if (!string.IsNullOrEmpty(Launch.Replay))
            {
                var replayMeta = ReplayMetadata.Read(Launch.Replay);
                if (ReplayUtils.PromptConfirmReplayCompatibility(replayMeta, Game.LoadShellMap))
                {
                    Game.JoinReplay(Launch.Replay);
                }

                if (replayMeta != null)
                {
                    var mod = replayMeta.GameInfo.Mod;
                    if (mod != null && mod != Game.ModData.Manifest.Mod.Id && ModMetadata.AllMods.ContainsKey(mod))
                    {
                        Game.InitializeMod(mod, args);
                    }
                }

                return;
            }

            Game.LoadShellMap();
            Game.Settings.Save();
        }
コード例 #4
0
        protected override LaunchResponse HandleLaunchRequest(LaunchArguments arguments)
        {
            // since CreateDebugSession is an async method, we should be using HandleLaunchRequestAsync.
            // However, using HandleLaunchRequestAsync causes VSCode to send setBreakpoints and
            // threads request before receiving the launch response.

            try
            {
                if (session != null)
                {
                    throw new InvalidOperationException();
                }

                session = LaunchConfigurationParser.CreateDebugSession(arguments, Protocol.SendEvent, defaultDebugView)
                          .GetAwaiter().GetResult();
                session.Start();

                return(new LaunchResponse());
            }
            catch (Exception ex)
            {
                Log(ex.Message, LogCategory.DebugAdapterOutput);
                throw new ProtocolException(ex.Message, ex);
            }
        }
コード例 #5
0
        public virtual void StartGame(Arguments args)
        {
            Launch = new LaunchArguments(args);
            Ui.ResetAll();
            Game.Settings.Save();

            if (!string.IsNullOrEmpty(Launch.Benchmark))
            {
                Console.WriteLine("Saving benchmark data into {0}".F(Path.Combine(Platform.SupportDir, "Logs")));

                Game.BenchmarkMode(Launch.Benchmark);
            }

            // Join a server directly
            var connect = Launch.GetConnectEndPoint();

            if (connect != null)
            {
                Game.LoadShellMap();
                Game.RemoteDirectConnect(connect);
                return;
            }

            // Start a map directly
            if (!string.IsNullOrEmpty(Launch.Map))
            {
                Game.LoadMap(Launch.Map);
                return;
            }

            // Load a replay directly
            if (!string.IsNullOrEmpty(Launch.Replay))
            {
                ReplayMetadata replayMeta = null;
                try
                {
                    replayMeta = ReplayMetadata.Read(Launch.Replay);
                }
                catch { }

                if (ReplayUtils.PromptConfirmReplayCompatibility(replayMeta, Game.LoadShellMap))
                {
                    Game.JoinReplay(Launch.Replay);
                }

                if (replayMeta != null)
                {
                    var mod = replayMeta.GameInfo.Mod;
                    if (mod != null && mod != Game.ModData.Manifest.Id && Game.Mods.ContainsKey(mod))
                    {
                        Game.InitializeMod(mod, args);
                    }
                }

                return;
            }

            Game.LoadShellMap();
            Game.Settings.Save();
        }
コード例 #6
0
        private void InitializeClient()
        {
            var arguments   = LaunchArguments.GetArguments();
            var environment = CommandLineUtility.GetCommandLineValue(arguments, RuntimeConfigNames.Environment, string.Empty);

            if (string.IsNullOrEmpty(environment))
            {
                environment = PlayerPrefs.GetString(RuntimeConfigNames.Environment, string.Empty);
            }
            else
            {
                PlayerPrefs.SetString(RuntimeConfigNames.Environment, environment);
            }

            if (!string.IsNullOrEmpty(environment))
            {
                ShouldConnectLocally = environment == RuntimeConfigDefaults.LocalEnvironment;
            }

            if (ShouldConnectLocally)
            {
                IpAddress = GetHostIp();
                PlayerPrefs.SetString(HostIpPlayerPrefsKey, IpAddress);
            }
            else
            {
                PlayerPrefs.DeleteKey(HostIpPlayerPrefsKey);
            }

            PlayerPrefs.Save();
        }
コード例 #7
0
        /// <summary>
        /// Extracts the Ip address that should be used to connect via the receptionist. The order is as follows:
        /// 1. Try to extract the ip address from command line arguments passed in. This currently only works for Android.
        /// 2. If we are running on an Android Emulator: Use the Ip address necessary to connect locally.
        /// 3. If we are on a physical device (Android & iOS): Try to extract the value from the stored player preferences.
        /// 4. Check if we stored anything inside the IpAddress field and use it, if we have.
        /// 5. Return the default ReceptionistHost (localhost).
        /// </summary>
        /// <returns></returns>
        private string GetHostIp()
        {
            var arguments = LaunchArguments.GetArguments();
            var hostIp    =
                CommandLineUtility.GetCommandLineValue(arguments, RuntimeConfigNames.ReceptionistHost, string.Empty);

            if (!string.IsNullOrEmpty(hostIp))
            {
                return(hostIp);
            }

            if (Application.isMobilePlatform)
            {
                switch (DeviceInfo.ActiveDeviceType)
                {
                case MobileDeviceType.Virtual:
#if UNITY_ANDROID
                    return(DeviceInfo.AndroidEmulatorDefaultCallbackIp);
#else
                    break;
#endif
                case MobileDeviceType.Physical:
                    return(PlayerPrefs.GetString(HostIpPlayerPrefsKey, IpAddress));
                }
            }

            if (!string.IsNullOrEmpty(IpAddress))
            {
                return(IpAddress);
            }

            return(RuntimeConfigDefaults.ReceptionistHost);
        }
コード例 #8
0
        public static async Task <IDebugSession> CreateDebugSessionAsync(LaunchArguments launchArguments, Action <DebugEvent> sendEvent, DebugView defaultDebugView)
        {
            var sourceFileMap = ImmutableDictionary <string, string> .Empty;

            if (launchArguments.ConfigurationProperties.TryGetValue("sourceFileMap", out var jsonSourceFileMap) && jsonSourceFileMap.Type == JTokenType.Object)
            {
                sourceFileMap = ((IEnumerable <KeyValuePair <string, JToken?> >)jsonSourceFileMap).ToImmutableDictionary(
                    kvp => kvp.Key,
                    kvp => kvp.Value?.Value <string>() ?? string.Empty);
            }

            var returnTypes = ImmutableList <CastOperation> .Empty;

            if (launchArguments.ConfigurationProperties.TryGetValue("return-types", out var jsonReturnTypes))
            {
                var builder = ImmutableList.CreateBuilder <CastOperation>();
                foreach (var returnType in jsonReturnTypes)
                {
                    builder.Add(DebugSession.CastOperations[returnType.Value <string>() ?? ""]);
                }
                returnTypes = builder.ToImmutable();
            }

            var debugInfoList = await LoadDebugInfosAsync(launchArguments.ConfigurationProperties, sourceFileMap).ToListAsync().ConfigureAwait(false);

            var engine = await CreateEngineAsync(launchArguments.ConfigurationProperties).ConfigureAwait(false);

            return(new DebugSession(engine, debugInfoList, returnTypes, sendEvent, defaultDebugView));
        }
コード例 #9
0
        protected override LaunchResponse HandleLaunchRequest(LaunchArguments arguments)
        {
            var romPath  = (string)arguments.ConfigurationProperties["rom"];
            var sramPath = (string)arguments.ConfigurationProperties["sram"];
            var mapPath  = (string)arguments.ConfigurationProperties["map"];

            Host.LoadGame(romPath);
            var sram = new Sram(Host, sramPath);

            sram.Load();
            DebugMap      = new DebugMap(mapPath);
            HostWindowCTS = new CancellationTokenSource();

            HostTask = Task.Run(
                () =>
            {
                using (var w = new MegaDriveWindow())
                {
                    w.Run(sram, Host, HostWindowCTS.Token);
                }
                Protocol.SendEvent(new TerminatedEvent());
                Protocol.SendEvent(new ExitedEvent(0));
            });

            Protocol.SendEvent(new InitializedEvent());
            return(new LaunchResponse());
        }
コード例 #10
0
        /// <summary>
        ///		Creates a new <see cref="CefManager"/> instance
        /// </summary>
        /// <param name="arguments"></param>
        /// <param name="rawArguments"></param>
        /// <exception cref="DllNotFoundException"></exception>
        /// <exception cref="CefVersionMismatchException"></exception>
        /// <exception cref="Exception"></exception>
        public CefManager(LaunchArguments arguments, string[] rawArguments)
        {
            //Setup CEF
            CefRuntime.Load();

            launchArguments = arguments;
            args            = rawArguments;
        }
コード例 #11
0
        private string GetReceptionistHostFromArguments()
        {
            var arguments = LaunchArguments.GetArguments();
            var hostIp    =
                CommandLineUtility.GetCommandLineValue(arguments, RuntimeConfigNames.ReceptionistHost, string.Empty);

            return(hostIp);
        }
コード例 #12
0
        static int Main(string[] args)
        {
            var parser          = new CommandLineParser.CommandLineParser();
            var launchArguments = new LaunchArguments();

            try
            {
                parser.ExtractArgumentAttributes(launchArguments);
                parser.ParseCommandLine(args);
            }
            catch (CommandLineException ex)
            {
                Console.WriteLine(ex.Message);
                parser.ShowUsage();
                return(1);
            }

            if (launchArguments.MaxPlayers > SharedConstants.MaxPlayerLimit)
            {
                Console.WriteLine($"Max players exceeded max limit of {SharedConstants.MaxPlayerLimit}. Value was adjusted.");
                launchArguments.MaxPlayers = SharedConstants.MaxPlayerLimit;
            }

            if (launchArguments.MaxPlayers < 1)
            {
                Console.WriteLine("Player limit can't be lower than 1.");
                parser.ShowUsage();
                return(1);
            }

            ConsoleManager.Initialize();
            ConsoleManager.OnInput += cmd => queuedCommandInputs.Enqueue(cmd);

            Server = new GameServer(launchArguments.ServerName, launchArguments.MaxPlayers, launchArguments.Port, false, launchArguments.Private, !launchArguments.NoSteam, "config");
            Server.Start();

            while (Server.Running)
            {
                while (queuedCommandInputs.Count > 0)
                {
                    Server.ConsoleCommands.HandleMessage(null, queuedCommandInputs.Dequeue());
                }

                if (!Server.Running)
                {
                    continue;
                }

                Server.Update();

                Console.Title = $"{Server.Name} | {Server.Players.Count}/{Server.MaxPlayers}";
                Thread.Sleep(1);
            }

            ConsoleManager.Destroy();
            return(0);
        }
コード例 #13
0
ファイル: BlankLoadScreen.cs プロジェクト: CH4Code/OpenRA
        public void StartGame(Arguments args)
        {
            Launch = new LaunchArguments(args);
            Ui.ResetAll();
            Game.Settings.Save();

            if (Launch.Benchmark)
            {
                Log.AddChannel("cpu", "cpu.csv");
                Log.Write("cpu", "tick;time [ms]");

                Log.AddChannel("render", "render.csv");
                Log.Write("render", "frame;time [ms]");

                Console.WriteLine("Saving benchmark data into {0}".F(Path.Combine(Platform.SupportDir, "Logs")));

                Game.BenchmarkMode = true;
            }

            // Join a server directly
            var connect = Launch.GetConnectAddress();
            if (!string.IsNullOrEmpty(connect))
            {
                var parts = connect.Split(':');

                if (parts.Length == 2)
                {
                    var host = parts[0];
                    var port = Exts.ParseIntegerInvariant(parts[1]);
                    Game.LoadShellMap();
                    Game.RemoteDirectConnect(host, port);
                    return;
                }
            }

            // Load a replay directly
            if (!string.IsNullOrEmpty(Launch.Replay))
            {
                var replayMeta = ReplayMetadata.Read(Launch.Replay);
                if (ReplayUtils.PromptConfirmReplayCompatibility(replayMeta, Game.LoadShellMap))
                    Game.JoinReplay(Launch.Replay);

                if (replayMeta != null)
                {
                    var mod = replayMeta.GameInfo.Mod;
                    if (mod != null && mod != Game.ModData.Manifest.Mod.Id && ModMetadata.AllMods.ContainsKey(mod))
                        Game.InitializeMod(mod, args);
                }

                return;
            }

            Game.LoadShellMap();
            Game.Settings.Save();
        }
コード例 #14
0
        protected override LaunchResponse HandleLaunchRequest(LaunchArguments arguments)
        {
            Protocol.RegisterRequestType <InlineVairaleRequest, InlineVariableArguments>(HandleInlineVariable);
            this.Protocol.SendEvent(new InitializedEvent());
            Protocol.SendEvent(new OutputEvent("Launching..."));
            string address = arguments.ConfigurationProperties.GetValueAsString("address");

            if (String.IsNullOrEmpty(address))
            {
                throw new ProtocolException("Launch failed because launch configuration did not specify 'address'.");
            }

            string[] token = address.Split(':');

            if (token.Length < 2)
            {
                throw new ProtocolException($"Launch failed because 'address' is invalid({address}).");
            }
            string host = token[0];
            int    port;

            if (!int.TryParse(token[1], out port))
            {
                throw new ProtocolException($"Launch failed because 'address' is invalid({address}).");
            }

            this.stopAtEntry    = arguments.ConfigurationProperties.GetValueAsBool("stopAtEntry") ?? false;
            this.hyperStepSpeed = arguments.ConfigurationProperties.GetValueAsInt("hyperStepSpeed") ?? 0;

            debugged = new DebuggedProcessVSCode(this, host, port);
            while (debugged.Connecting)
            {
                System.Threading.Thread.Sleep(10);
            }

            if (debugged.Connected)
            {
                if (debugged.CheckDebugServerVersion())
                {
                    debugged.OnDisconnected = OnDisconnected;
                    return(new LaunchResponse());
                }
                else
                {
                    debugged.Close();
                    throw new ProtocolException(String.Format("ILRuntime Debugger version mismatch\n Expected version:{0}\n Actual version:{1}", DebuggerServer.Version, debugged.RemoteDebugVersion));
                }
            }
            else
            {
                debugged = null;
                throw new ProtocolException("Cannot connect to ILRuntime");
            }
        }
コード例 #15
0
        protected override void EntryPoint(LaunchArguments launchArguments, string[] args)
        {
            cefManager = new CefManager(launchArguments, args);

            //Setup events
            cefManager.OnUrlChange += url => SendEvent(new OnUrlChangeEvent
            {
                NewUrl = url
            });

            cefManager.Init();
        }
コード例 #16
0
        public static void LoadProject(LaunchArguments launchArguments)
        {
            _requiredProjectArguments.ProjectId = launchArguments.projectId;
            _requiredProjectArguments.SceneId   = launchArguments.sceneId;
            _requiredProjectArguments.ProjectConfigurationId = launchArguments.projectConfigurationId;
            _requiredProjectArguments.GameMode     = (GameMode)launchArguments.gm;
            _requiredProjectArguments.PlatformMode = (PlatformMode)launchArguments.platformMode;
            //Force it to be VR or Desktop from the beginning
            ProjectData.PlatformMode = (PlatformMode)launchArguments.platformMode;

            LoadProjectScene();
        }
コード例 #17
0
 private void AssertFailParse(string message, string[] args)
 {
     try
     {
         var launchArguments = LaunchArguments.Parse(args);
     }
     catch (Exception e)
     {
         Assert.AreEqual(message, e.Message);
         return;
     }
     Assert.Fail("No exception was thrown");
 }
コード例 #18
0
ファイル: BlankLoadScreen.cs プロジェクト: zhangolove/OpenRA
        public void StartGame(Arguments args)
        {
            Launch = new LaunchArguments(args);
            Ui.ResetAll();
            Game.Settings.Save();

            // Join a server directly
            var connect = Launch.GetConnectAddress();

            if (!string.IsNullOrEmpty(connect))
            {
                var parts = connect.Split(':');

                if (parts.Length == 2)
                {
                    var host = parts[0];
                    var port = Exts.ParseIntegerInvariant(parts[1]);
                    Game.LoadShellMap();
                    Game.RemoteDirectConnect(host, port);
                    return;
                }
            }

            // Load a replay directly
            if (!string.IsNullOrEmpty(Launch.Replay))
            {
                var replayMeta = ReplayMetadata.Read(Launch.Replay);
                if (ReplayUtils.PromptConfirmReplayCompatibility(replayMeta, Game.LoadShellMap))
                {
                    Game.JoinReplay(Launch.Replay);
                }

                if (replayMeta != null)
                {
                    var mod = replayMeta.GameInfo.Mod;
                    if (mod != null && mod != Game.ModData.Manifest.Mod.Id && ModMetadata.AllMods.ContainsKey(mod))
                    {
                        Game.InitializeMod(mod, args);
                    }
                }

                return;
            }

            Game.LoadShellMap();
            Game.Settings.Save();
        }
コード例 #19
0
ファイル: BlankLoadScreen.cs プロジェクト: hadow/Commander
        public void StartGame(Arguments args)
        {
            Launch = new LaunchArguments(args);
            if (Launch.Benchmark)
            {
            }

            var connect = Launch.GetConnectAddress();

            if (!string.IsNullOrEmpty(connect))
            {
            }

            //Load a replay directly
            if (!string.IsNullOrEmpty(Launch.Replay))
            {
            }
            WarGame.LoadShellMap();
        }
コード例 #20
0
ファイル: BlankLoadScreen.cs プロジェクト: Roger-luo/OpenRA
		public void StartGame(Arguments args)
		{
			Launch = new LaunchArguments(args);
			Ui.ResetAll();
			Game.Settings.Save();

			// Join a server directly
			var connect = Launch.GetConnectAddress();
			if (!string.IsNullOrEmpty(connect))
			{
				var parts = connect.Split(':');

				if (parts.Length == 2)
				{
					var host = parts[0];
					var port = Exts.ParseIntegerInvariant(parts[1]);
					Game.LoadShellMap();
					Game.RemoteDirectConnect(host, port);
					return;
				}
			}

			// Load a replay directly
			if (!string.IsNullOrEmpty(Launch.Replay))
			{
				var replayMeta = ReplayMetadata.Read(Launch.Replay);
				if (ReplayUtils.PromptConfirmReplayCompatibility(replayMeta, Game.LoadShellMap))
					Game.JoinReplay(Launch.Replay);

				if (replayMeta != null)
				{
					var mod = replayMeta.GameInfo.Mod;
					if (mod != null && mod != Game.ModData.Manifest.Mod.Id && ModMetadata.AllMods.ContainsKey(mod))
						Game.InitializeMod(mod, args);
				}

				return;
			}

			Game.LoadShellMap();
			Game.Settings.Save();
		}
コード例 #21
0
ファイル: AMQPClient.cs プロジェクト: RobboVariwn/VarBot
        private static LaunchArguments LoadFromCache()
        {
            if (!File.Exists(_cachePath + "/launch.args"))
            {
                return(null);
            }

            string message = File.ReadAllText(_cachePath + "/launch.args");

            try
            {
                LaunchArguments launchArguments = message.JsonDeserialize <LaunchArguments>();

                return(launchArguments);
            }
            catch
            {
                return(null);
            }
        }
コード例 #22
0
        public static async Task <DebugSession> CreateDebugSession(LaunchArguments arguments, Action <DebugEvent> sendEvent, DebugSession.DebugView defaultDebugView)
        {
            var config        = arguments.ConfigurationProperties;
            var sourceFileMap = ParseSourceFileMap(config);
            var contract      = await Contract.Load(config["program"].Value <string>(), sourceFileMap).ConfigureAwait(false);

            var storages = ParseStorage(contract.ScriptHash, config);

            var(storedContracts, storedContractStorages) = await ParseStoredContracts(config, sourceFileMap);

            var invokeScript = BuildInvokeScript(contract.ScriptHash, ParseArguments(contract.EntryPoint, config));
            var engine       = CreateExecutionEngine(invokeScript,
                                                     storedContracts.Append(contract),
                                                     storedContractStorages.Concat(storages),
                                                     config,
                                                     sendEvent);

            var returnTypes = ParseReturnTypes(config).ToList();

            return(new DebugSession(engine, storedContracts.Append(contract), sendEvent, returnTypes, defaultDebugView));
コード例 #23
0
        public void UpdateSettings(LaunchArguments launchArguments)
        {
            LogManager.GetCurrentClassLogger().Info("New launch arguments: " + launchArguments.ToJson());
            Settings.ReadLauncherSettings(launchArguments);

            if (Settings.Instance().Multiplayer)
            {
                PhotonNetwork.autoJoinLobby                      = false;
                PhotonNetwork.automaticallySyncScene             = true;
                PhotonNetwork.PhotonServerSettings.ServerAddress = Settings.Instance().PhotonHost;
                PhotonNetwork.PhotonServerSettings.ServerPort    = Convert.ToInt32(Settings.Instance().PhotonPort);
            }
            else
            {
                PhotonNetwork.offlineMode = true;
            }

            if (!_licenseGot)
            {
                GetLicense();
            }
        }
コード例 #24
0
        protected override LaunchResponse HandleLaunchRequest(LaunchArguments arguments)
        {
            string fileName = arguments.ConfigurationProperties.GetValueAsString("program");

            if (String.IsNullOrEmpty(fileName))
            {
                throw new ProtocolException("Launch failed because launch configuration did not specify 'program'.");
            }

            fileName = Path.GetFullPath(fileName);
            if (!File.Exists(fileName))
            {
                throw new ProtocolException("Launch failed because 'program' files does not exist.");
            }

            this.Source         = new Source(name: Path.GetFileName(fileName), path: fileName);
            this.stopAtEntry    = arguments.ConfigurationProperties.GetValueAsBool("stopAtEntry") ?? false;
            this.hyperStepSpeed = arguments.ConfigurationProperties.GetValueAsInt("hyperStepSpeed") ?? 0;

            // Read the script file
            this.lines = File.ReadAllLines(fileName).Select(l => String.IsNullOrEmpty(l) ? null : l).ToList().AsReadOnly();

            return(new LaunchResponse());
        }
コード例 #25
0
 public BrowserProcessCEFApp(LaunchArguments launchArguments)
 {
     mediaStreamingEnabled = launchArguments.WebRtc;
     noProxyServer         = !launchArguments.ProxyEnabled;
 }
コード例 #26
0
        public void StartGame(Arguments args)
        {
            Launch = new LaunchArguments(args);
            Ui.ResetAll();
            Game.Settings.Save();

            // Check whether the mod content is installed
            // TODO: The installation code has finally been beaten into shape, so we can
            // finally move it all into the planned "Manage Content" panel in the modchooser mod.
            var installData       = Game.ModData.Manifest.Get <ContentInstaller>();
            var installModContent = !installData.TestFiles.All(f => GlobalFileSystem.Exists(f));
            var installModMusic   = args != null && args.Contains("Install.Music");

            if (installModContent || installModMusic)
            {
                var widgetArgs = new WidgetArgs()
                {
                    { "continueLoading", () => Game.RunAfterTick(() =>
                                                                 Game.InitializeMod(Game.Settings.Game.Mod, args)) },
                };

                if (installData.BackgroundWidget != null)
                {
                    Ui.LoadWidget(installData.BackgroundWidget, Ui.Root, widgetArgs);
                }

                var menu = installModContent ? installData.MenuWidget : installData.MusicMenuWidget;
                Ui.OpenWindow(menu, widgetArgs);

                return;
            }

            // Join a server directly
            var connect = Launch.GetConnectAddress();

            if (!string.IsNullOrEmpty(connect))
            {
                var parts = connect.Split(':');

                if (parts.Length == 2)
                {
                    var host = parts[0];
                    var port = Exts.ParseIntegerInvariant(parts[1]);
                    Game.LoadShellMap();
                    Game.RemoteDirectConnect(host, port);
                    return;
                }
            }

            // Load a replay directly
            if (!string.IsNullOrEmpty(Launch.Replay))
            {
                var replayMeta = ReplayMetadata.Read(Launch.Replay);
                if (ReplayUtils.PromptConfirmReplayCompatibility(replayMeta, Game.LoadShellMap))
                {
                    Game.JoinReplay(Launch.Replay);
                }

                if (replayMeta != null)
                {
                    var mod = replayMeta.GameInfo.Mod;
                    if (mod != null && mod != Game.ModData.Manifest.Mod.Id && ModMetadata.AllMods.ContainsKey(mod))
                    {
                        Game.InitializeMod(mod, args);
                    }
                }

                return;
            }

            Game.LoadShellMap();
            Game.Settings.Save();
        }
コード例 #27
0
ファイル: AMQPClient.cs プロジェクト: RobboVariwn/VarBot
        public static void ReadLaunchArgs()
        {
            try
            {
                string key          = _settings.key;
                string queueName    = ExchangeNames.Launch + "_" + key;
                string exchangeName = ExchangeNames.Launch;

                IModel channel = GetChanel();
                ExchangeDeclareIfNotExist(exchangeName, "direct", true);

                channel.QueueBind(queueName,
                                  exchangeName,
                                  key);

                EventingBasicConsumer consumer = new EventingBasicConsumer(channel);

                consumer.Received += (model, ea) =>
                {
                    LogManager.GetCurrentClassLogger().Info("vw.launch received message!");
                    var    body    = ea.Body;
                    string message = Encoding.UTF8.GetString(body);

#if UNITY_EDITOR
                    SaveCache(message);
#endif
                    LaunchArguments launchArguments = message.JsonDeserialize <LaunchArguments>();

                    if (launchArguments.extraArgs != null)
                    {
                        Debug.Log("!!@@##"
                                  + launchArguments
                                  .extraArgs);     //not sure where to instantiate local logger with LogManager.GetCurrentClassLogger()
                        ArgumentStorage.ClearStorage();
                        ArgumentStorage.AddJsonArgsArray(launchArguments.extraArgs);
                    }

                    ProjectDataListener.Instance.LaunchArguments = launchArguments;
                };

                channel.BasicConsume(queueName,
                                     true,
                                     consumer);
            }
            catch (Exception e)
            {
                CloseConnectionAndChanel();

#if UNITY_EDITOR
                LaunchArguments launchArguments = LoadFromCache();

                if (launchArguments != null)
                {
                    LogManager.GetCurrentClassLogger().Info("Loading previous vw.launch...");
                    ProjectDataListener.Instance.LaunchArguments = launchArguments;
                }
                else
                {
                    LauncherErrorManager.Instance.ShowFatalErrorKey(
                        ErrorHelper.GetErrorKeyByCode(Varwin.Errors.ErrorCode.RabbitNoArgsError),
                        e.StackTrace);
                }
#else
                LogManager.GetCurrentClassLogger().Fatal("vw.launch not found! StackTrace = " + e.StackTrace);
                LauncherErrorManager.Instance.ShowFatalErrorKey(ErrorHelper.GetErrorKeyByCode(Varwin.Errors.ErrorCode.RabbitNoArgsError), e.StackTrace);
#endif
            }
        }
コード例 #28
0
        public static Task <IDebugSession> CreateDebugSessionAsync(LaunchArguments launchArguments, Action <DebugEvent> sendEvent, DebugView defaultDebugView)
        {
            var launchParser = new LaunchConfigParser(launchArguments);

            return(launchParser.CreateDebugSessionAsync(sendEvent, defaultDebugView));
        }
コード例 #29
0
 public LaunchConfigParser(LaunchArguments launchArguments)
 {
     config      = launchArguments.ConfigurationProperties;
     paramParser = new ContractParameterParser(accounts.TryGetValue, contracts.TryGetValue);
 }
コード例 #30
0
        public void StartGame(Arguments args)
        {
            Launch = new LaunchArguments(args);
            Ui.ResetAll();
            Game.Settings.Save();

            // Check whether the mod content is installed
            // TODO: The installation code has finally been beaten into shape, so we can
            // finally move it all into the planned "Manage Content" panel in the modchooser mod.
            var installData = Game.ModData.Manifest.Get<ContentInstaller>();
            var installModContent = !installData.TestFiles.All(f => GlobalFileSystem.Exists(f));
            var installModMusic = args != null && args.Contains("Install.Music");

            if (installModContent || installModMusic)
            {
                var widgetArgs = new WidgetArgs()
                {
                    { "continueLoading", () => Game.RunAfterTick(() =>
                        Game.InitializeMod(Game.Settings.Game.Mod, args)) },
                };

                if (installData.BackgroundWidget != null)
                    Ui.LoadWidget(installData.BackgroundWidget, Ui.Root, widgetArgs);

                var menu = installModContent ? installData.MenuWidget : installData.MusicMenuWidget;
                Ui.OpenWindow(menu, widgetArgs);

                return;
            }

            // Join a server directly
            var connect = Launch.GetConnectAddress();
            if (!string.IsNullOrEmpty(connect))
            {
                var parts = connect.Split(':');

                if (parts.Length == 2)
                {
                    var host = parts[0];
                    var port = Exts.ParseIntegerInvariant(parts[1]);
                    Game.LoadShellMap();
                    Game.RemoteDirectConnect(host, port);
                    return;
                }
            }

            // Load a replay directly
            if (!string.IsNullOrEmpty(Launch.Replay))
            {
                var replayMeta = ReplayMetadata.Read(Launch.Replay);
                if (ReplayUtils.PromptConfirmReplayCompatibility(replayMeta, Game.LoadShellMap))
                    Game.JoinReplay(Launch.Replay);

                if (replayMeta != null)
                {
                    var mod = replayMeta.GameInfo.Mod;
                    if (mod != null && mod != Game.ModData.Manifest.Mod.Id && ModMetadata.AllMods.ContainsKey(mod))
                        Game.InitializeMod(mod, args);
                }

                return;
            }

            Game.LoadShellMap();
            Game.Settings.Save();
        }