当前位置: 首页>>代码示例>>C#>>正文


C# ArgumentList.Remove方法代码示例

本文整理汇总了C#中ArgumentList.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# ArgumentList.Remove方法的具体用法?C# ArgumentList.Remove怎么用?C# ArgumentList.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ArgumentList的用法示例。


在下文中一共展示了ArgumentList.Remove方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetArgumentValue

        internal Object GetArgumentValue(ICommandInterpreter interpreter, ArgumentList args, string[] allArguments)
        {
            object value = null;

            if (IsInterpreter)
                return interpreter;

            if (IsAllArguments)
            {
                args.Clear();
                args.Unnamed.Clear();
                return allArguments;
            }

            foreach (string name in AllNames)
            {
                ArgumentList.Item argitem;
                if (args.TryGetValue(name, out argitem))
                {
                    if (Parameter.ParameterType == typeof (string[]))
                        value = argitem.Values;
                    else if (IsFlag)
                    {
                        bool result;
                        value = (String.IsNullOrEmpty(argitem.Value) || (bool.TryParse(argitem.Value, out result) && result));
                    }
                    else
                        value = argitem.Value;
                    args.Remove(name);
                }
            }

            return base.ChangeType(value, Parameter.ParameterType, Required, DefaultValue);
        }
开发者ID:andy-uq,项目名称:Echo,代码行数:34,代码来源:Argument.cs

示例2: MapCommand

        void MapCommand( ISender sender, ArgumentList argz)
        {
            bool autosave = false;
            if (argz.Contains("automap"))
            {
                autosave = true;
                argz.Remove("automap");
            }
            try {
                if (isMapping)
                {
                    throw new CommandError("Still currently mapping.");
                }
                p = mapoutputpath;
                filename = "world-now.png";
                var timestamp = false;
                var reload = false;
                var highlight = false;
                string nameOrID = "";
                var savefromcommand = false;
                string cs = colorscheme;
                var autosaveedit = false;
                var options = new OptionSet ()
                {
                    { "t|timestamp", v => timestamp = true },
                    { "n|name=", v => filename = v },
                    { "L|reload", v => reload = true },
                    { "s|save", v => savefromcommand = true },
                    { "p|path=", v => p = v },
                    { "h|highlight=", v => { nameOrID = v; highlight = true; } },
                    { "c|colorscheme=", v => cs = v },
                    { "a|autosave", v => autosaveedit = true },
                };
                var args = options.Parse (argz);

                if (autosaveedit)
                {
                    if (autosaveenabled)
                    {
                        properties.setValue("autosave-enabled", "False");
                        sender.sendMessage("autosave disabled.");
                    }
                    else
                    {
                        properties.setValue("autosave-enabled", "True");
                        sender.sendMessage("autosave enabled.");
                    }
                    if (highlight)
                    {
                        if (highlightsearch(sender as Player, nameOrID))
                        {
                            properties.setValue("autosave-highlight", "True");
                            properties.setValue("autosave-highlightID", nameOrID);
                            sender.sendMessage("autosave highlight settings updated.");
                        }
                    }

                    if (timestamp)
                    {
                        if (autosavetimestamp)
                        {
                            properties.setValue("autosave-timestamp", "False");
                            sender.sendMessage("autosave now using regular name.");
                        }
                        else
                        {
                            properties.setValue("autosave-timestamp", "True");
                            sender.sendMessage("autosave now using timestamp.");
                        }
                    }

                    if (filename != "world-now.png")
                    {
                        properties.setValue("autosave-filename", filename);
                    }

                    properties.Save();
                    return;
                }

                if (reload || autosave) {
                    sender.sendMessage ("map: Reloaded settings database, entries: " + properties.Count);
                    properties.Load ();
                    var msg = string.Concat (
                    "Settings: mapoutputpath=", p, ", ",
                    "colorscheme=", cs);
                    if ( !(Directory.Exists(p)) ){
                        msg = string.Concat ( msg , "  (DOESNT EXIST)" );
                        ProgramLog.Error.Log ("<map> ERROR: Loaded Directory does not exist.");
                    }
                    if (!autosave)
                    {
                        ProgramLog.Admin.Log("<map> " + msg);
                    }
                    //sender.sendMessage ("map: " + msg);

                    if ( !(cs=="MoreTerra" || cs=="Terrafirma") ){
                        ProgramLog.Error.Log ("<map> ERROR: please change colorscheme");
                    }
                }
//.........这里部分代码省略.........
开发者ID:Enerdy,项目名称:TDSM_map,代码行数:101,代码来源:MapPlugin_Commands.cs


注:本文中的ArgumentList.Remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。