public void UpdateFromModel(GuildShieldInfo Model, bool RaiseChangedEvent)
        {
            if (RaiseChangedEvent)
            {
                GuildID          = Model.GuildID;
                GuildName        = Model.GuildName;
                Color1           = Model.Color1;
                Color2           = Model.Color2;
                Design           = Model.Design;
                GuildShieldError = Model.GuildShieldError;
            }
            else
            {
                guildID          = Model.GuildID;
                guildName        = Model.GuildName;
                color1           = Model.Color1;
                color2           = Model.Color2;
                design           = Model.Design;
                guildShieldError = Model.GuildShieldError;

                // update examplemodel
                exampleModel.ColorTranslation = ColorTransformation.GetGuildShieldColor(color1, color2);

                if (design > 0 && shields != null && shields.Length > (design - 1))
                {
                    exampleModel.OverlayFileRID = shields[design - 1].Value;
                    exampleModel.OverlayFile    = shields[design - 1].Name;
                    exampleModel.Resource       = shields[design - 1].Resource;
                }
            }
        }
Esempio n. 2
0
        public void ReadXml(XmlReader Reader)
        {
            // rootnode
            Reader.ReadToFollowing(TAG_MAIL);

            // read attributes
            Sender    = Reader[ATTRIB_SENDER];
            Timestamp = Convert.ToUInt32(Reader[ATTRIB_TIMESTAMP]);
            Title     = Reader[ATTRIB_TITLE];

            // recipients
            Reader.ReadToFollowing(TAG_RECIPIENTS);
            if (Reader.ReadToDescendant(TAG_RECIPIENT))
            {
                do
                {
                    Recipients.Add(Reader[ATTRIB_NAME]);
                }while (Reader.ReadToNextSibling(TAG_RECIPIENT));
            }

            // text
            Reader.ReadToFollowing(TAG_TEXT);

            // construct chatmessage instance dummy
            Message            = new ServerString();
            Message.FullString = Reader.ReadString();
        }
Esempio n. 3
0
 public ObjectInfo(ObjectBase ObjectBase, LookTypeFlags LookType, ServerString Message, ServerString Inscription)
 {
     objectBase  = ObjectBase;
     lookType    = LookType;
     message     = Message;
     inscription = Inscription;
 }
        public void Clear(bool RaiseChangedEvent)
        {
            if (RaiseChangedEvent)
            {
                ObjectBase = new ObjectBase();
                IsEditable = false;
                Message    = new ServerString();
#if !VANILLA
                Titles = new ServerString();
#else
                Titles = String.Empty;
#endif
                Website   = String.Empty;
                IsVisible = false;
            }
            else
            {
                objectBase = new ObjectBase();
                isEditable = false;
                message    = new ServerString();
#if !VANILLA
                titles = new ServerString();
#else
                titles = String.Empty;
#endif
                website   = String.Empty;
                isVisible = false;
            }
        }
        public void Clear(bool RaiseChangedEvent)
        {
            if (RaiseChangedEvent)
            {
                GuildID          = new ObjectID();
                GuildName        = DESIGNNOTAVAILABLE;
                Color1           = WHITECOLOR;
                Color2           = WHITECOLOR;
                Design           = 1;
                GuildShieldError = new ServerString();
            }
            else
            {
                guildID          = new ObjectID();
                guildName        = DESIGNNOTAVAILABLE;
                color1           = WHITECOLOR;
                color2           = WHITECOLOR;
                design           = 1;
                guildShieldError = new ServerString();
                // update examplemodel
                exampleModel.ColorTranslation = ColorTransformation.GetGuildShieldColor(color1, color2);

                if (design > 0 && shields != null && shields.Length > (design - 1))
                {
                    exampleModel.OverlayFileRID = shields[design - 1].Value;
                    exampleModel.OverlayFile    = shields[design - 1].Name;
                    exampleModel.Resource       = shields[design - 1].Resource;
                }
            }
        }
        public GuildShieldInfo(byte[] Buffer, int StartIndex = 0)
        {
            ExampleModel     = new ObjectBase();
            GuildShieldError = new ServerString();

            ReadFrom(Buffer, StartIndex);
        }
        public int ReadFrom(byte[] Buffer, int StartIndex = 0)
        {
            int    cursor = StartIndex;
            ushort strlen;

            objectBase = new ObjectBase(true, Buffer, cursor);
            cursor    += objectBase.ByteLength;

            isEditable = Convert.ToBoolean(Buffer[cursor]);
            cursor++;

            message = new ServerString(ChatMessageType.ObjectChatMessage, stringResources, Buffer, cursor);
            cursor += Message.ByteLength;

#if !VANILLA
            titles  = new ServerString(ChatMessageType.ObjectChatMessage, stringResources, Buffer, cursor);
            cursor += titles.ByteLength;
#else
            strlen  = BitConverter.ToUInt16(Buffer, cursor);
            cursor += TypeSizes.SHORT;

            Titles  = Encoding.Default.GetString(Buffer, cursor, strlen);
            cursor += strlen;
#endif
            strlen  = BitConverter.ToUInt16(Buffer, cursor);
            cursor += TypeSizes.SHORT;

            Website = Encoding.Default.GetString(Buffer, cursor, strlen);
            cursor += strlen;

            return(cursor - StartIndex);
        }
