public InternetMailMessage(MimeMessage nativeMessage, string identifier) : this(nativeMessage.Headers)
 {
     Uid.Add(ValueFactory.Create(identifier));
     if (nativeMessage.Body is TextPart)
     {
         Texts.Add(new InternetMailText(nativeMessage.Body as TextPart));
     }
     else if (nativeMessage.Body is Multipart)
     {
         var body = nativeMessage.Body as Multipart;
         foreach (var part in body)
         {
             if (part is TextPart)
             {
                 var tpart = part as TextPart;
                 Texts.Add(new InternetMailText(tpart));
             }
             else if (part is MessageDeliveryStatus)
             {
                 // TODO: MessageDeliveryStatus
             }
             else if (part is MessagePart)
             {
                 // Письмо во вложении
                 // TODO: MessagePart
             }
             else
             {
                 // Console.Write("Unchecked type: ");
                 // Console.WriteLine(part.GetType());
             }
         }
     }
 }
Exemple #2
0
        public void AddTab(object tabId = null, string tabText = null, Bitmap icon = null, object tag = null, bool?insertToTheLeft = null, bool select = true)
        {
            lock (_syncRoot)
            {
                tabText = tabText ?? GetDefaultText(Count);
                var tabIcon = icon ?? DefaultIcon;
                int width   = getTabWidth(tabText, tabIcon, CloseIcon);

                TabIds.Add(tabId);
                Texts.Add(tabText);
                Icons.Add(tabIcon);
                Widths.Add(width);
                Tags.Add(tag);
            }

            OnLayout(new LayoutEventArgs(this, null));
            Invalidate();

            int index = Count - 1;

            TabAdded?.Invoke(this, index);

            if (select)
            {
                SelectedIndex = index;
            }

            if ((insertToTheLeft ?? AddNewTabsToTheLeft) && index != 0)
            {
                RelocateTab(index, 0, selectRelocated: select);
            }
        }
Exemple #3
0
        public Paragraph(string text)
            : this()
        {
            IText t = new Text(text);

            Texts.Add(t);
        }
 public SlideStyle(string text)
 {
     Styles.Add(DefaultStyle);
     Colors.Add(DefaultColor);
     Texts.Add(text);
     Backgrounds.Add(DefaultBackground);
 }
        protected void InitTextCulture(Dictionary <byte, string> cultures)
        {
            var tmpCultures = new Dictionary <byte, string>(cultures);

            if (Texts == null)
            {
                Texts = new List <TranslateTextViewModel>();
            }
            else
            {
                foreach (var txt in Texts)
                {
                    if (string.IsNullOrEmpty(txt.CultureName))
                    {
                        txt.CultureName = cultures.TryGetValue(txt.CultureId);
                    }
                    tmpCultures.Remove(txt.CultureId);
                }
            }

            foreach (var culture in tmpCultures)
            {
                Texts.Add(new TranslateTextViewModel {
                    CultureId = culture.Key, CultureName = culture.Value
                });
            }
        }
Exemple #6
0
 public void AddText(Text text)
 {
     if (!Texts.Any(x => x.Path == text.Path))
     {
         Texts.Add(text);
         SaveChanges();
     }
 }
 /// <summary>
 /// Parse text block
 /// </summary>
 /// <remarks>
 /// A text block contains 2 lines
 /// The first line is a name followed by a comma
 /// The second line is the text message, wrapped in double quotes
 /// For example:
 ///
 /// Warning_1,
 /// "Warning :Stay in Formation."
 /// </remarks>
 /// <param name="header"></param>
 /// <param name="message"></param>
 private void ParseText(string header, string message)
 {
     Texts.Add(new ScripterText
     {
         Name       = header.TrimEnd(','),
         Value      = message.Trim('"'),
         LineNumber = _lineNo,
     });
 }
Exemple #8
0
        private void ShowDialog(Func <AddTextDialogViewModel, bool?> showDialog)
        {
            var dialogViewModel = new AddTextDialogViewModel();

            bool?success = showDialog(dialogViewModel);

            if (success == true)
            {
                Texts.Add(dialogViewModel.Text);
            }
        }
        private async void ShowContentDialog(Func <AddTextContentDialogViewModel, IAsyncOperation <ContentDialogResult> > showDialog)
        {
            var dialogViewModel = new AddTextContentDialogViewModel();

            ContentDialogResult result = await showDialog(dialogViewModel);

            if (result == ContentDialogResult.Primary)
            {
                Texts.Add(dialogViewModel.Text);
            }
        }
