コード例 #1
0
ファイル: SimBot.cs プロジェクト: drzo/opensim4opencog
 public SimBot(BotClient Client)
 {
     if (!SimObjectImpl.AffordinancesGuessSimObjectTypes)
     {
         Client.DisplayNotificationInChat("SimBot: make sure you set SimObjectImpl:AffordinancesGuessSimObjectTypes = true;");
     }
 }
コード例 #2
0
ファイル: IrcBotModule.cs プロジェクト: drzo/opensim4opencog
 public IrcBotModule(BotClient parent)
     : base(parent)
 {
     IrcCommand = IrcCommand ?? new IrcCommand(client);
     if (client != null) client.RegisterCommand("irc", IrcCommand);
     //parent.Commands.Add();
 }
コード例 #3
0
ファイル: CogbotGUI.cs プロジェクト: drzo/opensim4opencog
 public static void EnsureBotClientHasRadegast(BotClient bc)
 {
     GridClient gridClient = bc.gridClient;
     RadegastInstance inst = bc.TheRadegastInstance;
     lock (ClientManager._wasFirstGridClientLock)
     {
         if (ClientManager._wasFirstGridClient)
         {
             ClientManager._wasFirstGridClient = false;
             if (ClientManagerConfig.UsingCogbotFromRadegast)
             {
                 inst = GlobalRadegastInstance;
             }
             if (inst != null)
             {
                 gridClient = inst.Client;
             }
         }
     }
     string name = "EnsureBotClientHasRadegast: " + bc.GetName();
     ClientManager.InSTAThread(() =>
                     {
                         EnsureRadegastForm(bc, bc.TheRadegastInstance, name);
                         //bc.TheRadegastInstance.MainForm.WindowState = FormWindowState.Minimized;
                     }, name);
 }
コード例 #4
0
 public DebugAllEvents(BotClient bc)
     : base(bc)
 {
   // the subclass must now run this
     if (this.GetType()==typeof(DebugAllEvents))
     RegisterAll();
 }
コード例 #5
0
ファイル: Listener.cs プロジェクト: drzo/opensim4opencog
 public AListener(BotClient _parent)
 {
     //botclient = _parent;
     client = _parent;//.CurrentClient;
     Dictionary<string, Listener> clientPlugins = client.Plugins;
     lock (clientPlugins) clientPlugins[this.GetModuleName()] = this;
 }
コード例 #6
0
ファイル: BotTcpServer.cs プロジェクト: drzo/opensim4opencog
 public SingleBotTcpClient(TcpClient this_client, BotTcpServer server)
 {
     tcp_client = this_client;
     Server = server;
     filter = new SimEventFilterSubscriber(this, false);
     // never recieve data updates
     filter.Never.Add(SimEventType.DATA_UPDATE.ToString());
     filter.Never.Add("On-Log-Message");
     botclient = server.parent;
     WriteLine("making SingleBotTcpClient " + this_client);
 }
コード例 #7
0
        public ScriptEventListener(ScriptInterpreter interp, BotClient client)
        {
            taskInterperter = interp;
            taskInterperter.Intern("Client", client);
            taskInterperter.Intern("thisClient", client);
            if (client != null) WorldSystem = client.WorldSystem;

            thrJobQueue = new Thread(jobManager);
            thrJobQueue.Name = string.Format("ScriptEventListener Thread for {0}", (client ?? (Object)"ClientManager"));
            thrJobQueue.Start();
        }
コード例 #8
0
ファイル: SimAssetStore.cs プロジェクト: drzo/opensim4opencog
 public SimAssetStore(BotClient GC)
 {
     TheStore = this;
     Client = GC;                       
     Manager = Client.Inventory;
     Manager.ItemReceived += Inventory_OnItemReceived;
     Manager.TaskItemReceived += Inventory_OnTaskItemReceived;
     Manager.FolderUpdated += Inventory_OnFolderUpdated;
     Inventory = Manager.Store;
     Client.Network.SimConnected += Ensure_Downloaded;
     SlowConnectedQueue.DebugQueue = true;
     FillAssetNames();
 }
コード例 #9
0
        //private InventoryManager Manager;

        public BotInventoryEval(BotClient _c)
        {
            client = _c;
            if (Inventory != null)
            {
                Init1();
            }
            else
            {
                client.WorldSystem.OnConnectedQueue.Enqueue(Init1);
            }

            // Callbacks

        }
