Example #1
0
        /// <summary>
        /// Create a new AW instance node, by connecting to a universe.
        /// </summary>
        /// <param name="loginProperties">The login properties.</param>
        /// <param name="node">The node.</param>
        /// <returns></returns>
        public static AW.Instance Connect(UniverseConnectionProperties loginProperties, bool isLbsNode)
        {
            //if (isLbsNode)
            //    return new Instance();

            ParameterizedConnectThread param;

            try
            {
                long _tickStart = DateTime.Now.Ticks;
                var  t          = new Thread(ConnectThread);
                param = new ParameterizedConnectThread()
                {
                    LoginProperties = loginProperties
                };
                t.Start(param);
                var sw = new Stopwatch();
                sw.Start();
                while (param.AwInstance == null)
                {
                    if (sw.ElapsedMilliseconds > loginProperties.ConnectionTimeOut)
                    {
                        t.Abort();
                        throw new NetworkException("Universe connection timed out.");
                    }
                    Thread.Sleep(10);
                }
            }
            catch (InstanceException ex)
            {
                throw new AwException(ex.ErrorCode);
            }
            return(param.AwInstance);
        }
Example #2
0
        public Mdi()
        {
            InitializeComponent();
            // showRightToLeft.Checked = (RightToLeft == RightToLeft.Yes);
            // RightToLeftLayout = showRightToLeft.Checked;
            // m_solutionExplorer = new DummySolutionExplorer();
            m_propertiesToolWindow      = new PropertiesToolWindow();
            dockPanel.DocumentStyle     = DocumentStyle.DockingWindow;
            m_propertiesToolWindow.Dock = DockStyle.Right;
            m_projectToolWindow.Dock    = DockStyle.Right;
            string configFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "DockPanel.config");

            m_deserializeDockContent             = new DeserializeDockContent(GetContentFromPersistString);
            m_projectToolWindow.PropertiesWindow = m_propertiesToolWindow;
            var engine = new BotEngine()
            {
                IdentifyableDisplayName = "Masterbot", IdentifyableId = Guid.NewGuid()
            };
            var connection = new UniverseConnectionProperties()
            {
                LoginName = "awmanaged", World = "zebrakey", IdentifyableId = Guid.NewGuid()
            };

            connection.IdentifyableDisplayName = connection.LoginName + "@" + connection.World;
            m_projectToolWindow.AddRoot(engine);
            m_projectToolWindow.AddChild(engine, connection);

            var pluginFolder = new FolderNode("Plugins");

            m_projectToolWindow.AddChild(connection, pluginFolder);
            m_projectToolWindow.AddChild(connection, new FolderNode("Scene"));

            //List<Vector3> cells = new List<Vector3>();
            var cellFolders = new List <CellFolder>();

            for (int i = 0; i < 5000; i++)
            {
                var m = new Model(i, i, DateTime.Now, ObjectType.V3, "rwx01", new Vector3(i * 10, i * 10, i * 10), new Vector3(i * 10, i * 10, i * 10),
                                  "description for " + i, "action for " + i)
                {
                    IdentifyableId = Guid.NewGuid()
                };

                var cellFolder = cellFolders.Find(p => p.Cell.x == m.Cell.x && p.Cell.z == m.Cell.z);
                // check if the cell folder exists: m.Cell
                if (cellFolder == null)
                {
                    var newCellFolder = new CellFolder(m.Cell);
                    cellFolders.Add(newCellFolder);
                    m_projectToolWindow.AddChild(pluginFolder, newCellFolder.FolderNode);
                    m_projectToolWindow.AddChild(newCellFolder.FolderNode, m);
                }
                else
                {
                    m_projectToolWindow.AddChild(cellFolder.FolderNode, m);
                }
            }
        }
Example #3
0
        public void TreeNodeTest()
        {
            var connection = new UniverseConnectionProperties()
            {
                World = "zebrakey"
            };

            connection.IdentifyableDisplayName = connection.World;
            var tree = new Tree();

            tree.Root.Children.Add(connection);
        }
Example #4
0
        public static void Login(Instance aw, UniverseConnectionProperties loginProperties, bool isLbsNode)
        {
            //if (isLbsNode)
            //    return;
            aw.SetString(Attributes.LoginName, loginProperties.LoginName);
            aw.SetString(Attributes.LoginPrivilegePassword, loginProperties.PrivilegePassword);
            aw.SetInt(Attributes.LoginOwner, loginProperties.Owner);
            var rc = aw.Login();

            if (rc != 0)
            {
                throw new AwException(rc);
            }
        }
Example #5
0
        public BotNode(UniverseConnectionProperties connection, int node)
        {
            Node                  = node;
            Connection            = connection.Clone();
            Connection.LoginName += node;

            var awsdk    = new FileInfo("awtemp.dll");
            var awnetsdk = new FileInfo("aw.core.dll");

            awsdk.Directory.CreateSubdirectory("node" + node);
            awsdk.CopyTo("node" + node + "\\aw.dll", true);
            awnetsdk.CopyTo("node" + node + "\\aw.core.dll", true);

            _awsdk    = new FileInfo("node" + node + "\\aw.dll");
            _awnetsdk = new FileInfo("node" + node + "\\aw.core.dll");
        }