Esempio n. 8
0
 public SkillInfo(ObjectBase ObjectBase, ServerString Message, ServerString SchoolName,
                  ServerString SkillLevel, ServerString ManaCost, ServerString VigorCost)
 {
     objectBase = ObjectBase;
     message    = Message;
     schoolName = SchoolName;
     skillLevel = SkillLevel;
 }
 public PlayerInfo(ObjectBase ObjectBase, bool IsEditable, ServerString Message, string Titles, string Website)
 {
     objectBase = ObjectBase;
     isEditable = IsEditable;
     message    = Message;
     titles     = Titles;
     website    = Website;
 }
Esempio n. 10
0
 public Mail(uint Num, string Sender, uint TimeStamp, List <string> Recipients, ServerString Message, string Title)
 {
     num        = Num;
     sender     = Sender;
     timestamp  = TimeStamp;
     recipients = Recipients;
     message    = Message;
     title      = Title;
 }
Esempio n. 11
0
 public SpellInfo(ObjectBase ObjectBase, ServerString Message, ServerString SchoolName,
                  ServerString SpellLevel, ServerString ManaCost, ServerString VigorCost)
 {
     objectBase = ObjectBase;
     message    = Message;
     schoolName = SchoolName;
     spellLevel = SpellLevel;
     manaCost   = ManaCost;
     vigorCost  = VigorCost;
 }
Esempio n. 12
0
        public override int ReadFrom(byte[] Buffer, int StartIndex = 0)
        {
            int cursor = StartIndex;

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

            Message = new ServerString(ChatMessageType.SystemMessage, LookupList, Buffer, cursor);
            cursor += Message.ByteLength;

            return cursor - StartIndex;
        }
        public GuildShieldInfo(ObjectID GuildID, string GuildName, byte Color1, byte Color2, byte Design)
        {
            ExampleModel = new ObjectBase();

            guildID          = GuildID;
            guildName        = GuildName;
            color1           = Color1;
            color2           = Color2;
            design           = Design;
            guildShieldError = new ServerString();
        }
Esempio n. 14
0
        public int ReadFrom(byte[] Buffer, int StartIndex = 0)
        {
            int cursor = StartIndex;

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

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

            cursor += TypeSizes.SHORT;

            sender  = Encoding.Default.GetString(Buffer, cursor, strlen);
            cursor += strlen;

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

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

            cursor += TypeSizes.SHORT;

            recipients = new List <string>();

            // get recipients
            for (int i = 0; i < listlen; i++)
            {
                strlen  = BitConverter.ToUInt16(Buffer, cursor);
                cursor += TypeSizes.SHORT;

                string recipient = Encoding.Default.GetString(Buffer, cursor, strlen);
                cursor += strlen;

                recipients.Add(recipient);
            }

            // get message
            message = new ServerString(ChatMessageType.ObjectChatMessage, stringResources, Buffer, cursor);
            cursor += message.ByteLength;

            // Now ugly:
            // For some reason the title is encoded into the message body,
            // and not a separate field. It also includes hardcoded "Subject:" string
            string tmp1, tmp2;

            Mail.ParseTitle(message.FullString, out tmp1, out tmp2);

            // update values from parsed results (error: String.Empty)
            title = tmp1;
            message.FullString = tmp2;

            return(cursor - StartIndex);
        }
