示例#1
0
        public override int ReadFrom(byte[] Buffer, int StartIndex = 0)
        {
            int cursor = StartIndex;

            cursor += base.ReadFrom(Buffer, cursor);

            // passwordlen, always 0x10 = 16
            cursor += TypeSizes.SHORT;

            Hash128Bit pwHashOld = new Hash128Bit();

            pwHashOld.HASH1 = BitConverter.ToUInt32(Buffer, cursor);
            cursor         += TypeSizes.INT;

            pwHashOld.HASH2 = BitConverter.ToUInt32(Buffer, cursor);
            cursor         += TypeSizes.INT;

            pwHashOld.HASH3 = BitConverter.ToUInt32(Buffer, cursor);
            cursor         += TypeSizes.INT;

            pwHashOld.HASH4 = BitConverter.ToUInt32(Buffer, cursor);
            cursor         += TypeSizes.INT;

            PasswordHashOld = pwHashOld;

            // passwordlen, always 0x10 = 16
            cursor += TypeSizes.SHORT;

            Hash128Bit pwHashNew = new Hash128Bit();

            pwHashNew.HASH1 = BitConverter.ToUInt32(Buffer, cursor);
            cursor         += TypeSizes.INT;

            pwHashNew.HASH2 = BitConverter.ToUInt32(Buffer, cursor);
            cursor         += TypeSizes.INT;

            pwHashNew.HASH3 = BitConverter.ToUInt32(Buffer, cursor);
            cursor         += TypeSizes.INT;

            pwHashNew.HASH4 = BitConverter.ToUInt32(Buffer, cursor);
            cursor         += TypeSizes.INT;

            PasswordHashNew = pwHashNew;

            return(cursor - StartIndex);
        }
        /// <summary>
        /// Constructor by values
        /// </summary>
        /// <param name="Username"></param>
        /// <param name="Password"></param>
        /// <param name="RsbHash"></param>
        /// <param name="MajorClientVersion"></param>
        /// <param name="MinorClientVersion"></param>
        /// <param name="WindowsType"></param>
        /// <param name="WindowsMajorVersion"></param>
        /// <param name="WindowsMinorVersion"></param>
        /// <param name="RamSize"></param>
        /// <param name="CpuType"></param>
        /// <param name="ClientExecutableCRC"></param>
        /// <param name="HorizontalSystemResolution"></param>
        /// <param name="VerticalSystemResolution"></param>
        /// <param name="Display"></param>
        /// <param name="Bandwidth"></param>
        /// <param name="ColorDepth"></param>
        /// <param name="PartnerNr"></param>
        /// <param name="Unused"></param>
        public LoginMessage(
            string Username,
            string Password,
            Hash128Bit RsbHash,
            byte MajorClientVersion,
            byte MinorClientVersion,
            uint WindowsType                  = WINTYPE_NT,
            uint WindowsMajorVersion          = 0,
            uint WindowsMinorVersion          = 0,
            uint RamSize                      = 0,
            ushort CpuType                    = CPUTYPE_PENTIUM,
            ushort ClientExecutableCRC        = 0,
            ushort HorizontalSystemResolution = 0,
            ushort VerticalSystemResolution   = 0,
            uint Display                      = 0,
            uint Bandwidth                    = 0,
            byte ColorDepth                   = 0,
            byte PartnerNr                    = 0,
            ushort Unused                     = 0)
            : base(MessageTypeLoginMode.Login)
        {
            this.MajorClientVersion = MajorClientVersion;
            this.MinorClientVersion = MinorClientVersion;

            this.WindowsType         = WindowsType;
            this.WindowsMajorVersion = WindowsMajorVersion;
            this.WindowsMinorVersion = WindowsMinorVersion;

            this.RamSize             = RamSize;
            this.CpuType             = CpuType;
            this.ClientExecutableCRC = ClientExecutableCRC;

            this.HorizontalSystemResolution = HorizontalSystemResolution;
            this.VerticalSystemResolution   = VerticalSystemResolution;
            this.Display    = Display;
            this.Bandwidth  = Bandwidth;
            this.ColorDepth = ColorDepth;
            this.PartnerNr  = PartnerNr;
            this.Unused     = Unused;
            this.RsbHash    = RsbHash;
            this.Username   = Username;
            this.Password   = Password;
        }
示例#3
0
        public ChangePasswordMessage(string PasswordOld, string PasswordNew)
            : base(MessageTypeGameMode.ChangePassword)
        {
            byte[] md5hashOld = MeridianMD5.ComputeMD5(PasswordOld);
            byte[] md5hashNew = MeridianMD5.ComputeMD5(PasswordNew);

            Hash128Bit pwHashOld = new Hash128Bit();

            pwHashOld.HASH1 = BitConverter.ToUInt32(md5hashOld, 0);
            pwHashOld.HASH2 = BitConverter.ToUInt32(md5hashOld, 4);
            pwHashOld.HASH3 = BitConverter.ToUInt32(md5hashOld, 8);
            pwHashOld.HASH4 = BitConverter.ToUInt32(md5hashOld, 12);

            Hash128Bit pwHashNew = new Hash128Bit();

            pwHashNew.HASH1 = BitConverter.ToUInt32(md5hashNew, 0);
            pwHashNew.HASH2 = BitConverter.ToUInt32(md5hashNew, 4);
            pwHashNew.HASH3 = BitConverter.ToUInt32(md5hashNew, 8);
            pwHashNew.HASH4 = BitConverter.ToUInt32(md5hashNew, 12);

            this.PasswordHashOld = pwHashOld;
            this.PasswordHashNew = pwHashNew;
        }