Exemple #10
0
        /// <summary>
        /// Text
        /// </summary>
        /// <param name="X"></param>
        /// <param name="Y"></param>
        /// <param name="Color"></param>
        /// <param name="Text"></param>
        /// <param name="Font"></param>
        /// <param name="MaxWidth"></param>
        /// <param name="LineSpacing"></param>
        /// <param name="xOffset"></param>
        /// <param name="yOffset"></param>
        /// <returns></returns>
        public Text Text(float X, float Y, Vector4 Color, string Text, Font Font, float MaxWidth = float.MaxValue, float LineSpacing = 1, float xOffset = 0, float yOffset = 0)
        {
            Text t = new Text(this, X, Y, Color, Text, Font, MaxWidth, LineSpacing, xOffset, yOffset);

            Texts.Add(t);

            t.Depth = ZIndex;
            ZIndex += AutoZStep;

            return(t);
        }
Exemple #11
0
        public void ChangeTextsByList(List <string> key, List <string> value)
        {
            Texts.Clear();

            int i = 0;

            foreach (var k in key)
            {
                Texts.Add(k, value[i]);
                i++;
            }
        }
Exemple #12
0
        public Death()
        {
            // Add texts

            Texts.Add(new Text(Color.IndianRed, new Vector2(0, -240), "You have died!"));
            Texts.Add(new Text(Color.White, new Vector2(0, -120), "Lifes left:"));
            Texts.Add(new Text(Color.White, new Vector2(0, 90), "Your score:"));

            // Add button

            Buttons.Add(new RespawnButton("Press R to respawn.", new Vector2(0, 180), Color.LightSlateGray, 4));
        }
        internal DebugBooleanDisplay(boolFunc update_function, string caption,
                                     Maybe <int> caption_width = default(Maybe <int>))
            : base()
        {
            UpdateFunction = () => update_function() ? 0 : 1;
            BgFadeTimes    = new List <int> {
                0, 0
            };
            BgColors = new List <Color> {
                new Color(40, 200, 40), new Color(200, 40, 40)
            };

            int x = 0;

            //Caption
            CaptionText     = new TextSprite();
            CaptionText.loc = new Vector2(x + 4, 0);
            CaptionText.SetFont(Config.UI_FONT);
            CaptionText.text = caption;
            if (caption_width.IsNothing)
            {
                caption_width = CaptionText.text_width + 8;
                caption_width = ((caption_width + 7) / 8) * 8;
            }
            x += caption_width;
            // On
            TextSprite text = new TextSprite();

            text.loc = new Vector2(x + 4, 0);
            text.SetFont(Config.UI_FONT);
            text.text = "On";
            Texts.Add(text);
            Sprite bg = new Sprite();

            bg.loc   = new Vector2(x, 0);
            bg.scale = new Vector2(24 / 16f, 1f);
            bg.tint  = BgColors[0];
            Bgs.Add(bg);
            x += 24;
            // Off
            text     = new TextSprite();
            text.loc = new Vector2(x + 4, 0);
            text.SetFont(Config.UI_FONT);
            text.text = "Off";
            Texts.Add(text);
            bg       = new Sprite();
            bg.loc   = new Vector2(x, 0);
            bg.scale = new Vector2(24 / 16f, 1f);
            bg.tint  = BgColors[0];
            Bgs.Add(bg);

            Width = x + 24;
        }
Exemple #14
0
        public Win()
        {
            // Add texts

            Texts.Add(new Text(Color.MediumVioletRed, new Vector2(0, -240), "You have won the game!"));
            Texts.Add(new Text(Color.White, new Vector2(0, -120), "Lifes left:"));
            Texts.Add(new Text(Color.White, new Vector2(0, 90), "Your score:"));

            // Add button

            Buttons.Add(new Button("Press R to return to main menu.", new Vector2(0, 180), Color.LightSlateGray, 0));
        }
Exemple #15
0
 void AddLabelInfoText(string text, FilterControlFocusInfo focusInfo, Color activeColor, ElementType type, bool active)
 {
     if (active)
     {
         LabelInfoText info = Texts.Add(text, activeColor, true);
         info.Tag = new NodeElement(focusInfo, type);
     }
     else
     {
         Texts.Add(text, activeColor, active);
     }
 }
Exemple #16
0
 public void AddLabel(params String[] captions)
 {
     foreach (var cap in captions)
     {
         Labels.Add(new Label(cap, Location, Font, FontColor));
     }
     foreach (var text in Labels.Select(label => label.Text))
     {
         Texts.Add(text);
     }
     SetPosition(_position);
     CalcLocations(_textAlign);
 }
Exemple #17
0
        public OVR3()
        {
            Name = DateTime.Now.Millisecond.ToString();

            for (int x = 0; x < DateTime.Now.Second; x++)
            {
                Texts.Add(new TextObject(x, this));
            }
            for (int x = 0; x < DateTime.Now.Second; x++)
            {
                Lines.Add(new LineObject(x, this));
            }
        }