Esempio n. 15
0
 public void Clear(bool RaiseChangedEvent)
 {
     if (RaiseChangedEvent)
     {
         ObjectBase   = new ObjectBase();
         Description  = new ServerString();
         Requirements = new ServerString();
     }
     else
     {
         objectBase   = new ObjectBase();
         description  = new ServerString();
         requirements = new ServerString();
     }
 }
Esempio n. 16
0
 public void UpdateFromModel(QuestObjectInfo Model, bool RaiseChangedEvent)
 {
     if (RaiseChangedEvent)
     {
         ObjectBase   = Model.ObjectBase;
         Description  = new ServerString();
         Requirements = new ServerString();
     }
     else
     {
         objectBase   = Model.ObjectBase;
         description  = new ServerString();
         requirements = new ServerString();
     }
 }
Esempio n. 17
0
        public int ReadFrom(byte[] Buffer, int StartIndex = 0)
        {
            int cursor = StartIndex;

            objectBase = new ObjectBase(true, Buffer, cursor);
            cursor    += objectBase.ByteLength;

            description = new ServerString(ChatMessageType.ObjectChatMessage, stringResources, Buffer, cursor);
            cursor     += Description.ByteLength;

            requirements = new ServerString(ChatMessageType.ObjectChatMessage, stringResources, Buffer, cursor);
            cursor      += Requirements.ByteLength;

            return(cursor - StartIndex);
        }
Esempio n. 18
0
        public int ReadFrom(byte[] Buffer, int StartIndex = 0)
        {
            int cursor = StartIndex;

            objectBase = new ObjectBase(true, Buffer, cursor);
            cursor    += objectBase.ByteLength;

            schoolName = new ServerString(ChatMessageType.ObjectChatMessage, stringResources, Buffer, cursor);
            cursor    += SchoolName.ByteLength;
            skillLevel = new ServerString(ChatMessageType.ObjectChatMessage, stringResources, Buffer, cursor);
            cursor    += SkillLevel.ByteLength;
            message    = new ServerString(ChatMessageType.ObjectChatMessage, stringResources, Buffer, cursor);
            cursor    += Message.ByteLength;

            return(cursor - StartIndex);
        }
        /// <summary>
        /// Creates a local 'ServerString' instance for given text and
        /// style settings.
        /// </summary>
        /// <param name="Text"></param>
        /// <param name="IsBold"></param>
        /// <param name="IsCursive"></param>
        /// <param name="IsUnderline"></param>
        /// <param name="Color"></param>
        /// <returns></returns>
        public static ServerString GetServerStringForString(
            string Text,
            bool IsBold      = false,
            bool IsCursive   = false,
            bool IsUnderline = false,
            ChatColor Color  = ChatColor.Red)
        {
            ChatStyle style = new ChatStyle(
                0, Text.Length, IsBold, IsCursive, IsUnderline, Color);

            ServerString message = new ServerString();

            message.FullString = Text;
            message.Styles.Add(style);

            return(message);
        }
        public override int ReadFrom(byte[] Buffer, int StartIndex = 0)
        {
            int cursor = StartIndex;

            if ((UserCommandType)Buffer[cursor] != CommandType)
            {
                throw new Exception(ERRORWRONGTYPEBYTE);
            }
            else
            {
                cursor++;

                ShieldError = new ServerString(ChatMessageType.ObjectChatMessage, LookupList, Buffer, cursor);
                cursor     += ShieldError.ByteLength;
            }

            return(cursor - StartIndex);
        }