示例#4
0
        /// <summary>
        /// Clears and reloads the strings from another dictionary file within the strings folder,
        /// which was previously initialized during Init()
        /// </summary>
        /// <param name="RsbFile">Plain filename, like rsc0000.rsb</param>
        /// <param name="Language"></param>
        public void SelectStringDictionary(string RsbFile, LanguageCode Language)
        {
            // clear old entries
            StringResources.Clear();

            // set preferred language
            StringResources.Language = Language;

            // Save the MD5 hash of this rsb file as our RsbHash.
            byte[]     rsbMD5Hash = MeridianMD5.ComputeGenericFileMD5(StringsFolder + "/" + RsbFile);
            Hash128Bit rsbHash    = new Hash128Bit();

            rsbHash.HASH1 = BitConverter.ToUInt32(rsbMD5Hash, 0);
            rsbHash.HASH2 = BitConverter.ToUInt32(rsbMD5Hash, 4);
            rsbHash.HASH3 = BitConverter.ToUInt32(rsbMD5Hash, 8);
            rsbHash.HASH4 = BitConverter.ToUInt32(rsbMD5Hash, 12);
            RsbHash       = rsbHash;

            // try get the dictionary for argument
            RsbFile file = GetStringDictionary(RsbFile);

            // load strings of the rsbfile to use
            // into the multithreaded dictionary
            if (file != null)
            {
                foreach (RsbResourceID res in file.StringResources)
                {
                    StringResources.TryAdd(res.ID, res.Text, res.Language);
                }
            }

            // raise event
            if (StringDictionarySelected != null)
            {
                StringDictionarySelected(this, new EventArgs());
            }
        }
        public override int ReadFrom(byte[] Buffer, int StartIndex = 0)
        {
            int cursor = StartIndex;

            cursor += base.ReadFrom(Buffer, cursor);

            MajorClientVersion = Buffer[cursor];
            cursor++;

            MinorClientVersion = Buffer[cursor];
            cursor++;

            WindowsType = BitConverter.ToUInt32(Buffer, cursor);
            cursor     += TypeSizes.INT;

            WindowsMajorVersion = BitConverter.ToUInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            WindowsMinorVersion = BitConverter.ToUInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            RamSize = BitConverter.ToUInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            CpuType = BitConverter.ToUInt16(Buffer, cursor);
            cursor += TypeSizes.SHORT;

            ClientExecutableCRC = BitConverter.ToUInt16(Buffer, cursor);
            cursor += TypeSizes.SHORT;

            HorizontalSystemResolution = BitConverter.ToUInt16(Buffer, cursor);
            cursor += TypeSizes.SHORT;

            VerticalSystemResolution = BitConverter.ToUInt16(Buffer, cursor);
            cursor += TypeSizes.SHORT;

            Display = BitConverter.ToUInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            Bandwidth = BitConverter.ToUInt32(Buffer, cursor);
            cursor   += TypeSizes.INT;

            ColorDepth = Buffer[cursor];
            cursor++;

            PartnerNr = Buffer[cursor];
            cursor++;

            Unused  = BitConverter.ToUInt16(Buffer, cursor);
            cursor += TypeSizes.SHORT;

            ushort len = BitConverter.ToUInt16(Buffer, cursor);

            cursor += TypeSizes.SHORT;

            Username = Util.Encoding.GetString(Buffer, cursor, len);
            cursor  += len;

            // passwordlen, always 0x10 = 16
            cursor += TypeSizes.SHORT;

            Hash128Bit hash = new Hash128Bit();

            hash.HASH1 = BitConverter.ToUInt32(Buffer, cursor);
            cursor    += TypeSizes.INT;

            hash.HASH2 = BitConverter.ToUInt32(Buffer, cursor);
            cursor    += TypeSizes.INT;

            hash.HASH3 = BitConverter.ToUInt32(Buffer, cursor);
            cursor    += TypeSizes.INT;

            hash.HASH4 = BitConverter.ToUInt32(Buffer, cursor);
            cursor    += TypeSizes.INT;

            PasswordHash = hash;
#if !VANILLA
            // rsbhash len, always 0x10 = 16
            cursor += TypeSizes.SHORT;

            Hash128Bit rsbHash = new Hash128Bit();
            rsbHash.HASH1 = BitConverter.ToUInt32(Buffer, cursor);
            cursor       += TypeSizes.INT;

            rsbHash.HASH2 = BitConverter.ToUInt32(Buffer, cursor);
            cursor       += TypeSizes.INT;

            rsbHash.HASH3 = BitConverter.ToUInt32(Buffer, cursor);
            cursor       += TypeSizes.INT;

            rsbHash.HASH4 = BitConverter.ToUInt32(Buffer, cursor);
            cursor       += TypeSizes.INT;

            RsbHash = rsbHash;
#endif
            return(cursor - StartIndex);
        }