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


C# CmdRequest.GetProperty方法代码示例

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


在下文中一共展示了CmdRequest.GetProperty方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
        {
            bool moveInsteadOfCopy = args.IsTrue("--move");
            if (!args.ContainsKey("items") || !args.ContainsKey("to"))
            {
                return ShowUsage();
            }
            int argsUsed;
            List<SimObject> allTargets;
            if (!args.TryGetValue("to", out allTargets))
            {
                return Failure("Cannot find avatar/objects 'to' give to");
            }

            Success("Going to give to " + allTargets.Count + " avatar/objects");

            var man = Client.BotInventory;
            var found = man.FindAll(args.GetProperty("items"), false,
                                    inventoryName => Failure("No inventory item named " + inventoryName + " found."));

            int given = 0;
            foreach (var dest in allTargets)
            {
                foreach (InventoryBase item in found)
                {
                    GiveAll(man, item, dest, moveInsteadOfCopy);
                }
            }
            return SuccessOrFailure();
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:30,代码来源:GiveItemCommand.cs

示例3: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (Client.Network.CurrentSim == null) return Failure("not yet connected");
            int argsUsed;
            var args0 = args.GetProperty("targets");
            List<SimObject> OS = WorldSystem.GetPrimitives(args0, out argsUsed);
            bool writeInfo = !args.IsFFI;
            if (IsEmpty(OS))
            {
                OS = new List<SimObject> {TheSimAvatar};
            }
            int total = 0;
            foreach (var O in OS)
            {
                if (writeInfo) WriteLine("Attachments for " + O);
                int count = O.Children.Count;
                total++;
                foreach (var s in O.Children)
                {
                    AppendItem("list", O);
                    if (!writeInfo) continue;
                    String point = "Unknown";
                    Primitive prim = s.Prim;
                    if (prim != null)
                    {
                        point = prim.PrimData.AttachmentPoint.ToString() + " Offset: " + prim.Position;
                    }

                    // TODO: Done? Fetch properties for the objects with missing property sets so we can show names
                    WriteLine("[Attachment @ {0}] {1}", point, s);
                }
            }
            SetResult("count", total);
            return SuccessOrFailure();
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:35,代码来源:AttachmentsCommand.cs

示例4: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest args0)
        {
            var args = args0.GetProperty("targets");
            if (args.Length == 0)
            {
                return ShowUsage();
            }

            int argsUsed;
            List<string> searchArgs = new List<string> {"family"};
            searchArgs.AddRange(args);
            List<SimObject> PSO = WorldSystem.GetPrimitives(searchArgs.ToArray(), out argsUsed);
            List<Primitive> PS = new List<Primitive>();
            WorldSystem.AsPrimitives(PS,PSO);
            if (IsEmpty(PS)) return Failure("Cannot find objects from " + string.Join(" ", args));
            Primitive rootPim = PS[0];
            foreach (Primitive ps in PS)
            {
                if (ps.ParentID == 0)
                {
                    rootPim = ps;
                }
            }
            TheBotClient.InvokeGUI(() =>
                                    {
                                        frmPrimWorkshop pw = new frmPrimWorkshop(TheBotClient.TheRadegastInstance,
                                                                                 rootPim.LocalID);
                                       // pw.LoadPrims(PS);
                                       // pw.
                                        pw.Show();
                                    });
            return Success(Name + " on " + PS.Count);
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:33,代码来源:PrimWorkshopCommand.cs

示例5: ExecuteRequest

 public override CmdResult ExecuteRequest(CmdRequest args)
 {
     int argsUsed;
     SimPosition simObject = WorldSystem.GetVector(args.GetProperty("position"), out argsUsed);
     WriteLine("turnto {0}", simObject);
     WorldSystem.TheSimAvatar.TurnToward(simObject);
     return Success(WorldSystem.TheSimAvatar.DistanceVectorString(simObject));
 }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:8,代码来源:TurnToCommand.cs

示例6: ExecuteRequest

        /// <summary>
        /// Exectute the command
        /// </summary>
        /// <param name="args"></param>
        /// <param name="fromAgentID"></param>
        /// <returns></returns>
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 1)
            {
                return ShowUsage(); // " viewnote [notecard asset uuid]";
            }
            UUID note = UUID.Zero;
            int argsUsed;
            if (!UUIDTryParse(args.GetProperty("asset"), 0, out note, out argsUsed))
            {
                return Failure("First argument expected UUID.");
            }

            AutoResetEvent waitEvent = new AutoResetEvent(false);

            StringBuilder result = new StringBuilder();

            // verify asset is loaded in store
            if (Client.Inventory.Store.Contains(note))
            {
                // retrieve asset from store
                InventoryItem ii = (InventoryItem) Client.Inventory.Store[note];

                // make request for asset
                Client.Assets.RequestInventoryAsset(ii, true,
                                                    delegate(AssetDownload transfer, Asset asset)
                                                        {
                                                            if (transfer.Success)
                                                            {
                                                                result.AppendFormat(
                                                                    "Raw Notecard Data: " + Environment.NewLine + " {0}",
                                                                    Utils.BytesToString(asset.AssetData));
                                                                waitEvent.Set();
                                                            }
                                                        }
                    );

                // wait for reply or timeout
                if (!waitEvent.WaitOne(10000, false))
                {
                    result.Append("Timeout waiting for notecard to download.");
                }
            }
            else
            {
                result.Append("Cannot find asset in inventory store, use 'i' to populate store");
            }

            // return results
            return Success(result.ToString());
            ;
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:58,代码来源:ViewNotecardCommand.cs