Esempio n. 21
0
 public void UpdateFromModel(ObjectInfo Model, bool RaiseChangedEvent)
 {
     if (RaiseChangedEvent)
     {
         ObjectBase  = Model.ObjectBase;
         LookType    = Model.LookType;
         Message     = Model.Message;
         Inscription = Model.Inscription;
         // don't isvisible
     }
     else
     {
         objectBase  = Model.ObjectBase;
         lookType    = Model.LookType;
         message     = Model.Message;
         inscription = Model.Inscription;
         // don't isvisible
     }
 }
Esempio n. 22
0
 public void Clear(bool RaiseChangedEvent)
 {
     if (RaiseChangedEvent)
     {
         ObjectBase = new ObjectBase();
         Message    = new ServerString();
         SchoolName = new ServerString();
         SkillLevel = new ServerString();
         IsVisible  = false;
     }
     else
     {
         objectBase = new ObjectBase();
         message    = new ServerString();
         schoolName = new ServerString();
         skillLevel = new ServerString();
         isVisible  = false;
     }
 }
Esempio n. 23
0
 public void UpdateFromModel(SkillInfo Model, bool RaiseChangedEvent)
 {
     if (RaiseChangedEvent)
     {
         Message    = Model.Message;
         SchoolName = Model.SchoolName;
         SkillLevel = Model.SkillLevel;
         ObjectBase = Model.ObjectBase;
         // don't isvisible
     }
     else
     {
         message    = Model.Message;
         schoolName = Model.SchoolName;
         skillLevel = Model.SkillLevel;
         objectBase = Model.ObjectBase;
         // don't isvisible
     }
 }
Esempio n. 24
0
 public void Clear(bool RaiseChangedEvent)
 {
     if (RaiseChangedEvent)
     {
         ObjectBase  = new ObjectBase();
         LookType    = new LookTypeFlags();
         Message     = new ServerString();
         Inscription = null;
         IsVisible   = false;
     }
     else
     {
         objectBase  = new ObjectBase();
         lookType    = new LookTypeFlags();
         message     = new ServerString();
         inscription = null;
         isVisible   = false;
     }
 }
Esempio n. 25
0
 public void UpdateFromModel(PlayerInfo Model, bool RaiseChangedEvent)
 {
     if (RaiseChangedEvent)
     {
         ObjectBase = Model.ObjectBase;
         IsEditable = Model.IsEditable;
         Message    = Model.Message;
         Titles     = Model.Titles;
         Website    = Model.Website;
         // no visible update
     }
     else
     {
         objectBase = Model.ObjectBase;
         isEditable = Model.IsEditable;
         message    = Model.Message;
         titles     = Model.Titles;
         website    = Model.Website;
         // no visible update
     }
 }
Esempio n. 26
0
 public void Clear(bool RaiseChangedEvent)
 {
     if (RaiseChangedEvent)
     {
         Num        = 0;
         Sender     = String.Empty;
         Timestamp  = 0;
         Recipients = new List <string>(10);
         Message    = new ServerString();
         Title      = String.Empty;
     }
     else
     {
         num        = 0;
         sender     = String.Empty;
         timestamp  = 0;
         recipients = new List <string>(10);
         message    = new ServerString();
         title      = String.Empty;
     }
 }
Esempio n. 27
0
        public int ReadFrom(byte[] Buffer, int StartIndex = 0)
        {
            int cursor = StartIndex;

            objectBase = new ObjectBase(true, Buffer, cursor);
            cursor    += objectBase.ByteLength;

            lookType = new LookTypeFlags(Buffer[cursor]);
            cursor++;

            message = new ServerString(ChatMessageType.ObjectChatMessage, stringResources, Buffer, cursor);
            cursor += Message.ByteLength;

            // if there is an inscription, additionally read it
            if (LookType.IsEditable || LookType.IsInscribed)
            {
                inscription = new ServerString(ChatMessageType.ObjectChatMessage, stringResources, Buffer, cursor);
                cursor     += Inscription.ByteLength;
            }

            return(cursor - StartIndex);
        }
