Пример #1
0
        public static void OnReceive(NetState state, PacketReader pvSrc)
        {
            pvSrc.ReadByte();             // 1: <4.0.1a, 2>=4.0.1a

            HardwareInfo info = new HardwareInfo();

            info.m_InstanceID       = pvSrc.ReadInt32();
            info.m_OSMajor          = pvSrc.ReadInt32();
            info.m_OSMinor          = pvSrc.ReadInt32();
            info.m_OSRevision       = pvSrc.ReadInt32();
            info.m_CpuManufacturer  = pvSrc.ReadByte();
            info.m_CpuFamily        = pvSrc.ReadInt32();
            info.m_CpuModel         = pvSrc.ReadInt32();
            info.m_CpuClockSpeed    = pvSrc.ReadInt32();
            info.m_CpuQuantity      = pvSrc.ReadByte();
            info.m_PhysicalMemory   = pvSrc.ReadInt32();
            info.m_ScreenWidth      = pvSrc.ReadInt32();
            info.m_ScreenHeight     = pvSrc.ReadInt32();
            info.m_ScreenDepth      = pvSrc.ReadInt32();
            info.m_DXMajor          = pvSrc.ReadInt16();
            info.m_DXMinor          = pvSrc.ReadInt16();
            info.m_VCDescription    = pvSrc.ReadUnicodeStringLESafe(64);
            info.m_VCVendorID       = pvSrc.ReadInt32();
            info.m_VCDeviceID       = pvSrc.ReadInt32();
            info.m_VCMemory         = pvSrc.ReadInt32();
            info.m_Distribution     = pvSrc.ReadByte();
            info.m_ClientsRunning   = pvSrc.ReadByte();
            info.m_ClientsInstalled = pvSrc.ReadByte();
            info.m_PartialInstalled = pvSrc.ReadByte();
            info.m_Language         = pvSrc.ReadUnicodeStringLESafe(4);
            info.m_Unknown          = pvSrc.ReadStringSafe(64);

            Account acct = state.Account as Account;

            if (acct != null)
            {
                acct.HardwareInfo = info;
                acct.HardwareHash = info.GetHashCode();                         // serialized - used again when no hardwareinfo is sent
            }
            else
            {
                Console.WriteLine("HardwareInfo lost");
            }
        }
Пример #2
0
 public bool Equals(HardwareInfo hw)
 {
     return
         (hw.m_OSMajor == m_OSMajor &&
          hw.m_OSMinor == m_OSMinor &&
          hw.m_OSRevision == m_OSRevision &&
          hw.m_CpuManufacturer == m_CpuManufacturer &&
          hw.m_CpuFamily == m_CpuFamily &&
          hw.m_CpuModel == m_CpuModel &&
          hw.m_CpuClockSpeed == m_CpuClockSpeed &&
          hw.m_PhysicalMemory == m_PhysicalMemory &&
          //hw.m_ScreenWidth == m_ScreenWidth &&
          //hw.m_ScreenHeight == m_ScreenHeight &&
          //hw.m_ScreenDepth == m_ScreenDepth &&
          hw.m_DXMajor == m_DXMajor &&
          hw.m_DXMinor == m_DXMinor &&
          hw.m_VCVendorID == m_VCVendorID &&
          hw.m_VCDeviceID == m_VCDeviceID &&
          hw.m_VCMemory == m_VCMemory);
 }