コード例 #10
0
 public CycWorldModule(BotClient _parent)
     : base(_parent)
 {
     CycInterpreter newCycInterpreter = new CycInterpreter();
     MushDLR223.ScriptEngines.ScriptManager.AddInterpreter(newCycInterpreter);
     newCycInterpreter.Self = _parent;
     client = _parent;
     bool startIt = false;
     lock (oneInstanceLock)
         if (CycModule == null)
         {
             CycModule = this;
             startIt = true;
         }
         else
         {
             DLRConsole.DebugWriteLine("\n\n\nStaring more than one CycModule?!");
         }
     if (startIt) InitInstance();// InvokeGUI(InitInstance);
 }
コード例 #11
0
        public string CreateTask(string id, ThreadStart task, string debugName0, bool createFresh, bool kill, EventWaitHandle mre, OutputDelegate WriteLine)
        {
            BotClient TheBotClient = this;

            string[]    debugName = new[] { debugName0 };
            ThreadStart thread    =
                () =>
            {
                try
                {
                    try
                    {
                        task();
                    }
                    catch (ThreadAbortException e)
                    {
                        WriteLine("Aborting " + debugName[0]);
                    }
                    catch (Exception e)
                    {
                        WriteLine("Problem with {0} {1}", debugName[0], e);
                    }
                }
                finally
                {
                    try
                    {
                        if (mre != null)
                        {
                            mre.Set();
                        }
                        if (createFresh)
                        {
                            TheBotClient.RemoveThread(Thread.CurrentThread);
                        }
                    }
                    catch (OutOfMemoryException)
                    {
                    }
                    catch (StackOverflowException)
                    {
                    }
                    catch (Exception)
                    {
                    }
                    WriteLine("done with " + debugName[0]);
                }
            };
            String threadName = id;

            if (createFresh)
            {
                TheBotClient.InvokeThread(threadName, thread);
            }
            else
            {
                Abortable tq = TheBotClient.GetTaskQueueHandler(id, true);
                if (kill)
                {
                    tq.Abort();
                    tq.Resume();
                }
                if (task != null)
                {
                    tq.Enqueue(thread);
                }
                debugName[0] += tq;
            }
            return(debugName[0]);
        }
コード例 #12
0
 public Use(BotClient Client)
     : base(Client)
 {
 }
コード例 #13
0
ファイル: BackupCommand.cs プロジェクト: drzo/opensim4opencog
 public BackupCommand(BotClient testClient)
     : base(testClient)
 {
     Name = "backuptext";
     TheBotClient = testClient;
 }
コード例 #14
0
        public static bool checkPerms(BotClient Client, SimObject exportPrim, OutputDelegate Failure, bool mustModify)
        {
            if (exportPrim != null)
            {

                var Properties = exportPrim.Properties;
                if (Properties == null)
                {
                    Client.Objects.RequestObjectPropertiesFamily(exportPrim.GetSimulator(), exportPrim.ID, true);
                    Failure("No props yet for " + named(exportPrim));
                    return false;
                }
                // Check for export permission first
                //GotPermissions = false;
                //
                //if (!GotPermissions)
                // {
                //   Properties = exportPrim.Properties ?? new Primitive.ObjectProperties();
                //}
                //   GotPermissionsEvent.WaitOne(1000 * 10, false);
                if (Properties.OwnerID != Client.Self.AgentID &&
                    Properties.OwnerID != Client.MasterKey &&
                    Properties.GroupID != Client.Self.ActiveGroup)
                {
                    Failure("That object is owned by " + Properties.OwnerID + ", we don't have permission " +
                            "to export " + named(exportPrim));
                }

                SimAvatarClient theAvatar = Client.TheSimAvatar;
                PermissionWho pw = theAvatar.EffectivePermissionWho(exportPrim);
                PermissionMask pm = theAvatar.EffectivePermissionsMask(exportPrim);

                bool modify = Permissions.HasPermissions(pm, PermissionMask.Modify);

                bool cmt = Permissions.HasPermissions(pm, PermissionMask.Copy) ||
                           Permissions.HasPermissions(pm, PermissionMask.Modify) ||
                           Permissions.HasPermissions(pm, PermissionMask.Transfer);

                if (mustModify)
                {
                    if (!modify)
                    {
                        Failure("ObjPerms NOMODIFY " + pm + " for " + pw + " on " + named(exportPrim));
                        return false;
                    }
                }
                if (!cmt)
                {
                    Failure("ObjPerms " + pm + " for " + pw + " on " + named(exportPrim));
                    return false;
                }

                //List<SimObject> family = new List<SimObject>();
                //family.Add(exportPrim);
                //family.AddRange(exportPrim.Children);

                /*bool complete = RequestObjectProperties(family, 250, exportPrim.GetSimulator());
                exportedPrims.AddRange(family);

                if (!complete)
                {
                    Logger.Log("Warning: Unable to retrieve full properties for:", Helpers.LogLevel.Warning, Client);
                    foreach (UUID uuid in PrimsWaiting.Keys)
                        Logger.Log(uuid.ToString(), Helpers.LogLevel.Warning, Client);
                }
                 * return true;*/
            }
            return true;
        }