Esempio n. 28
0
 public void Clear(bool RaiseChangedEvent)
 {
     if (RaiseChangedEvent)
     {
         Num       = 0;
         Sender    = String.Empty;
         Timestamp = 0;
         Recipients.Clear();
         Message            = new ServerString();
         Title              = String.Empty;
         IsTimestampUpdated = false;
     }
     else
     {
         num       = 0;
         sender    = String.Empty;
         timestamp = 0;
         recipients.Clear();
         message            = new ServerString();
         title              = String.Empty;
         isTimeStampUpdated = false;
     }
 }
Esempio n. 29
0
 public void UpdateFromModel(SpellInfo Model, bool RaiseChangedEvent)
 {
     if (RaiseChangedEvent)
     {
         Message    = Model.Message;
         SchoolName = Model.SchoolName;
         SpellLevel = Model.SpellLevel;
         ManaCost   = Model.ManaCost;
         VigorCost  = Model.VigorCost;
         ObjectBase = Model.ObjectBase;
         // don't isvisible
     }
     else
     {
         message    = Model.Message;
         schoolName = Model.SchoolName;
         spellLevel = Model.SpellLevel;
         manaCost   = Model.ManaCost;
         vigorCost  = Model.VigorCost;
         objectBase = Model.ObjectBase;
         // don't isvisible
     }
 }
Esempio n. 30
0
        /// <summary>
        /// Almost exactly like ParseGoPlayer
        /// </summary>
        /// <param name="Words"></param>
        /// <param name="Text"></param>
        /// <param name="Data"></param>
        /// <returns></returns>
        protected static ChatCommandCast ParseCast(string[] Words, string Text, DataController Data)
        {
            Tuple <int, int, string> quote   = null;
            ChatCommandCast          command = null;
            SpellObject        spell         = null;
            string             prefix        = null;
            List <SpellObject> list          = null;
            int num = 0;

            if (Words == null || Words.Length < 2)
            {
                return(null);
            }

            // extract quoted name if second word starts with "
            // this is necessary to not care about quoted text (t someone "yes yes")
            // but only for quoted names (t "mister x" hello!)
            if (Words[1].Length > 0 && Words[1][0] == QUOTECHAR)
            {
                quote = Text.GetQuote();
            }

            /********* QUOTED NAME *********/
            if (quote != null)
            {
                // try get exact match for quoted name
                spell = Data.SpellObjects.GetItemByName(quote.Item3, false);

                if (spell != null)
                {
                    command = new ChatCommandCast(spell);
                }

                // no player with that name
                else
                {
                    Data.ChatMessages.Add(ServerString.GetServerStringForString(
                                              "No spell with name: " + quote.Item3));
                }
            }

            /********* UNQUOTED NAME *********/
            else
            {
                prefix = Words[1];
                list   = Data.SpellObjects.GetItemsByNamePrefix(prefix);

                // extend prefix with more words
                // until there is only one or zero matches found
                // or until there is only one more word left (supposed minimal text)
                num = 2;
                while (list.Count > 1 && num < Words.Length)
                {
                    prefix += DELIMITER + Words[num];
                    list    = Data.SpellObjects.GetItemsByNamePrefix(prefix);
                    num++;
                }

                if (list.Count == 1)
                {
                    command = new ChatCommandCast(list[0]);
                }

                // still more than one player with max. prefix
                else if (list.Count > 1)
                {
                    Data.ChatMessages.Add(ServerString.GetServerStringForString(
                                              "More than one spell with prefix: " + prefix));
                }

                // no spell with that prefix
                else
                {
                    Data.ChatMessages.Add(ServerString.GetServerStringForString(
                                              "No spell with prefix: " + prefix));
                }
            }

            return(command);
        }