示例7: 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

示例8: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            ICollection PS;
            if (args.Length == 0)
            {
                PS = WorldObjects.SimAvatars;
            }
            else
            {
                int argsUsed;
                PS = WorldSystem.GetPrimitives(args.GetProperty("targets"), out argsUsed);
                if (IsEmpty(PS)) return Failure("Cannot find objects from " + args.str);
            }
            AppendList("list", PS);
            SetResult("count", PS.Count);
            if (args.IsFFI) return SuccessOrFailure();

            foreach (SimObject O in PS)
            {
                Primitive foundAv = O.Prim;
                StringBuilder output = new StringBuilder();
                output.AppendLine();
                if (foundAv.Textures == null)
                {
                    output.AppendLine("No textures yet");
                }
                else
                {
                    for (int i = 0; i < foundAv.Textures.FaceTextures.Length; i++)
                    {
                        if (foundAv.Textures.FaceTextures[i] != null)
                        {
                            Primitive.TextureEntryFace face = foundAv.Textures.FaceTextures[i];
                            AvatarTextureIndex type = (AvatarTextureIndex) i;

                            output.AppendFormat("{0}: {1}", type, face.TextureID);
                            output.AppendLine();
                        }
                    }
                }
                AddSuccess(output.ToString());
            }
            return SuccessOrFailure();
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:44,代码来源:AvatarInfoCommand.cs

示例9: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            RadegastInstance instance = TheBotClient.TheRadegastInstance;

            foreach (var set in BeamInfos)
            {
                set.UnSetPointing();
            }
            BeamInfos.Clear();
            int used;
            if (args.Length == 0)
            {
                if (instance != null) instance.State.UnSetPointing();
                TheSimAvatar.SelectedBeam = !TheSimAvatar.SelectedBeam;
                return Success("SelectedBeam = " + TheSimAvatar.SelectedBeam);
            }
            var targets = args.GetProperty("targets");
            List<SimObject> PS = WorldSystem.GetPrimitives(targets, out used);
            GridClient grc = TheBotClient;
            if (PS.Count==0)
            {
                SimPosition pos = WorldSystem.GetVector(targets, out used);
                if (pos!=null)
                {
                    EffectBeamInfo info = new EffectBeamInfo(grc);
                    info.SetPointing(pos, 3);
                    BeamInfos.AddTo(info);
                    return Success(Name + " on " + pos);
                }
                return Failure(string.Format("Cant find {0}", string.Join(" ", args)));
            }
            foreach (var o in PS)
            {             
                EffectBeamInfo info = new EffectBeamInfo(grc);
                info.SetPointing(o, 3);
                BeamInfos.AddTo(info);
                Primitive p = o.Prim;
                if (p != null && instance != null) instance.State.SetPointing(p, 3);                
            }
            return Success(Name + " on " + PS.Count);
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:41,代码来源:PointAtCommand.cs