コード例 #15
0
 void SaveLinksetInfo(BotClient Client, string pathStem, SimObject exportPrim, OutputDelegate Failure, ImportSettings settings)
 {
     string exportFile = pathStem + ".link";
     if (Incremental || true) lock (fileWriterLock) if (File.Exists(exportFile)) return;
     if (false && exportPrim.Children.Count == 0)
     {
         // so we dont do it again
         if (Incremental) lock (fileWriterLock) File.WriteAllText(exportFile, "");
         return;
     }
     if (Incremental || showsMissingOnly) lock (fileWriterLock) if (File.Exists(exportFile)) return;
     needFiles++;
     if (showsMissingOnly)
     {
         Failure("NEED LINK for " + named(exportPrim));
         return;
     }
     SlowlyDo(() => RequestLinksetInfo(Client, pathStem, exportPrim, Failure, settings));
 }
コード例 #16
0
 public bool ExportPrim(BotClient Client, SimObject exportPrim, OutputDelegate Failure, ImportSettings settings)
 {
     uint localID = exportPrim.LocalID;
     WorldObjects.EnsureRequested(localID + 1, settings.CurSim);
     try
     {
         Client.Objects.SelectObject(settings.CurSim, localID);
         WorldObjects.EnsureRequested(localID, settings.CurSim);
         return ExportPrim0(Client, exportPrim, Failure, settings);
     }
     finally
     {
         Client.Objects.DeselectObject(settings.CurSim, localID);                
     }
 }
コード例 #17
0
        void InformMaster(string masterName)
        {
            UUID             resolvedMasterKey = UUID.Zero;
            ManualResetEvent keyResolution     = new ManualResetEvent(false);
            UUID             query             = UUID.Zero;
            BotClient        Client            = client;
            UUID             masterUUID        = UUID.Zero;

            if (UUID.TryParse(masterName, out masterUUID))
            {
                Client.MasterKey = masterUUID;
                if (String.IsNullOrEmpty(Client.MasterName))
                {
                    Client.MasterName = GetUserName(masterUUID);
                }
                Client.Self.InstantMessage(
                    Client.MasterKey, "You are now my master.  IM me with \"help\" for a command list.");
                WriteLine("Set master UUID with name = " + Client.MasterName);
            }
            masterUUID = GetUserID(masterName);
            //if (String.IsNullOrEmpty(Client.MasterName))
            Client.MasterName = masterName;
            if (masterUUID != UUID.Zero)
            {
                Client.MasterName = masterName;
                Client.MasterKey  = masterUUID;
                Client.Self.InstantMessage(
                    Client.MasterKey, "You are now my master.  IM me with \"help\" for a command list.");

                WriteLine("Set master UUID with name = " + Client.MasterName);
            }

            EventHandler <DirPeopleReplyEventArgs> callback = delegate(object sender, DirPeopleReplyEventArgs e)
            {
                if (query != e.QueryID)
                {
                    return;
                }

                resolvedMasterKey = e.MatchedPeople[0].AgentID;
                keyResolution.Set();
                query = UUID.Zero;
            };

            Client.Directory.DirPeopleReply += callback;

            query = Client.Directory.StartPeopleSearch(masterName, 0);

            if (keyResolution.WaitOne(TimeSpan.FromMinutes(1), false))
            {
                Client.MasterKey  = resolvedMasterKey;
                Client.MasterName = masterName;
                keyResolution.Reset();
                Client.Directory.DirPeopleReply -= callback;
            }
            else
            {
                keyResolution.Reset();
                Client.Directory.DirPeopleReply -= callback;
                WriteLine("Unable to obtain UUID for \"" + masterName + "\". Master unchanged.");
                return;
            }

            // Send an Online-only IM to the new master
            Client.Self.InstantMessage(
                Client.MasterKey, "You are now my master.  IM me with \"help\" for a command list.");
        }
