Ejemplo n.º 1
0
        public WelcomePacket(byte[] byteArray)
        {
            if (byteArray != null)
            {
                if (_log.IsInfoEnabled)
                {
                    _log.InfoFormat("{0}--bytes in: {1}", MethodBase.GetCurrentMethod().ToString(), Utility.BytesToDebugString(byteArray));
                }


                Unknown = BitConverter.ToInt32(byteArray, 0);
                if (_log.IsInfoEnabled)
                {
                    _log.InfoFormat("Unknown={0}", Unknown.ToString());
                }
                Message = System.Text.ASCIIEncoding.ASCII.GetString(byteArray, 4, byteArray.Length - 4);
                if (_log.IsInfoEnabled)
                {
                    _log.InfoFormat("Message={0}", Message);
                }
                if (_log.IsInfoEnabled)
                {
                    _log.InfoFormat("{0}--Result bytes: {1}", MethodBase.GetCurrentMethod().ToString(), Utility.BytesToDebugString(this.GetBytes()));
                }
            }
        }
        protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Flags", true, out subEle);
            subEle.Value = MagicEffectFlags.ToString();

            ele.TryPathTo("BaseCost", true, out subEle);
            subEle.Value = BaseCost.ToString("G15");

            ele.TryPathTo("AssociatedItem", true, out subEle);
            AssociatedItem.WriteXML(subEle, master);

            ele.TryPathTo("MagicSchool", true, out subEle);
            subEle.Value = MagicSchool.ToString();

            ele.TryPathTo("ResistanceType", true, out subEle);
            subEle.Value = ResistanceType.ToString();

            ele.TryPathTo("Unknown", true, out subEle);
            subEle.Value = Unknown.ToString();

            WriteUnusedXML(ele, master);

            ele.TryPathTo("Light", true, out subEle);
            Light.WriteXML(subEle, master);

            ele.TryPathTo("ProjectileSpeed", true, out subEle);
            subEle.Value = ProjectileSpeed.ToString("G15");

            ele.TryPathTo("EffectShader", true, out subEle);
            EffectShader.WriteXML(subEle, master);

            ele.TryPathTo("ObjectDisplayShader", true, out subEle);
            ObjectDisplayShader.WriteXML(subEle, master);

            ele.TryPathTo("EffectSound", true, out subEle);
            EffectSound.WriteXML(subEle, master);

            ele.TryPathTo("BoltSound", true, out subEle);
            BoltSound.WriteXML(subEle, master);

            ele.TryPathTo("HitSound", true, out subEle);
            HitSound.WriteXML(subEle, master);

            ele.TryPathTo("AreaSound", true, out subEle);
            AreaSound.WriteXML(subEle, master);

            ele.TryPathTo("ConstantEffectEnchantmentFactor", true, out subEle);
            subEle.Value = ConstantEffectEnchantmentFactor.ToString("G15");

            ele.TryPathTo("ConstantEffectBarterFactor", true, out subEle);
            subEle.Value = ConstantEffectBarterFactor.ToString("G15");

            ele.TryPathTo("Archetype", true, out subEle);
            subEle.Value = Archetype.ToString();

            ele.TryPathTo("ActorValue", true, out subEle);
            subEle.Value = ActorValue.ToString();
        }
Ejemplo n.º 3
0
 public override string ToString()
 {
     if (String.IsNullOrEmpty(Filename))
     {
         return(String.Format("[{0}|{1}|{2}] Offset: {3}, Size: {4}", FirstHash.ToString("X8"), SecondHash.ToString("X8"),
                              Unknown.ToString("X8"), FileOffset, FileSize));
     }
     else
     {
         return(String.Format("[{0}|{1}|{2}] Offset: {3}, Size: {4}, Filename:{5}", FirstHash.ToString("X8"), SecondHash.ToString("X8"),
                              Unknown.ToString("X8"), FileOffset, FileSize, Filename));
     }
 }
Ejemplo n.º 4
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(Error.ToString());
            sb.Append(";");
            sb.Append(Off.ToString());
            sb.Append(";");
            sb.Append(Unknown.ToString());
            sb.Append(";");
            sb.Append(Username.ToString());

            return(sb.ToString());
        }