Exemple #18
0
        /// <summary>
        /// Load a text file and return its contents
        /// </summary>
        /// <param name="filename">The name of the file</param>
        /// <returns>The loaded text.</returns>
        public static string GetText(string filename)
        {
            ValidateFilename(filename);

            if (Texts.ContainsKey(filename))
            {
                return(Texts[filename]);
            }

            var text = File.ReadAllText(filename);

            Texts.Add(filename, text);
            return(text);
        }
Exemple #19
0
        private void OK_Execute(string obj)
        {
            TextInfo info = new TextInfo()
            {
                Body = obj,
                Time = DateTime.Now
            };

            _context.Texts.Add(info);
            _context.SaveChangesAsync();

            Texts.Add(info);
            SelectedText = info;
        }
Exemple #20
0
        public Character()
        {
            // Add texts

            Texts.Add(new Text(Color.White, new Vector2(0, -280), "Choose your character:"));
            Texts.Add(new Text(Color.White, new Vector2(0, -160), "NaN"));
            Texts.Add(new Text(Color.LightSlateGray, new Vector2(0, -130), "NaN"));
            Texts.Add(new Text(Color.LightSlateGray, new Vector2(0, -100), "NaN"));

            // Add buttons

            Buttons.Add(new Next(">", new Vector2(50, 0), Color.PaleVioletRed));
            Buttons.Add(new Previous("<", new Vector2(-54, 0), Color.PaleVioletRed));
            Buttons.Add(new Select("Select", new Vector2(0, 100), Color.PaleVioletRed));
            Buttons.Add(new Button("Return", new Vector2(0, 180), Color.LightSlateGray, 0));
        }
Exemple #21
0
        public About()
        {
            // Add texts

            Texts.Add(new Text(Color.White, new Vector2(0, -200), "Version " + Assembly.GetExecutingAssembly().GetName().Version + " (reworked)"));
            Texts.Add(new Text(Color.White, new Vector2(0, -120), "Developed by:"));
            Texts.Add(new Text(Color.White, new Vector2(0, -90), "Tomas Zaluckij"));
            Texts.Add(new Text(Color.White, new Vector2(0, -60), "(@Tomaszal)"));
            Texts.Add(new Text(Color.White, new Vector2(0, 0), "Music: Torrey Desmond Rogers"));
            Texts.Add(new Text(Color.White, new Vector2(0, 30), "Sound effects: SoundBible.com"));
            Texts.Add(new Text(Color.White, new Vector2(0, 100), "Background: Wyatt S. Miles (flashpotatoes)"));

            // Add buttons

            Buttons.Add(new Button("Return", new Vector2(0, 180), Color.LightSlateGray, 0));
        }
        public void AddPattern(string text, Bitmap bmp)
        {
            if (string.IsNullOrEmpty(text))
            {
                return;
            }

            var newPattern = Pattern.FromBmp(bmp);

            if (newPattern == null)
            {
                return;
            }

            //// DEBUG
            //Debug.WriteLine(text);
            //Boolean2DimArrayConverter.ToDebugLog(newPattern.Data);

            var textData = Texts.FirstOrDefault(x => x.Text == text);

            if (textData == null)
            {
                Texts.Add(new TextData {
                    Patterns = new List <Pattern> {
                        newPattern
                    }, Text = text
                });
                return;
            }

            // check if pattern is already added
            bool alreadyAdded = false;

            foreach (var p in textData.Patterns)
            {
                if (p.Equals(newPattern))
                {
                    alreadyAdded = true;
                    break;
                }
            }

            if (!alreadyAdded)
            {
                textData.Patterns.Add(newPattern);
            }
        }
        private string AddNewPattern(Pattern newPattern, string text)
        {
            var pat = Texts.FirstOrDefault(x => x.Text == text);

            if (pat != null)
            {
                pat.Patterns.Add(newPattern);
            }
            else
            {
                Texts.Add(newPattern.CreateTextData(text));
            }

            Save?.Invoke();

            return(text);
        }
        private string AddNewPattern(RecognizedCharData sym, string manualChar, bool[,] curPattern)
        {
            var pat = Texts.FirstOrDefault(x => x.Text == manualChar);

            if (pat != null)
            {
                pat.Patterns.Add(curPattern);
            }
            else
            {
                Texts.Add(sym.ToCharData(manualChar));
            }

            Save?.Invoke();

            return(manualChar);
        }