示例10: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest args0)
        {
            var args = args0.GetProperty("image");
            if (args.Length < 1) return ShowUsage();
            UUID AssetID = UUID.Zero;
            int argsUsed;

            if (!UUIDTryParse(args, 0, out AssetID, out argsUsed))
            {
                return Failure("Cant get asset from " + AssetID);
            }

            TheBotClient.InvokeGUI(() =>
                                    {
                                        var v = new SLImageHandler(TheBotClient.TheRadegastInstance, AssetID,
                                                                   AssetID.ToString()) {Dock = DockStyle.Fill};
                                        var f = new RadegastForm();
                                        f.Controls.Add(v);
                                        f.Show();
                                    });
            
            return Success("Done RequestAsset " + AssetID);
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:23,代码来源:ShowImageCommand.cs

示例11: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            int argsUsed;
            var keyargs = args.GetProperty("targets");
            ICollection<SimObject> objs = WorldSystem.GetPrimitives(keyargs, out argsUsed);
            bool rightNow = true;
            if (argsUsed == 0)
            {
                objs = (ICollection<SimObject>) WorldSystem.GetAllSimObjects();
                rightNow = false;
            }
            WriteLine("Meshing " + objs.Count);
            foreach (SimObject o2 in objs)
            {
                SimObjectPathFinding o = o2.PathFinding;
                o.IsWorthMeshing = true;
                if (rightNow)
                {
                    o.AddCollisionsNow();
                }
                else
                {
                    o.AddCollisions();
                }
            }
            if (rightNow)
            {
                SimRegion.BakeRegions();
            }
            else
            {
                Cogbot.WorldPathSystem.MeshingQueue.Enqueue(SimRegion.BakeRegions);
            }

            return TheBotClient.ExecuteCommand("meshinfo", args.CallerAgent, args.Output, args.CmdFlags);
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:36,代码来源:RemeshPrim.cs

示例12: ExecuteRequest

 public override CmdResult ExecuteRequest(CmdRequest args)
 {
     string verb = args.CmdName;
     acceptInput0(verb, args.GetProperty("objects"), WriteLine);
     return Success(verb + " complete");
 }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:6,代码来源:DescribeCommand.cs

示例13: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest args0)
        {
            var args = args0.GetProperty("position");
            if (args == null || args.Length == 0) args = new[] { "show" };
            if (PanelGUI == null)
            {
                if (Client.TheRadegastInstance == null)
                {
                    CogbotGUI.EnsureBotClientHasRadegast(Client);
                    int max = 40;
                    while (Client.TheRadegastInstance == null && max > 0)
                    {
                        max--;
                        Thread.Sleep(1000);
                    }
                    if (Client.TheRadegastInstance == null)
                    {
                        return Failure("Could not make client in timely manner");
                    }
                }
                PanelGUI = Client.TheRadegastInstance.MainForm;
                // (new Thread(() =>
                {
                    PanelGUI.Closing += new CancelEventHandler(delegate(object sender, CancelEventArgs e)
                    {
                        PanelGUI = null;
                    });
                    //Application.EnableVisualStyles();
                    ////PanelGUI.Invoke(new MethodInvoker(PanelGUI.Show));
                    //PanelGUI.BeginInvoke(new MethodInvoker(() =>
                    //                                           {
                    //                                               (new Thread(() => {
                    //                                               Application.Run(PanelGUI);
                    //                                               })).Start();
                    //                                           }));
                    //Application.Run(PanelGUI);
                }
                // )).Start();
            }
            string arg0 = args[0].ToLower();

            Control.CheckForIllegalCrossThreadCalls = false;

            switch (arg0)
            {
                case "show":
                    {
                        //(new Thread(() => {
                        BeginInvoke(new MethodInvoker(() =>
                        {
                            PanelGUI.Visible = true;
                            PanelGUI.Show();
                        }));
                        //PanelGUI.Show();
                        //})).Start();
                        return Success("radegast shown");
                    }
                case "hide":
                    {
                        if (!PanelGUI.IsHandleCreated) return Success("No handle to " + arg0);
                        BeginInvoke(new MethodInvoker(() =>
                        {
                            PanelGUI.Visible = false;
                        }));
                        return Success("radegast " + arg0);
                    }
                case "maximize":
                case "maximized":
                    {
                        if (!PanelGUI.IsHandleCreated) return Success("No handle to " + arg0);
                        BeginInvoke(new MethodInvoker(() =>
                        {
                            PanelGUI.WindowState = FormWindowState.Maximized;
                            PanelGUI.Visible = true;
                        }));
                        return Success("radegast " + arg0);
                    }
                case "tray":
                    {                        
                        if (!PanelGUI.IsHandleCreated) return Success("No handle to " + arg0);
                        TheBotClient.TheRadegastInstance.GlobalSettings["minimize_to_tray"] = new OSDBoolean(true);
                        BeginInvoke(new MethodInvoker(() =>
                        {
                            PanelGUI.WindowState = FormWindowState.Minimized;
                        }));
                        return Success("radegast " + arg0);
                    }
                case "minimize":
                case "minimized":
                    {
                        if (!PanelGUI.IsHandleCreated) return Success("No handle to " + arg0);
                        TheBotClient.TheRadegastInstance.GlobalSettings["minimize_to_tray"] = new OSDBoolean(false);
                        BeginInvoke(new MethodInvoker(() =>
                        {
                            PanelGUI.WindowState = FormWindowState.Minimized;
                        }));
                        return Success("radegast " + arg0);
                    }
                case "normal":
                    {
//.........这里部分代码省略.........
开发者ID:drzo,项目名称:opensim4opencog,代码行数:101,代码来源:RadegastCommand.cs

示例14: 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


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