Example #1
0
        public void Broadcast(string message)
        {
            foreach (var tab in items)
            {
                ChatText tmp = new ChatText();

                tmp.Time          = GetTime();
                tmp.ChannelShort  = "[N]";
                tmp.Channel       = "Notice";
                tmp.Sender        = "";
                tmp.ChannelColour = ConvertForArray("Notice");
                List <TextTypes> rawtext = new List <TextTypes>();

                PayloadType payloadType = PayloadType.RawText;
                TextTypes   wrangler    = new TextTypes();
                wrangler.Text = message;
                wrangler.Type = payloadType;
                rawtext.Add(wrangler);

                tmp.Text = rawtext;
                tab.Chat.Add(tmp);

                if (tab.Chat.Count > 256)
                {
                    tab.Chat.RemoveAt(0);
                }

                if (tab.AutoScroll == true)
                {
                    tab.Scroll = true;
                }
            }
        }
Example #2
0
        public void DrawText(SpriteFont font, String text, TextTypes type)
        {
            // Find the center of the string
            var FontOrigin = new Vector2(0f, 0f); //font.MeasureString(text) / 2;
            // Draw the string
            var FontPos = new Vector2(5f, 5f);
            Color textColour = Color.Red;

            switch (type)
            {
                case TextTypes.Debug:
                    break;
                case TextTypes.Health:
                    FontPos = new Vector2(scene.game.GraphicsDevice.Viewport.Width - font.MeasureString(text).X,
                        scene.game.GraphicsDevice.Viewport.Height - 40);
                    textColour = Color.Red;
                    break;
                case TextTypes.Message:
                    break;
                case TextTypes.Score:
                    textColour = Color.LightGreen;
                    // FontPos = new Vector2(20f,50f);
                    break;
            }
            scene.game.spriteBatch.Begin();
            scene.game.spriteBatch.DrawString(font, text, FontPos, textColour,
                0, FontOrigin, 1.0f, SpriteEffects.None, 0.5f);
            scene.game.spriteBatch.End();
        }
Example #3
0
        public void Tran(XivChatType type, string messageString, string senderName)
        {
            string output = Translate(messageString);

            if (injectChat == true)
            {
                PrintChat(type, senderName, lTr + output + rTr);
            }

            foreach (var tab in items)
            {
                if (tab.Logs[ConvertForArray(type.ToString())] && tab.Config[2])
                {
                    ChatText tmp = new ChatText();

                    tmp.Time         = GetTime();
                    tmp.ChannelShort = GetChannelName(type.ToString());
                    tmp.Channel      = type.ToString();
                    tmp.Sender       = senderName;

                    TextTypes translate = new TextTypes();
                    translate.Text = lTr + output + rTr;
                    translate.Type = PayloadType.RawText;
                    tmp.Text.Add(translate);

                    tab.Chat.Add(tmp);
                }
            }
        }
Example #4
0
 public ColorString(Vector4 color1, Vector4 color2, TextTypes source)
 {
     this.SourcePayloadContainer = source;
     if (this.SourcePayloadContainer != null)
     {
         this.SourcePayloadContainer.SetHighlightColor(color1, color2);
     }
 }
 /// <summary>
 /// 判断是否全部都是某种文字
 /// </summary>
 /// <param name="text">文字信息</param>
 /// <param name="textType">文字类型</param>
 /// <returns></returns>
 public bool IsAll(string text, TextTypes textType)
 {
     return(IsAll(text, new List <WordType>()
     {
         WordType.BaseChinese,
         WordType.BaseChineseExt
     }));
 }
Example #6
0
 public ColorString(ColorString copy, string newText)
 {
     this.Text                   = newText;
     this.Color                  = copy.Color;
     this.ShadowColor            = copy.ShadowColor;
     this.ReferenceColor         = copy.ReferenceColor;
     this.ReferenceShadowColor   = copy.ReferenceShadowColor;
     this.UseChannelColors       = copy.UseChannelColors;
     this.SourcePayloadContainer = copy.SourcePayloadContainer;
 }
