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


C# CmdRequest.ContainsFlag方法代码示例

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


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

示例1: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 1)
                return ShowUsage();
            if (args.ContainsFlag("--all"))
            {
                List<uint> ids = new List<uint>();
                foreach (SimObject o in TheSimAvatar.Children)
                {
                    Success("Detatching " + o);
                    ids.Add(o.LocalID);
                }
                Client.Objects.DetachObjects(TheSimAvatar.GetSimulator(), ids);
                return Success("detatched all " + ids.Count);
            }

            int argsUsed;
            string[] keyargs = args.GetProperty("targets");
            List<SimObject> PS = WorldSystem.GetPrimitives(keyargs, out argsUsed);
            List<uint> idz = new List<uint>();
            foreach (var o in PS)
            {
                Success("Detatching " + o);
                idz.Add(o.LocalID);
            }
            Client.Objects.DetachObjects(TheSimAvatar.GetSimulator(), idz);
            return Success("detatched  " + args.str + " " + idz.Count);
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:28,代码来源:DetachCommand.cs

示例2: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            int used = 0;
            if (args.Length == 0)
            {
                return ShowUsage();
            }
            else
            {
                if (args.ContainsFlag("listns"))
                {
                    foreach (var c in MushDLR223.ScriptEngines.ScriptManager.GetNameSpaces(TheBotClient))
                    {
                        AddSuccess(c);
                    }
                    return SuccessOrFailure();
                }
                if (args.ContainsFlag("vars") || args.ContainsFlag("list"))
                {
                    foreach (var c in ScriptManager.GetNameSpaces(TheBotClient))
                    {
                        foreach (var s in ScriptManager.GetProviders(TheBotClient, c))
                        {
                            foreach (var s1 in s.SettingNames(TheBotClient, 1))
                            {
                                GetValue(c, s1, AddSuccess);
                            }
                        }
                    }
                    return SuccessOrFailure();
                }

                string nss = TheBotClient.GetName();
                string varname = args[0];
                if (args.tokens.Length > 1)
                {
                    string[] sa = Parser.SplitOff(args.tokens, 1);
                    string value = string.Join(" ", sa);
                    ScriptManager.AddSetting(TheBotClient, nss, varname, value);
                }
                GetValue(nss, varname, AddSuccess);
                return SuccessOrFailure();
            }
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:44,代码来源:BotVarCommand.cs

示例3: ExecuteRequest

 public override CmdResult ExecuteRequest(CmdRequest args)
 {
     bool writeInfo = !args.IsFFI;
     int count = 0;
     if (args.ContainsFlag("--presence"))
     {
         foreach (var A in WorldObjects.SimAccounts)
         {
             count++;
             AppendItem("agents", A);
             if (writeInfo) WriteLine(A + " local=" + A.IsLocal);
         }
     }
     else
     {
         int[] count0 = {0};
         foreach (Simulator sim in LockInfo.CopyOf(Client.Network.Simulators))
         {
             if (sim.ObjectsAvatars.Count == 0) continue;
             if (writeInfo) WriteLine("");
             if (writeInfo) WriteLine("Region: " + sim);
             Simulator simulator = sim;
             sim.ObjectsAvatars.ForEach(
                 delegate(Avatar av)
                     {
                         count0[0]++;
                         SimObject A = WorldSystem.GetSimObject(av, simulator);
                         AppendItem("avatars", A);
                         if (string.IsNullOrEmpty(av.Name))
                         {
                             Client.Objects.SelectObjects(simulator, new uint[] {av.LocalID}, true);
                         }
                         if (writeInfo)
                             WriteLine(" {0} (Group: {1}, Location: {2}, UUID: {3})",
                                       av.Name, av.GroupName, av.Position, av.ID.ToString());
                     }
                 );
         }
         count = count0[0];
     }
     SetResult("count", count);
     return SuccessOrFailure();
 }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:43,代码来源:WhoCommand.cs

示例4: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 1)
            {
                return ShowUsage();
                    // "rezitem [avatar5,prev,sim/123/232/[email protected]] "fairyverse Goodies" [item2] [item3] [...]";
            }

            int argsUsed = 0;
            string lowerMatch = args[0].ToLower();
            SimPosition dest = null;
            if (!args.ContainsFlag("--prev"))
            {
                dest = WorldSystem.GetVector(args.GetProperty("location"), out argsUsed);
            }
            var man = Client.BotInventory;
            var found = man.FindAll(args.GetProperty("items"), true,
                                    inventoryName => Failure("No inventory item named " + inventoryName + " found."));
            foreach (InventoryBase ib in man.ItemsOnly(found))
            {
                RezAll(man, ib, dest);
            }
            return Success("found.Count=" + found.Count);
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:24,代码来源:RezItemCommand.cs