Ejemplo n.º 5
0
            public String GetBody(bool useCurrentTime = true)
            {
                var assembly = System.Reflection.Assembly.GetEntryAssembly();

                if (assembly != null)
                {
                    this.Generator = $"{assembly.GetName().Name} {assembly.GetName().Version.ToString()}";
                }

                this.Date = useCurrentTime ? DateTime.Now : DateTime.Now.Date;

                var root = new Unknown(this).ToXml();

                return(root.ToString(SaveOptions.OmitDuplicateNamespaces));
            }
Ejemplo n.º 6
0
        public Packet(byte[] byteArray)
        {
            if (byteArray != null)
            {
                if (_log.IsInfoEnabled)
                {
                    _log.Info("~~~~~~~~~~~~~~~~Starting Packet Creation.~~~~~~~~~~~~~~~~~~~~~~~~");
                }
                if (_log.IsInfoEnabled)
                {
                    _log.InfoFormat("{0}--{2} bytes in: {1}", MethodBase.GetCurrentMethod().ToString(), Utility.BytesToDebugString(byteArray), byteArray.Length.ToString());
                }


                ID = BitConverter.ToUInt32(byteArray, 0); //Len = 4

                if (ID != Connector.StandardID)
                {
                    if (ThrowWhenInvalid)
                    {
                        throw new InvalidPacketException();
                    }
                    else
                    {
                        return;
                    }
                }

                if (_log.IsInfoEnabled)
                {
                    _log.InfoFormat("ID={0}", ID.ToString());
                }
                Length = BitConverter.ToInt32(byteArray, 4);//Len = 4
                if (_log.IsInfoEnabled)
                {
                    _log.InfoFormat("Length={0}", Length.ToString());
                }
                Origin = (OriginType)BitConverter.ToInt32(byteArray, 8);//Len = 4
                if (_log.IsInfoEnabled)
                {
                    _log.InfoFormat("Origin={0}", Origin.ToString());
                }
                Unknown = BitConverter.ToInt32(byteArray, 12);//Len = 4
                if (_log.IsInfoEnabled)
                {
                    _log.InfoFormat("Unknown={0}", Unknown.ToString());
                }
                PayloadLength = BitConverter.ToInt32(byteArray, 16);//Len = 4
                if (_log.IsInfoEnabled)
                {
                    _log.InfoFormat("RemainingPacketLength={0}", PayloadLength.ToString());
                }
                PacketType = (PacketTypes)BitConverter.ToUInt32(byteArray, 20);//Len = 4
                if (_log.IsInfoEnabled)
                {
                    _log.InfoFormat("PacketType={0}", PacketType.ToString());
                }
                List <byte> newArray = new List <byte>();
                int         ln       = byteArray.Length;
                if (ln > Length)
                {
                    ln = Length;
                }
                for (int i = HeaderLength; i < ln; i++)
                {
                    newArray.Add(byteArray[i]);
                }
                Payload = newArray.ToArray();

                _package = GetPackage(Payload);
                int packetLength = 0;
                if (_package != null)
                {
                    byte[] packetBytes = _package.GetBytes();
                    packetLength = packetBytes.Length;
                }
                if (packetLength + HeaderLength != Length && ThrowWhenInvalid)
                {
                    throw new InvalidPacketException();
                }

                if (_log.IsInfoEnabled)
                {
                    _log.InfoFormat("{0}--{2} Result bytes: {1}", MethodBase.GetCurrentMethod().ToString(), Utility.BytesToDebugString(this.GetBytes()), this.GetBytes().Length);
                }
                if (_log.IsInfoEnabled)
                {
                    _log.Info("~~~~~~~~~~~~~~~~Packet Creation Ended.~~~~~~~~~~~~~~~~~~~~~~~~");
                }
            }
        }
Ejemplo n.º 7
0
            public String GetBody(bool useCurrentTime = true)
            {
                var root = new Unknown(this).ToXml();

                return(root.ToString(SaveOptions.OmitDuplicateNamespaces));
            }