Example #7
0
        /// <summary>
        /// Add text message
        /// </summary>
        /// <param name="message">Message</param>
        /// <param name="type">Type</param>
        /// /// <param name="position">Text Position</param>
        public static void AddTextMessage(string message, TextTypes type, Vector2 position)
        {
            // Check number of texts that were added in the last 400 ms!
            int numOfRecentTexts = 0;

            for (int num = 0; num < fadeupTexts.Count; num++)
            {
                FadeupText fadeupText = fadeupTexts[num];
                if (fadeupText.showTimeMs > FadeupText.MaxShowTimeMs - 400)
                {
                    numOfRecentTexts++;
                }
            } // for (num)

            fadeupTexts.Add(new FadeupText(message, TextTypeColors[(int)type], ConvertUnits.ToDisplayUnits(position)));
            // Add offset to this text to be displayed below the already existing
            // texts! This fixes the overlapping texts!
            fadeupTexts[fadeupTexts.Count - 1].showTimeMs += numOfRecentTexts * 400;
        } // AddTextMessage(message, type)
        /// <summary>
        /// 判断是否存在某种文字
        /// </summary>
        /// <param name="text">文字信息</param>
        /// <param name="textType">文字类型</param>
        /// <returns></returns>
        public bool IsExist(string text, TextTypes textType)
        {
            if (textType.Id == TextTypes.Simplified.Id || textType.Id == TextTypes.Traditional.Id)
            {
                return(IsExist(text, new List <WordType>()
                {
                    WordType.BaseChinese,
                    WordType.BaseChineseExt
                }));
            }

            if (textType.Id == TextTypes.Japanese.Id)
            {
                return(IsExist(text, new List <WordType>()
                {
                    WordType.JapaneseHiragana,
                    WordType.JapaneseKatakana,
                    WordType.JapaneseKatakanaSpellExt
                }));
            }

            return(false);
        }
Example #9
0
            public static IEnumerable <ColorString> FromItem(string str, ItemPayload item, TextTypes source)
            {
                var color1 = new Vector4(1, 1, 1, 1);
                var color2 = new Vector4(0, 0, 0, 1);

                switch (item.Item.Rarity)
                {
                case 2:
                    color1 = new Vector4(0.6549f, 0.92156f, 0.6549f, 1);
                    break;

                case 3:
                    color1 = new Vector4(0.21568f, 0.46274f, 0.92156f, 1);
                    break;

                case 4:
                    color1 = new Vector4(0.6f, 0.44705f, 0.92156f, 1);
                    break;

                default:
                    break;
                }

                yield return(MakeLinkChar(source));

                foreach (var s in FromStringSplitDelimiters(str, color1, color2, source))
                {
                    yield return(s);
                }
                if (item.Item.IsCollectable)
                {
                    yield return(MakeCollectibleChar(color1, color2, source));
                }
                if (item.IsHQ)
                {
                    yield return(MakeHqChar(color1, color2, source));
                }
            }
Example #10
0
            public static IEnumerable <ColorString> FromStatus(string str, ColorRef color, ColorRef shadowColor, StatusPayload status, TextTypes source)
            {
                yield return(MakeLinkChar(source));

                if (status.Status.Category == 1) // Buff
                {
                    yield return(MakeBuffChar(source));
                }
                else if (status.Status.Category == 2) // Debuff
                {
                    yield return(MakeDebuffChar(source));
                }
                foreach (var s in FromStringSplitDelimiters(str, color, shadowColor, source))
                {
                    yield return(s);
                }
            }
Example #11
0
            public static IEnumerable <ColorString> FromMapLink(string str, ColorRef color, ColorRef shadowColor, MapLinkPayload map, TextTypes source)
            {
                yield return(MakeLinkChar(source));

                foreach (var s in FromStringSplitDelimiters(str, color, shadowColor, source))
                {
                    yield return(s);
                }
            }