Esempio n. 31
0
        public override unsafe void ReadFrom(ref byte* Buffer)
        {
            base.ReadFrom(ref Buffer);

            Message = new ServerString(ChatMessageType.ServerChatMessage, LookupList, ref Buffer);
        }
Esempio n. 32
0
        public void ReadXml(XmlReader Reader)
        {
            // rootnode
            Reader.ReadToFollowing(TAG_MAIL);
            
            // read attributes
            Sender = Reader[ATTRIB_SENDER];
            Timestamp = Convert.ToUInt32(Reader[ATTRIB_TIMESTAMP]);
            Title = Reader[ATTRIB_TITLE];

            // recipients
            Reader.ReadToFollowing(TAG_RECIPIENTS);
            if (Reader.ReadToDescendant(TAG_RECIPIENT))
            {
                do
                {
                    Recipients.Add(Reader[ATTRIB_NAME]);
                }
                while (Reader.ReadToNextSibling(TAG_RECIPIENT));
            }

            // text
            Reader.ReadToFollowing(TAG_TEXT);
            
            // construct chatmessage instance dummy
            Message = new ServerString();
            Message.FullString = Reader.ReadString();
        }
Esempio n. 33
0
        /// <summary>
        /// Creates a colored IRC message string from a ChatMessage instance
        /// </summary>
        /// <param name="ChatMessage"></param>
        /// <returns></returns>
        public static string CreateIRCMessageFromChatMessage(ServerString ChatMessage)
        {
            // prefix
            string s = String.Empty;
  
            // insert styles as IRC chatstyles
            foreach (ChatStyle style in ChatMessage.Styles)
            {
                // bold
                if (style.IsBold)
                    s += IRCCOLOR_BOLD;

                // italic
                if (style.IsCursive)
                    s += IRCCOLOR_ITALIC;

                // underline
                if (style.IsUnderline)
                    s += IRCCOLOR_UNDERLINE;

                // init IRC color
                s += IRCCOLOR_START;

                // add color with lightgrey background
                switch (style.Color)
                {
                    case ChatColor.Black:
                        s += IRCCOLOR_BLACK + "," + IRCCOLOR_GREY;
                        break;

                    case ChatColor.Blue:
                        s += IRCCOLOR_BLUE + "," + IRCCOLOR_GREY;;
                        break;

                    case ChatColor.Green:
                        s += IRCCOLOR_GREEN + "," + IRCCOLOR_GREY;;
                        break;

                    case ChatColor.Purple:
                    case ChatColor.Violet: // no match
                        s += IRCCOLOR_PURPLE + "," + IRCCOLOR_GREY;;
                        break;

                    case ChatColor.Red:
                    case ChatColor.BrightRed: // no IRC match
                        s += IRCCOLOR_RED + "," + IRCCOLOR_GREY;;
                        break;

                    case ChatColor.White:
                        s += IRCCOLOR_WHITE + "," + IRCCOLOR_GREY;;
                        break;

                    case ChatColor.LightGreen:
                        s += IRCCOLOR_LIGHTGREEN + "," + IRCCOLOR_GREY; ;
                        break;

                    case ChatColor.Yellow:
                        s += IRCCOLOR_YELLOW + "," + IRCCOLOR_GREY; ;
                        break;

                    case ChatColor.Pink:
                    case ChatColor.Magenta: // no IRC match
                        s += IRCCOLOR_LIGHTPINK + "," + IRCCOLOR_GREY; ;
                        break;

                    case ChatColor.Orange:
                        s += IRCCOLOR_ORANGE + "," + IRCCOLOR_GREY; ;
                        break;

                    case ChatColor.Cyan:
                    case ChatColor.Aquamarine: // no IRC match
                        s += IRCCOLOR_LIGHTCYAN + "," + IRCCOLOR_GREY; ;
                        break;

                    case ChatColor.Teal:
                        s += IRCCOLOR_TEAL + "," + IRCCOLOR_GREY; ;
                        break;

                    case ChatColor.DarkGrey: // no IRC match
                        s += IRCCOLOR_LIGHTGREY + "," + IRCCOLOR_GREY; ;
                        break;
                }

                // now copy textchunk of this style to output
                s += ChatMessage.FullString.Substring(style.StartIndex, style.Length);

                // appendix
                s += IRCCOLOR_TERM;
            }

            // IRC does not allow \r \n and \0
            // since player messages should not contain them at all (except for shopbot)
            // we remove them here as a final step (don't do earlier!)
            // not worth the work to keeping the last chatstyle to the next irc message start
            s = s.Replace("\r", String.Empty).Replace("\n", String.Empty).Replace(Environment.NewLine, String.Empty).Replace("\0", String.Empty);

            // return
            return s;
        }