コード例 #18
0
        static public void SetRadegastLoginOptionsFromCogbot(RadegastInstance instance, BotClient TheBot)
        {
            if (instance == null)
            {
                return;
            }
            var BotLoginParams = TheBot.BotLoginParams;

            EnsureRadegastForm(TheBot, instance, "EnsureRadegastForm from SetRadegastLoginOptions " + TheBot.GetName());
            var to = instance.Netcom.LoginOptions;

            to.FirstName = BotLoginParams.FirstName;
            to.LastName  = BotLoginParams.LastName;
            to.Password  = BotLoginParams.Password;
            string loginURI = BotLoginParams.URI;

            MainProgram.CommandLine.LoginUri = loginURI;
            MainProgram.CommandLine.Location = BotLoginParams.Start;
            int  gidx;
            Grid G = GetGridIndex(instance, loginURI, out gidx);

            if (G == null)
            {
                G = new Grid(BotLoginParams.URI, BotLoginParams.URI, loginURI);
                to.GridCustomLoginUri = loginURI;
            }
            else
            {
                BotLoginParams.URI = G.LoginURI;
            }
            instance.Netcom.LoginOptions.Grid = G;
            to.Grid = G;
            string botStartAt = BotLoginParams.Start;

            if (botStartAt == "home")
            {
                to.StartLocation = StartLocationType.Home;
            }
            else if (botStartAt == "last")
            {
                to.StartLocation = StartLocationType.Last;
            }
            else
            {
                to.StartLocation       = StartLocationType.Custom;
                to.StartLocationCustom = botStartAt;
            }
            to.Version = BotLoginParams.Version;
            to.Channel = BotLoginParams.Channel;
            RadegastTab tab;

            if (instance.TabConsole.Tabs.TryGetValue("login", out tab))
            {
                tab.AllowDetach = true;
                tab.AllowClose  = false;
                tab.AllowMerge  = false;
                tab.AllowHide   = false;
                LoginConsole form = (LoginConsole)tab.Control;
                try
                {
                    if (form.IsDisposed)
                    {
                        return;
                    }
                    DLRConsole.InvokeControl((Control)instance.MainForm, (MethodInvoker)(() => SetRadegastLoginForm(instance, form, to)));
                }
                catch (Exception e)
                {
                    TheBot.LogException("Set Radegast Login Form", e);
                }
            }
        }
コード例 #19
0
ファイル: ClientManager.cs プロジェクト: drzo/opensim4opencog
        internal void MakeRunning(BotClient bc)
        {
            lock (MakeRunningLock)
            {
                if (bc.RanMakeRunning) return;
                bc.RanMakeRunning = true;
            }
            ThreadStart invoker0 = () => EnsureMakeRunning(bc);

            PostAutoExecEnqueue(() =>
                                     {
                                         if (ClientManagerConfig.ShowRadegast)
                                         {
                                             CogbotGUI.SetRadegastLoginOptionsFromCogbot(bc.TheRadegastInstance, bc);
                                         }
                                         // in-case someoine hits the login button
                                         bc.Network.LoginProgress += (s, e) =>
                                                                         {
                                                                             if (e.Status == LoginStatus.Success)
                                                                             {
                                                                                 PostAutoExec.Enqueue((() => InSTAThread(invoker0, "LoginProgress: " + bc.GetName())));
                                                                             }
                                                                         };
                                         PostAutoExecEnqueue((() => InSTAThread(invoker0, "StartupClientLisp: " + bc.GetName())));
                                     });
        }