Example #12
0
            public static IEnumerable <ColorString> PlayerName(string str, ColorRef color, ColorRef shadowColor, PlayerPayload player, TextTypes source = null)
            {
                if (str.Contains('\uE500'))
                {
                    var parts = Regex.Split(str, $"(\uE500|{player.PlayerName})");

                    foreach (var p in parts)
                    {
                        if (p == "\uE500")
                        {
                            yield return(MakeCrossWorldChar(null));
                        }
                        else if (p == player.PlayerName)
                        {
                            foreach (var s in FromStringSplitDelimiters(p, color, shadowColor, source))
                            {
                                yield return(s);
                            }
                        }
                        else
                        {
                            foreach (var s in FromStringSplitDelimiters(p, color, shadowColor, null))
                            {
                                yield return(s);
                            }
                        }
                    }
                }
                else
                {
                    foreach (var s in FromStringSplitDelimiters(str, color, shadowColor, source))
                    {
                        yield return(s);
                    }
                }
            }
Example #13
0
 public static IEnumerable <ColorString> FromString(string str, ColorRef color, ColorRef shadowColor, TextTypes source = null)
 {
     return(FromStringSplitDelimiters(str, color, shadowColor, source));
 }
Example #14
0
 private static IEnumerable <ColorString> FromStringSplitDelimiters(string str, Vector4 color, Vector4 shadowColor, TextTypes source = null)
 {
     return(Regex.Split(str, delimiterRegex, RegexOptions.Compiled).Select(x =>
     {
         return new ColorString(color, shadowColor, source)
         {
             Text = x,
             Color = color,
             ShadowColor = shadowColor
         };
     }));
 }