Пример #3
0
        public static void OnReceive(NetState state, PacketReader pvSrc)
        {
            pvSrc.ReadByte();             // 1: <4.0.1a, 2>=4.0.1a

            var info = new HardwareInfo
            {
                m_InstanceID       = pvSrc.ReadInt32(),
                m_OSMajor          = pvSrc.ReadInt32(),
                m_OSMinor          = pvSrc.ReadInt32(),
                m_OSRevision       = pvSrc.ReadInt32(),
                m_CpuManufacturer  = pvSrc.ReadByte(),
                m_CpuFamily        = pvSrc.ReadInt32(),
                m_CpuModel         = pvSrc.ReadInt32(),
                m_CpuClockSpeed    = pvSrc.ReadInt32(),
                m_CpuQuantity      = pvSrc.ReadByte(),
                m_PhysicalMemory   = pvSrc.ReadInt32(),
                m_ScreenWidth      = pvSrc.ReadInt32(),
                m_ScreenHeight     = pvSrc.ReadInt32(),
                m_ScreenDepth      = pvSrc.ReadInt32(),
                m_DXMajor          = pvSrc.ReadInt16(),
                m_DXMinor          = pvSrc.ReadInt16(),
                m_VCDescription    = pvSrc.ReadUnicodeStringLESafe(64),
                m_VCVendorID       = pvSrc.ReadInt32(),
                m_VCDeviceID       = pvSrc.ReadInt32(),
                m_VCMemory         = pvSrc.ReadInt32(),
                m_Distribution     = pvSrc.ReadByte(),
                m_ClientsRunning   = pvSrc.ReadByte(),
                m_ClientsInstalled = pvSrc.ReadByte(),
                m_PartialInstalled = pvSrc.ReadByte(),
                m_Language         = pvSrc.ReadUnicodeStringLESafe(4),
                m_Unknown          = pvSrc.ReadStringSafe(64),
                m_TimeReceived     = DateTime.UtcNow
            };

            var acct = state.Account as Account;

            if (acct != null)
            {
                acct.HardwareInfo = info;
            }
        }
Пример #4
0
        public static void HWInfo_OnTarget(Mobile from, object obj)
        {
            if (obj is Mobile && ((Mobile)obj).Player)
            {
                Mobile  m    = (Mobile)obj;
                Account acct = m.Account as Account;

                if (acct != null)
                {
                    HardwareInfo hwInfo = acct.HardwareInfo;

                    if (hwInfo != null)
                    {
                        CommandLogging.WriteLine(
                            from,
                            "{0} {1} viewing hardware info of {2}",
                            from.AccessLevel,
                            CommandLogging.Format(from),
                            CommandLogging.Format(m));
                    }

                    if (hwInfo != null)
                    {
                        from.SendGump(new PropertiesGump(from, hwInfo));
                    }
                    else
                    {
                        from.SendMessage("No hardware information for that account was found.");
                    }
                }
                else
                {
                    from.SendMessage("No account has been attached to that player.");
                }
            }
            else
            {
                from.BeginTarget(-1, false, TargetFlags.None, HWInfo_OnTarget);
                from.SendMessage("That is not a player. Try again.");
            }
        }
Пример #5
0
        public static void OnReceive(NetState state, PacketReader pvSrc)
        {
            pvSrc.ReadByte(); // 1: <4.0.1a, 2>=4.0.1a

            HardwareInfo info = new HardwareInfo();

            info.m_InstanceID = pvSrc.ReadInt32();
            info.m_OSMajor = pvSrc.ReadInt32();
            info.m_OSMinor = pvSrc.ReadInt32();
            info.m_OSRevision = pvSrc.ReadInt32();
            info.m_CpuManufacturer = pvSrc.ReadByte();
            info.m_CpuFamily = pvSrc.ReadInt32();
            info.m_CpuModel = pvSrc.ReadInt32();
            info.m_CpuClockSpeed = pvSrc.ReadInt32();
            info.m_CpuQuantity = pvSrc.ReadByte();
            info.m_PhysicalMemory = pvSrc.ReadInt32();
            info.m_ScreenWidth = pvSrc.ReadInt32();
            info.m_ScreenHeight = pvSrc.ReadInt32();
            info.m_ScreenDepth = pvSrc.ReadInt32();
            info.m_DXMajor = pvSrc.ReadInt16();
            info.m_DXMinor = pvSrc.ReadInt16();
            info.m_VCDescription = pvSrc.ReadUnicodeStringLESafe(64);
            info.m_VCVendorID = pvSrc.ReadInt32();
            info.m_VCDeviceID = pvSrc.ReadInt32();
            info.m_VCMemory = pvSrc.ReadInt32();
            info.m_Distribution = pvSrc.ReadByte();
            info.m_ClientsRunning = pvSrc.ReadByte();
            info.m_ClientsInstalled = pvSrc.ReadByte();
            info.m_PartialInstalled = pvSrc.ReadByte();
            info.m_Language = pvSrc.ReadUnicodeStringLESafe(4);
            info.m_Unknown = pvSrc.ReadStringSafe(64);

            info.m_TimeReceived = DateTime.Now;

            Account acct = state.Account as Account;

            if (acct != null)
                acct.HardwareInfo = info;
        }