コード例 #20
0
ファイル: ClientManager.cs プロジェクト: drzo/opensim4opencog
 private void AddTypesToBotClient(BotClient bc)
 {
     lock (InvokedMakeRunningLock)
     {
         if (bc.AddingTypesToBotClientNow) return;
         bc.AddingTypesToBotClientNow = true;
     }
     //lock (OneAtATime)
     ThreadStart mi = () =>
                          {
                              List<Type> rt = new List<Type>();
                              lock (registrationTypes)
                              {
                                  rt.AddRange(registrationTypes);
                              }
                              foreach (Type t in rt)
                              {
                                  bc.RegisterType(t);
                              }
                              lock (InvokedMakeRunningLock)
                              {
                                  bc.AddingTypesToBotClientNow = false;
                              }
                          };
     InSTAThread(mi, "AddTypesToBotClient: " + bc);
 }
コード例 #21
0
 internal bool ExportPrim0(BotClient Client, SimObject exportPrim, OutputDelegate Failure, ImportSettings settings)
 {
     if (IsSkipped(exportPrim, settings)) return false;
     Simulator CurSim = exportPrim.GetSimulator();
     //settings.CurSim = CurSim;
     WorldObjects.EnsureSelected(exportPrim.LocalID, CurSim);
     string pathStem = Path.Combine(dumpDir, exportPrim.ID.ToString());
     if (settings.Contains("task") || showsMissingOnly)
     {
         exportPrim.StartGetTaskInventory();
     }
     if (settings.Contains("wait"))
     {
         var waitUntil = DateTime.Now.AddSeconds(10);
         bool needsLoop = true;
         while (needsLoop && waitUntil > DateTime.Now)
         {
             needsLoop = false;
             if (exportPrim.Properties == null || CogbotHelpers.IsNullOrZero(exportPrim.Properties.OwnerID))
             {
                 needsLoop = true;
             }
             if (settings.Contains("task"))
             {
                 var ti = exportPrim.TaskInventory;
                 if (ti == null)
                 {
                     needsLoop = true;
                 }
             }
         }
         if (needsLoop)
         {
             Success("needs loop " + named(exportPrim));
             string bissues = exportPrim.MissingData;
             if (!string.IsNullOrEmpty(bissues) && !settings.Allows(bissues ,exportPrim))
             {
                 Failure("Cant wait out the Issues " + bissues + ": " + named(exportPrim));
                 if (LocalFailures == 0) LocalFailures++;
               //  return;
             }
         }
     }
     string issues = exportPrim.MissingData;           
     if (!string.IsNullOrEmpty(issues) && !settings.Allows(issues, exportPrim))
     {
         Failure("Issues " + issues + " " + named(exportPrim));
         if (LocalFailures == 0) LocalFailures++;
         //return false;
     }
     //ImportCommand.PrimToCreate ptc = ImportCommand.Running.APrimToCreate(exportPrim.ID);
     //ptc._prim = exportPrim.Prim;
     bool passedOK = true;
     if (settings.Contains("llsd"))
     {
         SaveLLSD(Client, pathStem, exportPrim, Failure, settings);
     }
     if (exportPrim.IsRoot && (true || exportPrim.Children.Count > 0))
     {
         if (settings.Contains("link")) SaveLinksetInfo(Client, pathStem, exportPrim, Failure, settings);
         string exportFile = pathStem + ".link";
         //lock (fileWriterLock) if (File.Exists(exportFile))
         {
             foreach (var c in exportPrim.Children)
             {
                 var ch = ExportPrim(Client, c, Failure, settings);
                 if (!ch) passedOK = false;
             }
         }
     }
     if (settings.Contains("task"))
     {
         if (!SaveTaskInv(settings, Client, pathStem, exportPrim, Failure)) passedOK = false;
         // ImportCommand.PrimToCreate ptc = ImportCommand.Running.APrimToCreate(exportPrim.ID);
         //  if (!ptc.EnsureTaskInv()) return false;
     }
     if (!settings.Contains("dep")) return passedOK;
     AddRelatedTextures(exportPrim);
     SaveRelatedAssets(pathStem, exportPrim, Failure);
     return passedOK;
 }
コード例 #22
0
ファイル: SimAvatar.cs プロジェクト: drzo/opensim4opencog
 public override void ResetPrim(Primitive prim, BotClient bc, Simulator sim)
 {
     //if (!ReferenceEquals(_Prim0,prim))
     //{
     //    Debug("AVATAR ResetPrim " + prim);
     //}
     base.ResetPrim(prim, bc, sim);
 }