Example #15
0
    public static void FloatText(Vector3 loc_in, string text_in, TextTypes type_in)
    {
        GameObject newText = Instantiate(Resources.Load("FloatingText"), loc_in, Quaternion.Euler(90, 0, 0)) as GameObject;

        newText.GetComponent <FloatingTextBehavior>().CreateFloatingText(text_in, type_in);
    }
        private void Chat_OnChatMessage(XivChatType type, uint senderId, ref SeString sender, ref SeString message, ref bool isHandled)
        {
            try
            {
                if (!isHandled)
                {
                    var            senderName = sender.TextValue;
                    List <Payload> payloads   = message.Payloads;
                    int            chan       = ConvertForArray(type.ToString());
                    ChatText       tmp        = new ChatText();

                    tmp.Time         = GetTime();
                    tmp.DateTime     = DateTime.Now;
                    tmp.ChannelShort = GetChannelName(type.ToString());
                    tmp.SenderId     = senderId;

                    //PluginLog.Log(senderId.ToString());
                    //PluginLog.Log(senderName);

                    try
                    {
                        tmp.Channel = Channels[chan].Trim().Replace(" ", "");
                    }
                    catch (Exception)
                    {
                        tmp.Channel = chan.ToString();
                    }

                    tmp.Sender        = senderName;
                    tmp.ChannelColour = ConvertForArray(type.ToString());

                    List <TextTypes> rawtext = new List <TextTypes>();

                    int         replace     = 0;
                    Payload     payloader   = null;
                    PayloadType payloadType = PayloadType.RawText;

                    //Handling Emotes
                    if (tmp.Channel == "StandardEmote")
                    {
                        tmp.Sender = "";
                    }

                    if (tmp.Channel == "CustomEmote")
                    {
                        tmp.Sender = "";
                        TextTypes wrangle = new TextTypes();
                        wrangle.Type = PayloadType.RawText;
                        wrangle.Text = senderName;
                        rawtext.Add(wrangle);
                    }
                    //Handling Tells
                    if (tmp.Channel == "TellOutgoing")
                    {
                        TextTypes wrangle = new TextTypes();
                        wrangle.Type = PayloadType.RawText;
                        wrangle.Text = ">>" + tmp.Sender + ":";
                        rawtext.Add(wrangle);
                        tmp.Sender = pluginInterface.ClientState.LocalPlayer.Name.ToString();
                    }
                    if (tmp.Channel == "TellIncoming")
                    {
                        TextTypes wrangle = new TextTypes();
                        wrangle.Type = PayloadType.RawText;
                        wrangle.Text = ">>";
                        rawtext.Add(wrangle);
                    }


                    foreach (var payload in payloads)
                    {
                        if (payload.Type == PayloadType.MapLink)
                        {
                            replace     = 2;
                            payloadType = PayloadType.MapLink;
                            payloader   = payload;
                        }

                        if (payload.Type == PayloadType.RawText)
                        {
                            TextTypes wrangler = new TextTypes();
                            wrangler.Text = payload.ToString().Split(new[] { ' ' }, 4)[3];

                            if (replace == 1)
                            {
                                if (payloadType == PayloadType.MapLink)
                                {
                                    rawtext.RemoveAt(rawtext.Count - 1);
                                    wrangler.Payload = payloader;
                                }
                            }

                            if (replace == 0)
                            {
                                payloadType = PayloadType.RawText;
                            }

                            wrangler.Type = payloadType;
                            rawtext.Add(wrangler);

                            if (replace > 0)
                            {
                                replace--;
                            }
                        }
                    }

                    tmp.Text = rawtext;

                    if (System.Text.RegularExpressions.Regex.Match(tmp.Sender, "^[-]").Success)
                    {
                        tmp.Sender = tmp.Sender.Substring(1);
                    }

                    if (bubbleEnable[chan])
                    {
                        ChatBubbleAdd(tmp);
                    }



                    foreach (var tab in items)
                    {
                        if (chan < Channels.Length && tab.Logs[chan])
                        {
                            tab.Chat.Enqueue(tmp);
                            tab.msg = true;

                            if (tab.Chat.Count > 256)
                            {
                                tab.Chat.TryDequeue(out ChatText pop);
                            }

                            if (tab.Config[3])
                            {
                                //Writing to file
                                string filename = GetDate() + "_" + tab.Title + ".txt";
                                if (!System.IO.Directory.Exists(pathString))
                                {
                                    System.IO.Directory.CreateDirectory(pathString);
                                }

                                if (!System.IO.File.Exists(pathString + filename))
                                {
                                    System.IO.File.WriteAllText(pathString + filename, tab.Title + "\n");
                                }

                                using (System.IO.StreamWriter file = new System.IO.StreamWriter(pathString + filename, true))
                                { file.WriteLine(tmp.Time + "[" + tmp.Channel + "]" + "<" + tmp.Sender + ">:" + TextTypesToString(rawtext)); }
                            }

                            if (tab.AutoScroll == true)
                            {
                                tab.Scroll = true;
                            }
                        }
                        else
                        {
                        }       //PluginLog.Log("[" + chan.ToString() + "] " + message.TextValue);
                    }

                    if (allowTranslation)
                    {
                        String messageString     = message.TextValue;
                        String predictedLanguage = Lang(messageString);
                        if (predictedLanguage == language)
                        {
                            Task.Run(() => Tran(type, messageString, senderName));
                        }
                    }
                }
            }
            catch (Exception e)
            {
                PluginLog.LogError(e.ToString());
            }
        }