Esempio n. 34
0
 public void Clear(bool RaiseChangedEvent)
 {
     if (RaiseChangedEvent)
     {
         Num = 0;
         Sender = String.Empty;
         Timestamp = 0;
         Recipients = new List<string>(10);
         Message = new ServerString();
         Title = String.Empty;
     }
     else
     {
         num = 0;
         sender = String.Empty;
         timestamp = 0;
         recipients = new List<string>(10);
         message = new ServerString();
         title = String.Empty;
     }
 }
Esempio n. 35
0
		public SysMessageMessage(ServerString Message, StringDictionary LookupList)
            : base(MessageTypeGameMode.SysMessage)
        {
            this.LookupList = LookupList;
            this.Message = Message;           
        }
Esempio n. 36
0
        public int ReadFrom(byte[] Buffer, int StartIndex = 0)
        {
            int cursor = StartIndex;

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

            ushort strlen = BitConverter.ToUInt16(Buffer, cursor);
            cursor += TypeSizes.SHORT;
            
            sender = Encoding.Default.GetString(Buffer, cursor, strlen);
            cursor += strlen;

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

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

            recipients = new List<string>();
                
            // get recipients
            for (int i = 0; i < listlen; i++)
            {
                strlen = BitConverter.ToUInt16(Buffer, cursor);
                cursor += TypeSizes.SHORT;

                string recipient = Encoding.Default.GetString(Buffer, cursor, strlen);
                cursor += strlen;

                recipients.Add(recipient);
            }

            // get message
            message = new ServerString(ChatMessageType.ObjectChatMessage, stringResources, Buffer, cursor);
            cursor += message.ByteLength;

            // Now ugly:
            // For some reason the title is encoded into the message body,
            // and not a separate field. It also includes hardcoded "Subject:" string
            string tmp1, tmp2;
            Mail.ParseTitle(message.FullString, out tmp1, out tmp2);

            // update values from parsed results (error: String.Empty)
            title = tmp1;
            message.FullString = tmp2;

            return cursor - StartIndex; 
        }
Esempio n. 37
0
 public Mail(uint Num, string Sender, uint TimeStamp, List<string> Recipients, ServerString Message, string Title)
 {
     num = Num;
     sender = Sender;
     timestamp = TimeStamp;
     recipients = Recipients;
     message = Message;
     title = Title;
 }
 public UserCommandGuildShieldError(ServerString ShieldError, StringDictionary LookupList)
 {
     this.LookupList  = LookupList;
     this.ShieldError = ShieldError;
 }
Esempio n. 39
0
 /// <summary>
 /// Creates a local 'ServerString' instance for given text and
 /// style settings.
 /// </summary>
 /// <param name="Text"></param>
 /// <param name="IsBold"></param>
 /// <param name="IsCursive"></param>
 /// <param name="IsUnderline"></param>
 /// <param name="Color"></param>
 /// <returns></returns>
 public static ServerString GetServerStringForString(
     string Text, 
     bool IsBold = false, 
     bool IsCursive = false, 
     bool IsUnderline = false,
     ChatColor Color = ChatColor.Red)
 {         
     ChatStyle style = new ChatStyle(
         0, Text.Length, IsBold, IsCursive, IsUnderline, Color);
     
     ServerString message = new ServerString();
     message.FullString = Text;
     message.Styles.Add(style);
         
     return message;
 }