Exemplo n.º 1
0
 public SimBot(BotClient Client)
 {
     if (!SimObjectImpl.AffordinancesGuessSimObjectTypes)
     {
         Client.DisplayNotificationInChat("SimBot: make sure you set SimObjectImpl:AffordinancesGuessSimObjectTypes = true;");
     }
 }
Exemplo n.º 2
0
 public IrcBotModule(BotClient parent)
     : base(parent)
 {
     IrcCommand = IrcCommand ?? new IrcCommand(client);
     if (client != null) client.RegisterCommand("irc", IrcCommand);
     //parent.Commands.Add();
 }
Exemplo n.º 3
0
 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);
 }
Exemplo n.º 4
0
 public DebugAllEvents(BotClient bc)
     : base(bc)
 {
   // the subclass must now run this
     if (this.GetType()==typeof(DebugAllEvents))
     RegisterAll();
 }
Exemplo n.º 5
0
 public AListener(BotClient _parent)
 {
     //botclient = _parent;
     client = _parent;//.CurrentClient;
     Dictionary<string, Listener> clientPlugins = client.Plugins;
     lock (clientPlugins) clientPlugins[this.GetModuleName()] = this;
 }
Exemplo n.º 6
0
 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);
 }
Exemplo n.º 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();
        }
Exemplo n.º 8
0
 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();
 }
Exemplo n.º 9
0
        //private InventoryManager Manager;

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

            // Callbacks

        }
Exemplo n.º 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);
 }
Exemplo n.º 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]);
        }
Exemplo n.º 12
0
 public Use(BotClient Client)
     : base(Client)
 {
 }
Exemplo n.º 13
0
 public BackupCommand(BotClient testClient)
     : base(testClient)
 {
     Name = "backuptext";
     TheBotClient = testClient;
 }
Exemplo n.º 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;
        }
Exemplo n.º 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));
 }
Exemplo n.º 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);                
     }
 }
Exemplo n.º 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.");
        }
Exemplo n.º 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);
                }
            }
        }
Exemplo n.º 19
0
        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())));
                                     });
        }
Exemplo n.º 20
0
 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);
 }
Exemplo n.º 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;
 }
Exemplo n.º 22
0
 public override void ResetPrim(Primitive prim, BotClient bc, Simulator sim)
 {
     //if (!ReferenceEquals(_Prim0,prim))
     //{
     //    Debug("AVATAR ResetPrim " + prim);
     //}
     base.ResetPrim(prim, bc, sim);
 }
Exemplo n.º 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");
 }
Exemplo n.º 24
0
 public ShowEffectsCommand(BotClient testClient)
     : base(testClient)
 {
     Name = "showeffects";
     TheBotClient = testClient;
 }
Exemplo n.º 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);
                }
            }
        }
Exemplo n.º 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));
        }
Exemplo n.º 27
0
 public DownloadScriptCommand(BotClient testClient)
 {
     Name = "Download Script";
 }
Exemplo n.º 28
0
 public PrimCountCommand(BotClient testClient)
 {
     Name = "primcount";
 }
Exemplo n.º 29
0
 public SimEventTextSubscriber(OutputDelegate _text, BotClient from)
 {
     From = from;
     textForm = _text;
     EventsEnabled = true;
 }
Exemplo n.º 30
0
 public SaleInfoCommand(BotClient client)
 {
     Name = "SaleInfo";
 }
Exemplo n.º 31
0
 public OrphanCommand(BotClient client)
 {
     Name = "orphans";
 }
Exemplo n.º 32
0
 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;
 }
Exemplo n.º 33
0
 public SimTypeCommand(BotClient Client)
 {
     Name = GetType().Name.ToLower().Replace("command", "");
 }
Exemplo n.º 34
0
        public ClassifierModuleMain(BotClient _parent)
            : base(_parent)
        {

        }