示例5: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest argsI)
        {
            ListAsSet<SimPosition> objs = TheSimAvatar.GetSelectedObjects();

            if (argsI.Length == 0)
            {
                foreach (var o in objs)
                {
                    WriteLine(" " + o);
                }
                return SuccessOrFailure();
            }
            if (argsI.ContainsFlag("--clear"))
            {
                objs.Clear();
                bool was = TheSimAvatar.SelectedBeam;
                TheSimAvatar.SelectedBeam = !was;
                TheSimAvatar.SelectedBeam = was;
            }
            var args = argsI.GetProperty("targets");
            {
                int used = 0;
                bool remove = false;
                while (used < args.Length)
                {
                    args = Parser.SplitOff(args, used);
                    string s = args[0];
                    if (s.StartsWith("-"))
                    {
                        remove = true;
                        s = s.Substring(1);
                    }
                    if (s.StartsWith("+"))
                    {
                        remove = false;
                        s = s.Substring(1);
                    }
                    if (s.Length < 0)
                    {
                        used = 1;
                        continue;
                    }
                    args[0] = s;
                    List<SimObject> PS = WorldSystem.GetPrimitives(args, out used);
                    foreach (var P in PS)
                    {
                        if (P == null)
                        {
                            WriteLine("Cannot find " + s);
                            used = 1;
                            continue;
                        }
                        if (remove)
                        {
                            WriteLine("Removing " + P);
                            TheSimAvatar.SelectedRemove(P);
                        }
                        else
                        {
                            WriteLine("Adding " + P);
                            TheSimAvatar.SelectedAdd(P);
                        }
                    }
                    if (used == 0) break;
                }
            }
            return Success("selected objects count=" + objs.Count);
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:68,代码来源:SelectCommand.cs

示例6: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            string filename;
            if (args.TryGetValue("save", out filename))
            {
                FileStream w = null;
                try
                {
                    w = File.OpenWrite(filename);
                    StreamWriter sw = new StreamWriter(w);
                    SysVarHtml((s, args0) =>
                                   {
                                       try
                                       {
                                           sw.WriteLine(DLRConsole.SafeFormat(s, args0));
                                       }
                                       catch (Exception)
                                       { 
                                           return;
                                       }
                                   }, true);
                }
                finally
                {
                    if (w != null) w.Close();
                    ;   
                }
                return Success("Wrote " + filename);
            }
            if (args.TryGetValue("load", out filename))
            {
                LoadSysVarHtml(File.OpenRead(filename));
                return Success("Loaded " + filename);
            }
            if (args.ContainsFlag("htmldoc"))
            {
                StringBuilder sw = new StringBuilder(1024*900);
                SysVarHtml((s, ags) => sw.AppendFormat(s, ags), false);
                return Success(sw.ToString());
            }

            bool exactMatch = args.ContainsFlag("--exact");
            bool caseSensitive = args.ContainsFlag("--case");

            int used = 0;
            var sysvars = GetSysVars();
            string find;
            if (!args.TryGetValueOr("key", 0, out find))
            {
                // display all
                foreach (var sv in sysvars)
                {
                    var svv = sv;
                    WriteLine(string.Format("{0}={1} //{2}", (svv.Key), svv.Value, svv.Comments));
                }
                return Success("count=" + sysvars.Count);
            }
            if (!caseSensitive) find = find.ToLower();
            var setThese = ScriptManager.FindMatchingSysvars(sysvars, find, exactMatch, caseSensitive);
            int found = 0;
            foreach (var svv in setThese)
            {
                {
                    found++;
                    WriteLine(svv.DebugInfo);
                }
            }
            string value;
            if (!args.TryGetValueOr("value", 1, out value))
            {
                return Success("Found sysvars: " + found);
            }
            int changed = 0;
            foreach (var one in setThese)
            {
                try
                {
                    one.Value = value;
                    AddSuccess("Set sysvar: " + one.Key + " to " + one.Value);
                    changed++;
                }
                catch (Exception e)
                {
                }
            }
            return Success("set vars = " + changed);
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:87,代码来源:SysVarCommand.cs


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