當前位置: 首頁>>代碼示例>>C#>>正文


C# Arguments.Contains方法代碼示例

本文整理匯總了C#中System.Arguments.Contains方法的典型用法代碼示例。如果您正苦於以下問題:C# Arguments.Contains方法的具體用法?C# Arguments.Contains怎麽用?C# Arguments.Contains使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Arguments的用法示例。


在下文中一共展示了Arguments.Contains方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: StartGame

        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();
        }
開發者ID:rhamilton1415,項目名稱:OpenRA,代碼行數:66,代碼來源:BlankLoadScreen.cs

示例2: Settings

        public Settings(string file, Arguments args)
        {
            SettingsFile = file;
            Sections = new Dictionary<string, object>()
            {
                {"Player", Player},
                {"Game", Game},
                {"Sound", Sound},
                {"Graphics", Graphics},
                {"Server", Server},
                {"Debug", Debug},
            };

            // Override fieldloader to ignore invalid entries
            var err1 = FieldLoader.UnknownFieldAction;
            var err2 = FieldLoader.InvalidValueAction;

            FieldLoader.UnknownFieldAction = (s,f) =>
            {
                Console.WriteLine( "Ignoring unknown field `{0}` on `{1}`".F( s, f.Name ) );
            };

            if (File.Exists(SettingsFile))
            {
                var yaml = MiniYaml.DictFromFile(SettingsFile);

                foreach (var kv in Sections)
                    if (yaml.ContainsKey(kv.Key))
                        LoadSectionYaml(yaml[kv.Key], kv.Value);
            }

            // Override with commandline args
            foreach (var kv in Sections)
                foreach (var f in kv.Value.GetType().GetFields())
                    if (args.Contains(kv.Key+"."+f.Name))
                        FieldLoader.LoadField( kv.Value, f.Name, args.GetValue(kv.Key+"."+f.Name, "") );

            FieldLoader.UnknownFieldAction = err1;
            FieldLoader.InvalidValueAction = err2;
        }
開發者ID:Ray-B,項目名稱:OpenRA,代碼行數:40,代碼來源:Settings.cs

示例3: GetUnmatchedArgs

        Dictionary<ConstructorInfo, IList<ParameterInfo>> GetUnmatchedArgs(IEnumerable<ConstructorInfo> constructors, Arguments args)
        {
            var result = new Dictionary<ConstructorInfo, IList<ParameterInfo>>();

            foreach (var ctor in constructors)
            {
                var parameters = ctor.GetParameters().Where(p => !args.Contains(p)).ToList();
                if (parameters.Count > 0)
                {
                    result.Add(ctor, parameters);
                }
            }

            return result;
        }
開發者ID:Pondidum,項目名稱:Seivad,代碼行數:15,代碼來源:Selector.cs


注:本文中的System.Arguments.Contains方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。