Пример #6
0
 public bool Equals( HardwareInfo hw )
 {
     return
         hw.m_OSMajor == m_OSMajor &&
         hw.m_OSMinor == m_OSMinor &&
         hw.m_OSRevision == m_OSRevision &&
         hw.m_CpuManufacturer == m_CpuManufacturer &&
         hw.m_CpuFamily == m_CpuFamily &&
         hw.m_CpuModel == m_CpuModel &&
         hw.m_CpuClockSpeed == m_CpuClockSpeed &&
         hw.m_PhysicalMemory == m_PhysicalMemory &&
         //hw.m_ScreenWidth == m_ScreenWidth &&
         //hw.m_ScreenHeight == m_ScreenHeight &&
         //hw.m_ScreenDepth == m_ScreenDepth &&
         hw.m_DXMajor == m_DXMajor &&
         hw.m_DXMinor == m_DXMinor &&
         hw.m_VCVendorID == m_VCVendorID &&
         hw.m_VCDeviceID == m_VCDeviceID &&
         hw.m_VCMemory == m_VCMemory ;
 }
Пример #7
0
        public static void HWInfo_OnTarget(Mobile from, object obj)
        {
            if (obj is Mobile && ((Mobile)obj).Player)
            {
                Mobile  m    = (Mobile)obj;
                Account acct = m.Account as Account;

                string hwInfoTag = acct.GetTag(HardwareInfo.AccountTagName);
                if (hwInfoTag != null)
                {
                    // check it against all other accounts:
                    string[] hwInfoTags = hwInfoTag.Split('|');
                    foreach (string tag in hwInfoTags)
                    {
                        int tagNumber = -1;
                        if (tag == String.Empty)
                        {
                            continue;
                        }
                        try
                        {
                            tagNumber = int.Parse(tag);
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine("HWInfo error with tag " + tag + ": " + e.Message);
                            Console.WriteLine(e.StackTrace);
                            continue;
                        }
                        foreach (Account account in Accounts.GetAccounts())
                        {
                            if (HasHWInfoInstance(account, tagNumber))
                            {
                                from.SendMessage(account.Username + " " + tagNumber);
                            }
                        }
                    }
                }

                if (acct != null)
                {
                    HardwareInfo hwInfo = acct.HardwareInfo;

                    if (hwInfo != null)
                    {
                        CommandLogging.WriteLine(from, "{0} {1} viewing hardware info of {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(m));
                    }

                    if (hwInfo != null)
                    {
                        from.SendGump(new Gumps.PropertiesGump(from, hwInfo));
                    }
                    else
                    {
                        from.SendMessage("No hardware information for that account was found.");
                    }
                }
                else
                {
                    from.SendMessage("No account has been attached to that player.");
                }
            }
            else
            {
                from.BeginTarget(-1, false, TargetFlags.None, new TargetCallback(HWInfo_OnTarget));
                from.SendMessage("That is not a player. Try again.");
            }
        }
Пример #8
0
		public static bool IsSameHWInfo(HardwareInfo hw1, HardwareInfo hw2)
		{
			bool bSame = false;

			if (hw1 == null || hw2 == null)
				return bSame;

			if (hw1.CpuClockSpeed == hw2.CpuClockSpeed
				&& hw1.CpuFamily == hw2.CpuFamily
				&& hw1.CpuManufacturer == hw2.CpuManufacturer
				&& hw1.CpuModel == hw2.CpuModel
				&& hw1.CpuQuantity == hw2.CpuQuantity
				&& hw1.DXMajor == hw2.DXMajor
				&& hw1.DXMinor == hw2.DXMinor
				&& hw1.OSMajor == hw2.OSMajor
				&& hw1.OSMinor == hw2.OSMinor
				&& hw1.OSRevision == hw2.OSRevision
				&& hw1.PhysicalMemory == hw2.PhysicalMemory
				&& hw1.VCDescription == hw2.VCDescription
				&& hw1.VCMemory == hw2.VCMemory
				)
			{
				bSame = true;
			}

			return bSame;
		}