コード例 #23
0
 public void RequestLinksetInfo(BotClient Client, string pathStem, SimObject exportPrim, OutputDelegate Failure, ImportSettings settings)
 {
     string exportFile = pathStem + ".link";
     lock (fileWriterLock) if (File.Exists(exportFile)) return;
     bool canScript = checkPerms(Client, exportPrim, SilientFailure, true);
     InventoryItem found = GetInvItem(Client, "LinksetSpeaker");
     if (!canScript || found == null)
     {
         ScanForLinksets(exportPrim);
         return;
     }
     lock (PrimWaitingLinkset)
     {
         if (PrimWaitingLinkset.ContainsKey(exportPrim.ID)) return;
         PrimWaitingLinkset.Add(exportPrim.ID, new LinkSetBuffer {S = "", O = exportPrim, F = pathStem});
     }
     PutItemToTaskInv(Client,exportPrim.LocalID, exportPrim, "LinksetSpeaker");
 }
コード例 #24
0
 public ShowEffectsCommand(BotClient testClient)
     : base(testClient)
 {
     Name = "showeffects";
     TheBotClient = testClient;
 }
コード例 #25
0
        public void SaveLLSD(BotClient Client, string pathStem, SimObject exportPrim, OutputDelegate Failure, ImportSettings settings)
        {
            if (exportPrim != null)
            {
                string exportFile = pathStem + ".llsd";
                if (Incremental || showsMissingOnly) lock (fileWriterLock) if (File.Exists(exportFile)) return;
                needFiles++;
                if (showsMissingOnly)
                {
                    Failure("NEED LLSD for " + named(exportPrim));
                    AddMoveTo(exportPrim.SimPosition);
                    return;
                }

                try
                {
                    List<string> skipTag = new List<string>() { "Tag" };
                    Primitive prim = exportPrim.Prim;

                    Vector3 pp = prim.Position;
                    Quaternion pr = prim.Rotation;
                    //prim = prim.Clone(); 
                    OSDMap primOSD = (OSDMap) prim.GetOSD();
                    if (prim.ParentID != 0)
                    {
                        var parent = WorldSystem.GetLibOMVHostedPrim(prim.ParentID, settings.CurSim, false);
                        if (parent == null)
                        {
                            pp += new Vector3(128, 128, Client.Self.SimPosition.Z + 20);
                            Failure("YET FAILED: Cant GET parent of " + prim);
                            return;
                        }
                        else
                        {
                            pp = prim.Position * Matrix4.CreateFromQuaternion(parent.Rotation) + parent.Position;
                            pr = parent.Rotation * pr;
                            primOSD["ParentUUID"] = parent.ID;
                        }
                    }
                    primOSD["RegionPosition"] = pp;
                    primOSD["RegionRotation"] = pr;
                    if (exportPrim.PathFinding.MadeNonPhysical)
                    {
                        primOSD["physical"] = true;
                        primOSD["use_physics"] = true;
                    }
                    if (exportPrim.PathFinding.MadeNonTemp)
                    {
                        primOSD["temporary"] = true;
                    }
                    AddExportUser(primOSD["CreatorID"]);
                    AddExportGroup(primOSD["GroupID"]);
                    AddExportUser(primOSD["OwnerID"]);
                    AddExportUser(primOSD["LastOwnerID"]);
                    string output = OSDParser.SerializeLLSDXmlString(primOSD);
                    {
                        lock (fileWriterLock) File.WriteAllText(exportFile, output);
                    }
                    var ptc = Importing.APrimToCreate(prim);
                    ptc.Rezed = exportPrim;
                   
                    if (forced && !verbosely) return;
                    return;
                    Primitive prim2 = FromFile(exportFile, ExportCommand.UseBinarySerialization) as Primitive;
                    string memberwiseCompare = MemberwiseCompare(prim, prim2, skipTag);
                    if (!string.IsNullOrEmpty(memberwiseCompare))
                    {
                        string failre = "Error in LLSD: " + memberwiseCompare;
                        Failure(failre);
                        if (!forced)
                        {
                            File.Delete(exportFile);
                            return;
                            Error(failre);
                        }
                    }
                }
                catch (Exception e)
                {
                    File.Delete(exportFile);
                    Failure("Writing file " + exportFile + " caused " + e);
                }
            }
        }