Example #17
0
        private void Chat_OnChatMessage(XivChatType type, uint senderId, ref SeString sender, ref SeString message, ref bool isHandled)
        {
            try
            {
                var            senderName = sender.TextValue;
                List <Payload> payloads   = message.Payloads;


                foreach (var tab in items)
                {
                    int chan = ConvertForArray(type.ToString());
                    if (chan < Channels.Length)
                    {
                        if (tab.Logs[chan])
                        {
                            ChatText tmp = new ChatText();

                            tmp.Time         = GetTime();
                            tmp.ChannelShort = GetChannelName(type.ToString());
                            try
                            {
                                tmp.Channel = Channels[chan].Trim().Replace(" ", "");
                            }
                            catch (Exception)
                            {
                                tmp.Channel = chan.ToString();
                            }

                            tmp.Sender        = senderName;
                            tmp.ChannelColour = ConvertForArray(type.ToString());
                            List <TextTypes> rawtext = new List <TextTypes>();

                            int         replace     = 0;
                            Payload     payloader   = null;
                            PayloadType payloadType = PayloadType.RawText;
                            foreach (var payload in payloads)
                            {
                                //if (payload.Type == PayloadType.AutoTranslateText) { texttype = 0; }
                                //if (payload.Type == PayloadType.Item) { texttype = 1; }
                                if (payload.Type == PayloadType.MapLink)
                                {
                                    replace     = 2;
                                    payloadType = PayloadType.MapLink;
                                    payloader   = payload;
                                }
                                //if (payload.Type == PayloadType.Player) { texttype = 3; }
                                //if (payload.Type == PayloadType.RawText) { texttype = 4; }
                                //if (payload.Type == PayloadType.Status) { texttype = 5; }
                                //if (payload.Type == PayloadType.UIForeground) { texttype = 6; }
                                //if (payload.Type == PayloadType.UIGlow) { texttype = 7; }

                                if (payload.Type == PayloadType.RawText)
                                {
                                    TextTypes wrangler = new TextTypes();
                                    wrangler.Text = payload.ToString().Split(new[] { ' ' }, 4)[3];

                                    if (replace == 1)
                                    {
                                        if (payloadType == PayloadType.MapLink)
                                        {
                                            rawtext.RemoveAt(rawtext.Count - 1);
                                            wrangler.Payload = payloader;
                                        }
                                    }

                                    if (replace == 0)
                                    {
                                        payloadType = PayloadType.RawText;
                                    }

                                    wrangler.Type = payloadType;
                                    rawtext.Add(wrangler);

                                    if (replace > 0)
                                    {
                                        replace--;
                                    }
                                }

                                //PluginLog.Log(payload.ToString());
                            }

                            tmp.Text = rawtext;

                            String messageString     = message.TextValue;
                            String predictedLanguage = Lang(messageString);

                            if (predictedLanguage == language)
                            {
                                Task.Run(() => Tran(type, messageString, senderName));
                            }

                            tab.Chat.Add(tmp);

                            if (tab.Chat.Count > 256)
                            {
                                tab.Chat.RemoveAt(0);
                            }

                            if (tab.Config[3])
                            {
                                //Writing to file
                                string filename = GetDate() + "_" + tab.Title + ".txt";
                                if (!System.IO.Directory.Exists(pathString))
                                {
                                    System.IO.Directory.CreateDirectory(pathString);
                                }

                                if (!System.IO.File.Exists(pathString + filename))
                                {
                                    System.IO.File.WriteAllText(pathString + filename, tab.Title + "\n");
                                }

                                using (System.IO.StreamWriter file = new System.IO.StreamWriter(pathString + filename, true))
                                {
                                    file.WriteLine(tmp.Time + "[" + tmp.Channel + "]" + "<" + tmp.Sender + ">:" + TextTypesToString(rawtext));
                                }
                            }

                            if (tab.AutoScroll == true)
                            {
                                tab.Scroll = true;
                            }
                            tab.msg = true;
                        }
                    }
                    else
                    {
                        PluginLog.Log("[" + chan.ToString() + "] " + message.TextValue);
                    }
                }
            }
            catch (Exception e)
            {
                PluginLog.LogError(e.ToString());
            }
        }
Example #18
0
 private static ColorString MakeCrossWorldChar(TextTypes source = null)
 {
     return(new ColorString {
         Text = "\uE500", Color = new Vector4(1, 1, 1, 1), ShadowColor = new Vector4(0.2f, 0.16f, 0.745f, 1)
     });
 }
Example #19
0
 private static ColorString MakeLinkChar(TextTypes source = null)
 {
     return(new ColorString {
         Text = "\uE0BB", Color = new Vector4(1, 0.41568f, 0.06274f, 1), ShadowColor = new Vector4(0, 0, 0, 1), SourcePayloadContainer = source
     });
 }