Exemple #25
0
        /// <summary>
        /// Button
        /// </summary>
        /// <param name="X"></param>
        /// <param name="Y"></param>
        /// <param name="Width"></param>
        /// <param name="Height"></param>
        /// <param name="Color"></param>
        /// <param name="Text"></param>
        /// <param name="Font"></param>
        /// <param name="LineSpacing"></param>
        /// <param name="xOffset"></param>
        /// <param name="yOffset"></param>
        /// <returns></returns>
        public Button Button(float X, float Y, float Width, float Height, Vector4 Color, string Text, Font Font, float LineSpacing = 1, float xOffset = 0, float yOffset = 0)
        {
            //Button
            Button b = new Button(this, X, Y, Width, Height, Color, Text, Font, LineSpacing, xOffset, yOffset);

            Elements.Add(b);
            b.Depth = ZIndex;
            ZIndex += AutoZStep;

            //Text
            Texts.Add(b.Text);
            b.Text.Depth = ZIndex;
            ZIndex      += AutoZStep;

            //Return Button
            return(b);
        }
        public InternetMailMessage(MimeMessage nativeMessage, string identifier) : this(nativeMessage.Headers)
        {
            Uid.Add(ValueFactory.Create(identifier));
            if (nativeMessage.Body is TextPart)
            {
                Texts.Add(new InternetMailText(nativeMessage.Body as TextPart));
            }
            else if (nativeMessage.Body is Multipart)
            {
                var body = nativeMessage.Body as Multipart;
                foreach (var part in body)
                {
                    if (part is TextPart)
                    {
                        var tpart = part as TextPart;
                        Texts.Add(new InternetMailText(tpart));
                    }
                    else if (part is MessageDeliveryStatus)
                    {
                        // TODO: MessageDeliveryStatus
                    }
                    else if (part is MessagePart)
                    {
                        // Письмо во вложении
                        // TODO: MessagePart
                    }
                    else
                    {
                        // Console.Write("Unchecked type: ");
                        // Console.WriteLine(part.GetType());
                    }
                }
            }

            foreach (var attachment in nativeMessage.Attachments)
            {
                var part     = (MimePart)attachment;
                var fileName = part.FileName;
                var stream   = new MemoryStream();

                part.ContentObject.DecodeTo(stream);
                BinaryDataContext bin = new BinaryDataContext(stream.ToArray());
                Attachments.Add(bin, fileName);
            }
        }
        private void AddString(string ws, string text)
        {
            if (Texts == null)
            {
                Texts = new List <string>();
                WsIds = new List <string>();
            }
            var index = WsIds.IndexOf(ws);

            if (index >= 0)
            {
                Texts[index] = Texts[index] + string.Format(", {0}", text);
            }
            else
            {
                Texts.Add(text);
                WsIds.Add(ws);
            }
        }
Exemple #28
0
        public override void Deserialize(XElement element)
        {
            Lang = element.Attribute(element.GetNamespaceOfPrefix("xml") + "lang")?.Value;

            foreach (var textElement in element.SubElements("Text"))
            {
                var text = new Text();
                text.Deserialize(textElement);

                Texts.Add(text);
            }

            foreach (var textElement in element.SubElements("TextRedefine"))
            {
                var text = new TextRedefine();
                text.Deserialize(textElement);

                TextRedefines.Add(text);
            }
        }
Exemple #29
0
        private static void DumpMenu(IntPtr Handler)
        {
            int MenuCount = GetMenuItemCount(Handler);

            if (MenuCount == -1)
            {
                return;
            }
            var MenuInfo = new MENUITEMINFO();

            for (int i = 0; i < MenuCount; i++)
            {
                MenuInfo = new MENUITEMINFO()
                {
                    cbSize     = MENUITEMINFO.SizeOf,
                    fMask      = MIIM_STRING | MIIM_SUBMENU,
                    fType      = MFT_STRING,
                    dwTypeData = new string(new char[1024]),
                    cch        = 1025
                };

                bool Sucess = GetMenuItemInfo(Handler, i, true, ref MenuInfo);

                string Text = MenuInfo.dwTypeData;

                if (MenuInfo.hSubMenu != IntPtr.Zero)
                {
                    DumpMenu(MenuInfo.hSubMenu);
                }

                if (Texts.Contains(Text) || string.IsNullOrWhiteSpace(Text))
                {
                    continue;
                }

                Texts.Add(Text);

                Console.WriteLine("Text Hooked: {0}", Text);
            }
        }
Exemple #30
0
        public void SetByString(string str)
        {
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(str);

            XmlNode root = doc.SelectNodes("/Texts")[0];

            _name   = root.SelectNodes("Name")[0].InnerText;
            _region = root.SelectNodes("Region")[0].InnerText;
            _code   = root.SelectNodes("Code")[0].InnerText;

            Texts.Clear();

            foreach (XmlNode it in root.SelectNodes("Text"))
            {
                string key   = it.Attributes["Key"].Value;
                string value = it.Attributes["Value"].Value;

                Texts.Add(key, value);
            }
        }