コード例 #26
0
        static public CmdResult DoCmdAct(Command command, Func <CmdResult> task, CmdRequest req, string debugStr, CMDFLAGS flags)
        {
            BotClient robot           = command._mClient;
            string    sync            = command.TaskQueueNameOrNull;
            bool      needResult      = (flags & CMDFLAGS.ForceResult) != 0;
            bool      isConsole       = (flags & CMDFLAGS.IsConsole) != 0;
            bool      forceAsync      = (flags & CMDFLAGS.ForceAsync) != 0;
            bool      forceCompletion = (flags & CMDFLAGS.ForceCompletion) != 0;
            bool      inherit         = (flags & CMDFLAGS.Inherit) != 0;
            bool      scriptMode      = robot != null && robot.InScriptMode;
            bool      cmdRequestsSync = command.ImpliesSync;
            bool      invokeJoin      = scriptMode || cmdRequestsSync;

            if (needResult)
            {
                invokeJoin = true;
            }
            if (forceCompletion)
            {
                forceAsync = false;
            }
            if (forceAsync)
            {
                sync       = null;
                needResult = false;
                invokeJoin = false;
            }
            if (invokeJoin)
            {
                if (!needResult)
                {
                }
                else
                {
                    if (robot != null)
                    {
                        robot.InvokeJoin(debugStr);
                    }
                }
            }
            req.CmdFlags |= flags;
            if (sync != null)
            {
                CmdResult[]      res = new CmdResult[1];
                ManualResetEvent mre = new ManualResetEvent(false);
                Abortable        tq  = null;
                if (robot == null)
                {
                    tq = Cogbot.ClientManager.OneAtATimeQueue;
                }
                else
                {
                    tq = robot.GetTaskQueueHandler(sync, true);
                }
                tq.Enqueue(() =>
                {
                    try
                    {
                        res[0] = task();
                    }
                    finally
                    {
                        if (needResult)
                        {
                            mre.Set();
                        }
                    }
                });
                if (needResult)
                {
                    mre.WaitOne();
                }
                return(res[0]);
            }
            else
            {
                return(task());
            }
            //robot.OneAtATimeQueue.Enqueue(cmdStr, () => command.acceptInputWrapper(verb, args, callerID, del));
        }
コード例 #27
0
 public DownloadScriptCommand(BotClient testClient)
 {
     Name = "Download Script";
 }
コード例 #28
0
 public PrimCountCommand(BotClient testClient)
 {
     Name = "primcount";
 }
コード例 #29
0
 public SimEventTextSubscriber(OutputDelegate _text, BotClient from)
 {
     From = from;
     textForm = _text;
     EventsEnabled = true;
 }
コード例 #30
0
 public SaleInfoCommand(BotClient client)
 {
     Name = "SaleInfo";
 }
コード例 #31
0
ファイル: OrphanCommand.cs プロジェクト: drzo/opensim4opencog
 public OrphanCommand(BotClient client)
 {
     Name = "orphans";
 }
コード例 #32
0
ファイル: ImportCommand.cs プロジェクト: drzo/opensim4opencog
 public ImportCommand(BotClient testClient)
     : base(testClient)
 {
     Name = "simimport";
     Description = "Import prims from an exported xml file. Usage: import inputfile.xml [usegroup]";
     Category = CommandCategory.Objects;
     Client.Assets.AssetUploaded += new EventHandler<AssetUploadEventArgs>(Assets_AssetUploaded);
     Client.Objects.ObjectPropertiesFamily += OnObjectPropertiesFamily;
     Client.Objects.ObjectUpdate += OnObjectPropertiesNewesh;
     Client.Objects.ObjectProperties += OnObjectPropertiesNewesh1;
     Client.Network.EventQueueRunning += logged_in;
     ImportPTCFiles(new ImportSettings(), true, false);
     Importing = this;
 }
コード例 #33
0
 public SimTypeCommand(BotClient Client)
 {
     Name = GetType().Name.ToLower().Replace("command", "");
 }
コード例 #34
0
        public ClassifierModuleMain(BotClient _parent)
            : base(_parent)
        {

        }