Example #20
0
        /// <summary>
        /// Add text message
        /// </summary>
        /// <param name="message">Message</param>
        /// <param name="type">Type</param>
        public static void AddTextMessage(string message, TextTypes type)
        {
            // Check number of texts that were added in the last 400 ms!
            int numOfRecentTexts = 0;
            for (int num = 0; num < fadeupTexts.Count; num++)
            {
                FadeupText fadeupText = fadeupTexts[num];
                if (fadeupText.showTimeMs > FadeupText.MaxShowTimeMs - 400)
                    numOfRecentTexts++;
            } // for (num)

            fadeupTexts.Add(new FadeupText(message, TextTypeColors[(int)type]));
            // Add offset to this text to be displayed below the already existing
            // texts! This fixes the overlapping texts!
            fadeupTexts[fadeupTexts.Count - 1].showTimeMs += numOfRecentTexts * 400;
        }
Example #21
0
 private static ColorString MakeBuffChar(TextTypes source = null)
 {
     return(new ColorString {
         Text = "\uE05C", Color = new Vector4(0.33333f, 0.79215f, 1, 1), ShadowColor = new Vector4(0, 0, 0, 1), SourcePayloadContainer = source
     });
 }
        private static ParamBinding BuildParamFromSimpleType(object param, Type paramType)
        {
            var underlyingType = Nullable.GetUnderlyingType(paramType);

            if (underlyingType != null)
            {
                paramType = underlyingType;
            }

            var stringValue = param == null ? null : string.Format(CultureInfo.InvariantCulture, "{0}", param);

            if (TextTypes.Contains(paramType))
            {
                return new ParamBinding()
                       {
                           Type = "TEXT", Value = stringValue
                       }
            }
            ;

            if (FixedTypes.Contains(paramType))
            {
                return new ParamBinding()
                       {
                           Type = "FIXED", Value = stringValue
                       }
            }
            ;

            if (paramType == typeof(bool))
            {
                return new ParamBinding()
                       {
                           Type = "BOOLEAN", Value = stringValue
                       }
            }
            ;

            if (RealTypes.Contains(paramType))
            {
                return new ParamBinding()
                       {
                           Type = "REAL", Value = stringValue
                       }
            }
            ;

            if (paramType == typeof(DateTime))
            {
                return new ParamBinding()
                       {
                           Type  = "TIMESTAMP_NTZ",
                           Value = param == null ? null : SnowflakeTypesConverter.ConvertToTimestampNtz((DateTime)param)
                       }
            }
            ;

            if (paramType == typeof(DateTimeOffset))
            {
                return new ParamBinding()
                       {
                           Type  = "TIMESTAMP_TZ",
                           Value = param == null ? null : SnowflakeTypesConverter.ConvertToTimestampTz((DateTimeOffset)param)
                       }
            }
            ;

            if (paramType == typeof(byte[]))
            {
                return new ParamBinding()
                       {
                           Type  = "BINARY",
                           Value = param == null ? null : SnowflakeTypesConverter.BytesToHex((byte[])param)
                       }
            }
            ;

            return(null);
        }
