Ejemplo n.º 1
0
        public IEnumerable <string> RecieveStrings()
        {
            string response;

            while (true)
            {
                // read the next string from the console
                console.ReceiveSocketLine(consoleConnection, out response);

                // this response signifies that there's no more data
                if (response == ".")
                {
                    break;
                }

                yield return(response);
            }
        }
        public XboxDevConsole(string name)
        {
            console = xboxManager.OpenConsole(name);

            // create a connection to the console so we can communicate with it
            Connect();

            // the features are flags, so we need to check for all of them
            Features = "";
            foreach (XboxConsoleFeatures feature in Enum.GetValues(typeof(XboxConsoleFeatures)))
                if (((uint)console.ConsoleFeatures & (uint)feature) != 0)
                    Features += feature.ToString() + "|";
            Features = (Features.Length != 0) ? Features.Substring(0, Features.Length - 1) : "None";

            Type = console.ConsoleType.ToString();
            Name = console.Name;
            CurrentTitle = console.RunningProcessInfo.ProgramName;

            // format the IP address, it's in the wrong endian so the .Net classes parse it backwards
            uint ipAddress = console.IPAddress;
            IPAddress = "";
            for (int i = 24; i >= 0; i -= 8)
                IPAddress += ((ipAddress >> i) & 0xFF).ToString() + ".";
            IPAddress = IPAddress.Substring(0, IPAddress.Length - 1);

            // organize a list of all of the heap memory allocated
            string response = SendTextCommand("walkmem");
            foreach (string resp in RecieveStrings())
                committedMemory.Add(new CommittedMemoryBlock(resp));

            response = SendTextCommand("systeminfo");

            console.ReceiveSocketLine(consoleConnection, out response);
            HDDEnabled = (response.Replace("HDD=", "") == "Enabled");

            // this contains the type, that's already been parsed
            console.ReceiveSocketLine(consoleConnection, out response);

            console.ReceiveSocketLine(consoleConnection, out response);
            string[] settings = response.Split(new char[] { ' ' });
            Platform = settings[0].Replace("Platform=", "");
            Motherboard = settings[1].Replace("System=", "");

            console.ReceiveSocketLine(consoleConnection, out response);
            settings = response.Split(new char[] { ' ' });
            BaseKernelVersion = new Version(settings[0].Replace("BaseKrnl=", ""));
            KernelVersion = new Version(settings[1].Replace("Krnl=", ""));
            XDKVersion = new Version(settings[2].Replace("XDK=", ""));

            // retrieve the . at the end
            console.ReceiveSocketLine(consoleConnection, out response);

            // organize a list of all of the modules loaded in memory
            response = SendTextCommand("modules");
            foreach (string resp in RecieveStrings())
                modules.Add(new Module(resp));
        }
Ejemplo n.º 3
0
        public XboxDevConsole(string name)
        {
            console = xboxManager.OpenConsole(name);

            // create a connection to the console so we can communicate with it
            Connect();

            // the features are flags, so we need to check for all of them
            Features = "";
            foreach (XboxConsoleFeatures feature in Enum.GetValues(typeof(XboxConsoleFeatures)))
            {
                if (((uint)console.ConsoleFeatures & (uint)feature) != 0)
                {
                    Features += feature.ToString() + "|";
                }
            }
            Features = (Features.Length != 0) ? Features.Substring(0, Features.Length - 1) : "None";

            Type         = console.ConsoleType.ToString();
            Name         = console.Name;
            CurrentTitle = console.RunningProcessInfo.ProgramName;

            // format the IP address, it's in the wrong endian so the .Net classes parse it backwards
            uint ipAddress = console.IPAddress;

            IPAddress = "";
            for (int i = 24; i >= 0; i -= 8)
            {
                IPAddress += ((ipAddress >> i) & 0xFF).ToString() + ".";
            }
            IPAddress = IPAddress.Substring(0, IPAddress.Length - 1);

            // organize a list of all of the heap memory allocated
            string response = SendTextCommand("walkmem");

            foreach (string resp in RecieveStrings())
            {
                committedMemory.Add(new CommittedMemoryBlock(resp));
            }


            response = SendTextCommand("systeminfo");

            console.ReceiveSocketLine(consoleConnection, out response);
            HDDEnabled = (response.Replace("HDD=", "") == "Enabled");

            // this contains the type, that's already been parsed
            console.ReceiveSocketLine(consoleConnection, out response);

            console.ReceiveSocketLine(consoleConnection, out response);
            string[] settings = response.Split(new char[] { ' ' });
            Platform    = settings[0].Replace("Platform=", "");
            Motherboard = settings[1].Replace("System=", "");

            console.ReceiveSocketLine(consoleConnection, out response);
            settings          = response.Split(new char[] { ' ' });
            BaseKernelVersion = new Version(settings[0].Replace("BaseKrnl=", ""));
            KernelVersion     = new Version(settings[1].Replace("Krnl=", ""));
            XDKVersion        = new Version(settings[2].Replace("XDK=", ""));

            // retrieve the . at the end
            console.ReceiveSocketLine(consoleConnection, out response);


            // organize a list of all of the modules loaded in memory
            response = SendTextCommand("modules");
            foreach (string resp in RecieveStrings())
            {
                modules.Add(new Module(resp));
            }
        }