Example #6
0
 public EventBotLoggedInArgs(ICloneableT <UniverseConnectionProperties> connectionProperties, int node)
 {
     _node = node;
     ConnectionProperties = connectionProperties.Clone();
 }
 public EventBotSlaveStartedArgs(ICloneableT <UniverseConnectionProperties> connectionProperties, int node)
 {
     _node = node;
     ConnectionProperties = connectionProperties.Clone();
 }
Example #8
0
        public static void Main(string[] args)
        {
            Console.BackgroundColor = ConsoleColor.Black;
            System.Console.Clear();
            System.Console.CursorSize   = 100;
            System.Console.WindowWidth  = 120;
            System.Console.WindowHeight = 48;
            System.Console.BufferHeight = 48;
            System.Console.Clear();

            WINDOWPLACEMENT wp = new WINDOWPLACEMENT();

            IntPtr hMenu       = Process.GetCurrentProcess().MainWindowHandle;
            IntPtr hSystemMenu = GetSystemMenu(hMenu, false);

            ShowWindow(hMenu, SW_SHOWMAXIMIZED);
            EnableMenuItem(hSystemMenu, SC_RESTORE, MF_GRAYED);
            RemoveMenu(hSystemMenu, SC_RESTORE, MF_BYCOMMAND);
            EnableMenuItem(hSystemMenu, SC_CLOSE, MF_GRAYED);
            RemoveMenu(hSystemMenu, SC_CLOSE, MF_BYCOMMAND);

            wp.length = Marshal.SizeOf(wp);
            GetWindowPlacement(hMenu, ref wp);
            wp.ptMaxPosition.X = 10;
            wp.ptMaxPosition.Y = 20;
            SetWindowPlacement(hMenu, ref wp);


            if (!HasUniverseConnection())
            {
                UniverseConnectionProperties prop = new UniverseConnectionProperties();
                System.Console.WriteLine("Please enter your universe server information:");
                prop.Domain            = GetMandatoryInformation("Universe Server Hostname >");
                prop.Port              = GetMandatoryInformationInt("Universe Server Port >");
                prop.Owner             = GetMandatoryInformationInt("Privilege Citizen Number >");
                prop.PrivilegePassword = GetMandatoryInformation("Privilege Password >");
                prop.World             = GetMandatoryInformation("Enter World >");

                string conf =
                    string.Format(
                        "provider=aw;domain={0};port={1};login owner={2};privilege password={3};login name=awmanaged;world={4};position=0,0,0;rotation=0,0,0",
                        prop.Domain, prop.Port, prop.Owner, prop.PrivilegePassword, prop.World);
                WriteAppSetting("UniverseConnection", conf);
            }


            if (IsIconic(hMenu))
            {
                ShowWindow(hMenu, SW_RESTORE);
            }
            SetForegroundWindow(hMenu);

            if (args != null && args.Length > 0)
            {
                if (args[0] == "/autoboot")
                {
                    var bot = new ServerConsole();
                }
                else
                {
                    Console.GetPromptTarget  = GetPrompt;
                    Console.ParseCommandLine = ProcessCommandLine;
                    Console.WriteLine("Bot operating system.");
                    Console.ReadLine();
                }
            }
            else
            {
                //GetWindowPlacement(hMenu, ref wp);
                Console.GetPromptTarget  = GetPrompt;
                Console.ParseCommandLine = ProcessCommandLine;
                Console.WriteLine("Bot operating system.");
                Console.ReadLine();
            }

            //// TODO: update this with your own privileges.
            //var bot = new BotEngineExample();
            //var buildStats = new List<BuildStat>();


            //var sn1 = bot.SceneNodes;
            //var sn2 = bot.SceneNodes;

            //var model1 = sn1.Models[0];
            //var model2 = sn2.Models[0];

            //model1.Action = "sdkfjdlfjsdklfdjldkfjs";
            //model2.Action = " dslkfjfkasdfjaklsdfjlksfj";

            //var diff = Differential.Properties(model1,model2);

            //foreach (var model in bot.SceneNodes.Models)
            //{
            //    var buildStat = buildStats.Find(p => p.Avatar.Citizen == model.Owner);
            //    if (buildStat == null)
            //    {
            //        buildStat = new BuildStat(new Avatar() {Citizen = model.Owner}, 0);
            //        buildStats.Add(buildStat);
            //    }
            //    buildStat.ObjectCount++;
            //}
            //buildStats.Sort((p1, p2) => p2.ObjectCount.CompareTo(p1.ObjectCount));
            ////Console.WriteLine("VRT: " + bot.VrtTime());
            //Console.Read();
        }
 public EventBotEntersWorldArgs(ICloneableT <UniverseConnectionProperties> connectionProperties)
 {
     ConnectionProperties = connectionProperties.Clone();
 }