Example #23
0
        public List <TextTypes> ProcessPayloads(List <Payload> payloads, ChannelSettings channel)
        {
            List <TextTypes> result = new List <TextTypes>();
            var prevType            = (PayloadType)(-1);

            int i = 0;

            while (i < payloads.Count)
            {
                var currentPayload = payloads[i];
                var payloadType    = currentPayload.Type;
                var skipPayload    = false;
                var movePastLink   = false;

                var textItem = new TextTypes
                {
                    Payload = currentPayload,
                    Type    = payloadType
                };

                switch (payloadType)
                {
                case PayloadType.Player:
                    var playerPayload = (PlayerPayload)currentPayload;
                    var playerName    = ((TextPayload)payloads[i + 1]).Text;
                    textItem.Text = $"{playerName}\uE500{playerPayload.World.Name}";
                    movePastLink  = true;
                    break;

                case PayloadType.MapLink:
                    var mapTextPayload = (TextPayload)payloads[i + 6];
                    textItem.Text = mapTextPayload.Text;
                    movePastLink  = true;
                    break;

                case PayloadType.Status:
                    var statusPayload = (StatusPayload)currentPayload;
                    textItem.Text = statusPayload.Status.Name;
                    movePastLink  = true;
                    break;

                case PayloadType.Item:
                    var itemPayload = (ItemPayload)currentPayload;
                    if (channel.Name != "Synthesis")
                    {
                        textItem.Text = itemPayload.Item.Name;
                    }
                    else if (itemPayload.Item.StackSize > 1)
                    {
                        textItem.Text = itemPayload.Item.Plural;
                    }
                    else
                    {
                        textItem.Text = itemPayload.Item.Singular;
                    }
                    textItem.Text = Regex.Replace(textItem.Text, @"[\u0000-\u001F]+", string.Empty);

                    movePastLink = true;
                    break;

                case PayloadType.RawText:
                    var textPayload = (TextPayload)currentPayload;
                    if (prevType == PayloadType.Player)
                    {
                        if (textPayload.Text.Contains(' '))
                        {
                            textItem.Text = textPayload.Text.Substring(textPayload.Text.IndexOf(' '));
                        }
                        else
                        {
                            skipPayload = true;
                        }
                    }
                    else
                    {
                        textItem.Text = textPayload.Text;
                    }
                    i++;
                    break;

                default:
                    skipPayload = true;
                    i++;
                    break;
                }

                if (!skipPayload)
                {
                    prevType = payloadType;
                    result.Add(textItem);
                }
                if (movePastLink)
                {
                    for (; i < payloads.Count(); i++)
                    {
                        var nextPayload = payloads[i];

                        if (nextPayload.Type == PayloadType.Unknown)
                        {
                            var unknownPayload = (RawPayload)nextPayload;

                            if (unknownPayload.Data.SequenceEqual(RawPayload.LinkTerminator.Data))
                            {
                                i++;
                                break;
                            }
                        }
                    }
                }
            }

            return(result);
        }
Example #24
0
 private static ColorString MakeDebuffChar(TextTypes source = null)
 {
     return(new ColorString {
         Text = "\uE05B", Color = new Vector4(1, 0, 0, 1), ShadowColor = new Vector4(0, 0, 0, 1), SourcePayloadContainer = source
     });
 }
Example #25
0
        /// <summary>
        /// Převede text do formy vhodné k šifrování a dešifrování
        /// Odstraní diakritiku, převede text na malá/velká písmena, 
        /// odstraní všechna nepísmena včetně/mimo mezer.
        /// </summary>
        /// <param name="text">Text, který chceme normalizovat</param>
        /// <param name="textType">Typ normalizace</param>
        /// <returns>Normalizovaný řetězec</returns>
        public static string NormalizeText(string text, TextTypes textType)
        {
            string normText = text.RemoveDiacritics().Replace(new string[] { ".", ",", "!", "?", "\n", "\r", ";", " " }, " ");

            switch (textType)
            {
                case TextTypes.WithoutSpacesLower:
                    return normText.Filter(c => TextAnalysis.IsEnglishLetter(c)).ToLower();
                case TextTypes.WithoutSpacesUpper:
                    return normText.Filter(c => TextAnalysis.IsEnglishLetter(c)).ToUpper();
                case TextTypes.WithSpacesLower:
                    return TextAnalysis.GetLetters(normText).ToLower();
                case TextTypes.WithSpacesUpper:
                    return TextAnalysis.GetLetters(normText).ToUpper();
                default:
                    throw new NotImplementedException();
            }
        }
Example #26
0
 private static ColorString MakeHqChar(Vector4 color1, Vector4 color2, TextTypes source = null)
 {
     return(new ColorString {
         Text = "\uE03C", Color = color1, ShadowColor = color2, SourcePayloadContainer = source
     });
 }