コード例 #1
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            TextItem textItem = db.TextItems.Find(id);

            textItem.IsDeleted    = true;
            textItem.DeletionDate = DateTime.Now;

            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public void TextItemInstantiation()
        {
            var options = new TextItemOptions();

            SetTextItemOptions(options);
            var text_item = new TextItem("-1", "-1", options);

            AssertTextItem(text_item, options);
            AssertTextItem(text_item, text_item.GetOptions());
        }
コード例 #3
0
ファイル: TextRendering.cs プロジェクト: CasperTech/radegast
        void PrepareText(TextItem item)
        {
            // If we're modified and have texture already delete it from graphics card
            if (item.TextureID > 0)
            {
                //GL.DeleteTexture(item.TextureID);
                item.TextureID = -1;
            }

            Size s;

            try
            {
                s = TextRenderer.MeasureText(
                    item.Text,
                    item.Font,
                    TextRendering.MaxSize,
                    item.Flags);
            }
            catch
            {
                return;
            }

            item.ImgWidth  = s.Width;
            item.ImgHeight = s.Height;

            if (!RenderSettings.TextureNonPowerOfTwoSupported)
            {
                item.ImgWidth  = RHelp.NextPow2(s.Width);
                item.ImgHeight = RHelp.NextPow2(s.Height);
            }

            Bitmap img = new Bitmap(
                item.ImgWidth,
                item.ImgHeight,
                System.Drawing.Imaging.PixelFormat.Format32bppArgb);

            Graphics g = Graphics.FromImage(img);

            g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;

            TextRenderer.DrawText(
                g,
                item.Text,
                item.Font,
                new Rectangle(0, 0, s.Width + 2, s.Height + 2),
                Color.White,
                Color.Transparent,
                item.Flags);

            item.TextureID = RHelp.GLLoadImage(img, true, false);
            g.Dispose();
            img.Dispose();
        }
コード例 #4
0
        private ThermalLabel GenerateThermalLabelDataBinding()
        {
            //Define a ThermalLabel object and set unit to inch and label size
            ThermalLabel tLabel = new ThermalLabel(UnitType.Inch, 3, 2);

            tLabel.GapLength = 0.2;

            //Define a TextItem object for product name
            TextItem txt = new TextItem(0.1, 0.1, 2.8, 0.5, "");

            //set data field
            txt.DataField = "Name";
            //set font
            txt.Font.Name = Neodynamic.SDK.Printing.Font.NativePrinterFontA;
            txt.Font.Unit = FontUnit.Point;
            txt.Font.Size = 10;
            //set border
            txt.BorderThickness = new FrameThickness(0.03);
            //set alignment
            txt.TextAlignment = TextAlignment.Center;
            txt.TextPadding   = new FrameThickness(0, 0.1, 0, 0);

            //Define a BarcodeItem object for encoding product id with a Code 128 symbology
            BarcodeItem bc = new BarcodeItem(0.1, 0.57, 2.8, 1.3, BarcodeSymbology.Code128, "");

            //set data field
            bc.DataField = "Id";
            //set barcode size
            bc.BarWidth  = 0.01;
            bc.BarHeight = 0.75;
            //set barcode alignment
            bc.BarcodeAlignment = BarcodeAlignment.MiddleCenter;
            //set text alignment
            bc.CodeAlignment = BarcodeTextAlignment.BelowCenter;
            //set border
            bc.BorderThickness = new FrameThickness(0.03);

            //Add items to ThermalLabel object...
            tLabel.Items.Add(txt);
            tLabel.Items.Add(bc);

            //Create data source...
            List <Product> products = new List <Product>();

            products.Add(new Product("OO2935", "Olive Oil"));
            products.Add(new Product("CS4948", "Curry Sauce"));
            products.Add(new Product("CH0094", "Chocolate"));
            products.Add(new Product("MZ1027", "Mozzarella"));

            //set data source...
            tLabel.DataSource = products;


            return(tLabel);
        }
コード例 #5
0
        private void DrawRecord(Rectangle bounds, SpriteBatch sb, DeathRowEntry entry)
        {
            bounds.X     += 2;
            bounds.Width -= 2;
            var flag = TextItem.DrawShadow;

            TextItem.DrawShadow = false;
            var height = 850;

            ScrollablePanel.beginPanel(98302836, new Rectangle(bounds.X, bounds.Y, bounds.Width, height),
                                       recordScrollPosition);
            var num1      = bounds.Width - 16;
            var vector2_1 = new Vector2(5f, 5f);

            GuiData.spriteBatch.Draw(Logo, new Rectangle((int)vector2_1.X, (int)vector2_1.Y, 60, 60), Color.White);
            vector2_1.X += 70f;
            TextItem.doFontLabel(vector2_1, "DEATH ROW : EXECUTED OFFENDERS LISTING", GuiData.titlefont, themeColor,
                                 num1 - 80, 45f);
            vector2_1.Y += 22f;
            if (Button.doButton(98102855, (int)vector2_1.X, (int)vector2_1.Y, bounds.Width / 2, 25, "Return",
                                Color.Black))
            {
                SelectedIndex = -1;
            }
            vector2_1.X  = 5f;
            vector2_1.Y += 55f;
            TextItem.doFontLabel(vector2_1, "RECORD " + entry.RecordNumber, GuiData.titlefont, Color.White, num1 - 4,
                                 60f);
            vector2_1.Y += 70f;
            var seperatorHeight = 18;
            var margin          = 12;
            var drawPos         = DrawCompactLabel("Name:", entry.LName + ", " + entry.FName, vector2_1, margin, seperatorHeight,
                                                   num1);
            var pos  = DrawCompactLabel("Age:", entry.Age, drawPos, margin, seperatorHeight, num1);
            var num2 = 20;
            var num3 = 20;
            var zero = Vector2.Zero;

            TextItem.doFontLabel(pos, "Incident Report:", GuiData.smallfont, themeColor, num1, float.MaxValue);
            pos.Y += num2;
            TextItem.DrawShadow = false;
            var vector2_2 = TextItem.doMeasuredSmallLabel(pos,
                                                          Utils.SmartTwimForWidth(entry.IncidentReport, num1, GuiData.smallfont), Color.White);

            pos.Y += Math.Max(vector2_2.Y, num2);
            pos.Y += num3;
            TextItem.doFontLabel(pos, "Final Statement:", GuiData.smallfont, themeColor, num1, float.MaxValue);
            pos.Y    += num2;
            vector2_2 = TextItem.doMeasuredSmallLabel(pos,
                                                      Utils.SmartTwimForWidth(entry.Statement, num1, GuiData.smallfont), Color.White);
            pos.Y += num3;
            recordScrollPosition = ScrollablePanel.endPanel(98302836, recordScrollPosition, bounds,
                                                            height - bounds.Height, true);
            TextItem.DrawShadow = flag;
        }
コード例 #6
0
        /// <summary>
        /// Builds a dictionary of localizable text items in the scene.
        /// </summary>
        protected Dictionary <string, TextItem> FindTextItems()
        {
            Dictionary <string, TextItem> textItems = new Dictionary <string, TextItem>();

            // Add localizable commands in same order as command list to make it
            // easier to localise / edit standard text.
            var flowcharts = GameObject.FindObjectsOfType <Flowchart>();

            for (int i = 0; i < flowcharts.Length; i++)
            {
                var flowchart = flowcharts[i];
                var blocks    = flowchart.GetComponents <Block>();

                for (int j = 0; j < blocks.Length; j++)
                {
                    var block       = blocks[j];
                    var commandList = block.CommandList;
                    for (int k = 0; k < commandList.Count; k++)
                    {
                        var          command     = commandList[k];
                        ILocalizable localizable = command as ILocalizable;
                        if (localizable != null)
                        {
                            TextItem textItem = new TextItem();
                            textItem.standardText = localizable.GetStandardText();
                            textItem.description  = localizable.GetDescription();
                            textItems[localizable.GetStringId()] = textItem;
                        }
                    }
                }
            }

            // Add everything else that's localizable (including inactive objects)
            UnityEngine.Object[] objects = Resources.FindObjectsOfTypeAll(typeof(Component));
            for (int i = 0; i < objects.Length; i++)
            {
                var          o           = objects[i];
                ILocalizable localizable = o as ILocalizable;
                if (localizable != null)
                {
                    string stringId = localizable.GetStringId();
                    if (textItems.ContainsKey(stringId))
                    {
                        // Already added
                        continue;
                    }
                    TextItem textItem = new TextItem();
                    textItem.standardText = localizable.GetStandardText();
                    textItem.description  = localizable.GetDescription();
                    textItems[stringId]   = textItem;
                }
            }

            return(textItems);
        }
コード例 #7
0
        public void SetText(string t)
        {
            int     width  = 300;
            int     height = 50;
            Color   temp   = text.color;
            Vector2 pos    = sprite.position;

            text          = new TextItem(World.fontManager["Trajanus Roman 36"], t);
            text.color    = temp;
            text.position = new Vector2(pos.X + width / 2, pos.Y + height / 2 + 3);
        }
コード例 #8
0
 public void AddTextItem(TextItem item)
 {
     if (data.Exists((x) => x.key == item.key))
     {
         Debug.LogError(string.Format("textItem key = {0} is repeated", item.key));
     }
     else
     {
         data.Add(item);
     }
 }
コード例 #9
0
        private void CreateTextLayer(Document docRef, string texLayerName, string MyText) // Page 41
        {
            ArtLayer newLayerRef = docRef.ArtLayers.Add();

            newLayerRef.Kind = PsLayerKind.psTextLayer;
            newLayerRef.Name = texLayerName;
            TextItem textItemRef = docRef.ArtLayers[texLayerName].TextItem;

            textItemRef.Contents      = MyText;
            textItemRef.Justification = PsJustification.psRight;
        }
コード例 #10
0
        public TextItem CreateSampleTextItem()
        {
            // Create a new Text item
            var textItem = new TextItem()
            {
                TextTitle = "Juis yuwe sjkl Tywe oiq aklsjd asqw al.",
                Text      = "Binf yuw tyasas pwerq asyu tui nuiwe aske yrwn kashdihas asju ywte.",
            };

            return(textItem);
        }
コード例 #11
0
            private void AddItem(XmlNode cNode)
            {
                TextItem cTI = new TextItem();

                cTI.cNode              = cNode;
                cTI.nDuration          = cNode.AttributeGet <int>("duration");
                cTI.nTransDuration     = cNode.AttributeGet <int>("trans_dur");
                cTI.cBTLText           = new Text(cNode);
                cTI.cBTLText.nDuration = ulong.MaxValue;
                aTextItems.Add(cTI);
            }
コード例 #12
0
        void GetCss()
        {
            var css = Directory.GetFiles(dir, "*.css");

            if (css.Length > 0)
            {
                TextItem cssi = epub.GetItem <TextItem>("OEBPS/Styles/Style.css");
                cssi.data += "\r\n\r\n" + File.ReadAllText(css[0]);
                Log.log("[Info]Css added:" + css[0]);
            }
        }
コード例 #13
0
        private void DrawWelcomeScreen(Rectangle bounds, SpriteBatch sb, Rectangle fullBounds)
        {
            TextItem.doFontLabel(new Vector2(bounds.X + 20, bounds.Y + 20), "ISP Management System", GuiData.font,
                                 Color.White, bounds.Width, float.MaxValue);
            var height = 30;
            var width  = (int)(bounds.Width * 0.800000011920929);
            var num    = bounds.Y + 90;
            var destinationRectangle = fullBounds;

            destinationRectangle.Y      = num - 20;
            destinationRectangle.Height = 22;
            var flag = comp.adminIP == os.thisComputer.ip;

            sb.Draw(Utils.white, destinationRectangle, flag ? os.unlockedColor : os.lockedColor);
            var text = "Valid Administrator Account Detected";

            if (!flag)
            {
                text = "Non-Admin Account Active";
            }
            var vector2  = GuiData.smallfont.MeasureString(text);
            var position = new Vector2(destinationRectangle.X + destinationRectangle.Width / 2 - vector2.X / 2f,
                                       destinationRectangle.Y);

            sb.DrawString(GuiData.smallfont, text, position, Color.White);
            var y1 = num + 30;

            if (Button.doButton(95371001, bounds.X + 20, y1, width, height, "About", os.highlightColor))
            {
                state = ISPDaemonState.About;
            }
            var y2 = y1 + (height + 10);

            if (Button.doButton(95371004, bounds.X + 20, y2, width, height, "Search for IP", os.highlightColor))
            {
                if (comp.adminIP == os.thisComputer.ip)
                {
                    state = ISPDaemonState.EnterIP;
                    os.execute("getString IP_Address");
                    ipSearch = null;
                }
                else
                {
                    state = ISPDaemonState.AdminOnlyError;
                }
            }
            var y3 = y2 + (height + 10);

            if (!Button.doButton(95371008, bounds.X + 20, y3, width, height, "Exit", os.highlightColor))
            {
                return;
            }
            os.display.command = "connect";
        }
コード例 #14
0
        public ProcessingResultBase Process(Item item, NullTemplate template)
        {
            var extension = item.SourceKey.Split(".").Last();
            var htmlPath  = item.SourceKey.Replace("." + extension, ".html");

            return(item switch
            {
                TextItem textItem => new HtmlResult(textItem.Content, htmlPath),
                BinaryItem binaryItem => new BinaryResult(binaryItem.Content, item.SourceKey),
                _ => throw new InvalidOperationException("No Template Engine doesn't know what to do with this.")
            });
コード例 #15
0
        public InputInfoPane(
            Dictionary <Keys, string> keyInfoMap,
            Dictionary <Buttons, string> buttonInfoMap)
        {
            this.keyInfoMap       = keyInfoMap;
            this.buttonInfoMap    = buttonInfoMap;
            infoText              = new TextItem("fwefers", "fonts/menu_font1");
            infoText.DefaultScale = 0.75f;

            add(infoText);
        }
コード例 #16
0
ファイル: LogoDaemon.cs プロジェクト: hochladen/Hacknet
        public override void draw(Rectangle bounds, SpriteBatch sb)
        {
            base.draw(bounds, sb);
            bounds = Utils.InsetRectangle(bounds, 1);
            sb.Draw(Utils.white, bounds, Color.Black * 0.4f);
            Rectangle dest      = new Rectangle(bounds.X, bounds.Y, bounds.Width, bounds.Height / 8);
            Rectangle rectangle = new Rectangle(bounds.X, bounds.Y + dest.Height, bounds.Width, bounds.Height / 8 * 7);

            if (!this.showsTitle)
            {
                rectangle.Y      -= dest.Height;
                rectangle.Height += dest.Height;
                rectangle.Y      += 6;
                rectangle.Height -= 6;
            }
            int num1 = 40;

            rectangle.Height -= num1;
            if (!string.IsNullOrWhiteSpace(this.BodyText))
            {
                string[] strArray = this.BodyText.Trim().Split(Utils.robustNewlineDelim, StringSplitOptions.None);
                int      num2     = (int)GuiData.smallfont.MeasureString("W").Y + 2;
                int      num3     = 6;
                int      num4     = num2 * strArray.Length + num3 * 2;
                rectangle.Height -= num4;
                int num5 = bounds.Y + bounds.Height - num3 - num2 + 1 - num1;
                for (int index = strArray.Length - 1; index >= 0; --index)
                {
                    TextItem.doCenteredFontLabel(new Rectangle(bounds.X, num5 + 1, bounds.Width, num2 - 1), strArray[index], GuiData.smallfont, this.TextColor, false);
                    num5 -= num2;
                }
            }
            if (this.LoadedLogo == null)
            {
                this.timeOnPage += (float)this.os.lastGameTime.ElapsedGameTime.TotalSeconds;
                this.spinner.Draw(rectangle, sb, 1f, (float)(1.0 - (double)this.timeOnPage * 0.400000005960464), 0.0f, new Color?(this.TextColor));
            }
            else
            {
                Utils.DrawSpriteAspectCorrect(rectangle, sb, this.LoadedLogo, Color.White, false);
            }
            if (this.showsTitle)
            {
                TextItem.doCenteredFontLabel(dest, this.name, GuiData.font, this.TextColor, false);
            }
            int width  = bounds.Width / 2;
            int height = 26;

            if (!Button.doButton(22928201, bounds.X + (bounds.Width - width) / 2, bounds.Y + bounds.Height - (num1 - height) / 2 - height, width, height, LocaleTerms.Loc("Proceed"), new Color?(Color.Black)))
            {
                return;
            }
            this.os.display.command = "connect";
        }
コード例 #17
0
        private void DrawStatsTextBlock(string anouncer, string main, string secondary, Rectangle bounds, SpriteBatch sb, float announcerWidth)
        {
            Vector2 pos = new Vector2((float)bounds.X, (float)bounds.Y);

            TextItem.doFontLabel(pos, anouncer, GuiData.font, new Color?(Utils.AddativeWhite), announcerWidth - 10f, (float)bounds.Height - 8f, true);
            pos.X += announcerWidth + 2f;
            TextItem.doFontLabel(new Vector2((float)((double)bounds.X + (double)announcerWidth - 12.0), (float)bounds.Y), ":", GuiData.font, new Color?(Utils.AddativeWhite), 22f, (float)bounds.Height, false);
            TextItem.doFontLabel(pos, main, GuiData.font, new Color?(this.ThemeColorHighlight), (float)bounds.Width - announcerWidth, (float)bounds.Height - 8f, true);
            pos.Y += 29f;
            pos.X  = (float)bounds.X;
            TextItem.doFontLabel(pos, "[" + secondary + "]", GuiData.smallfont, new Color?(Color.Gray), (float)bounds.Width, (float)bounds.Height, false);
        }
コード例 #18
0
        public override void draw(Rectangle bounds, SpriteBatch sb)
        {
            base.draw(bounds, sb);
            bool      flag = !this.RequiresLogin || this.comp.adminIP == this.os.thisComputer.ip || this.comp.userLoggedIn;
            Rectangle dest = Utils.InsetRectangle(bounds, 2);
            Rectangle destinationRectangle = new Rectangle(dest.X, dest.Y - 1, 18, dest.Height + 2);

            sb.Draw(Utils.white, destinationRectangle, this.ThemeColor);
            destinationRectangle.X     += destinationRectangle.Width / 2;
            destinationRectangle.Width /= 2;
            sb.Draw(Utils.white, destinationRectangle, Color.Black * 0.2f);
            dest.X     += 20;
            dest.Width -= 25;
            Rectangle rectangle1 = new Rectangle(dest.X + 4, dest.Y, dest.Width, 35);

            TextItem.doFontLabelToSize(rectangle1, this.name, GuiData.font, Color.White, true, true);
            int width   = dest.Width / 4;
            int height1 = 22;

            if (Button.doButton(37849102, rectangle1.X + rectangle1.Width - 6 - width, rectangle1.Y + rectangle1.Height - rectangle1.Height / 2 - height1 / 2, width, height1, LocaleTerms.Loc("Exit IRC View"), new Color?(this.ThemeColor)))
            {
                this.os.display.command = "connect";
            }
            rectangle1.Y     += rectangle1.Height;
            rectangle1.X     -= 6;
            dest.Y           += rectangle1.Height;
            dest.Height      -= rectangle1.Height;
            rectangle1.Height = 2;
            sb.Draw(Utils.white, rectangle1, this.ThemeColor);
            dest.Y      += rectangle1.Height + 2;
            dest.Height -= rectangle1.Height + 2;
            dest.Height -= 6;
            PatternDrawer.draw(dest, 0.22f, Color.Black * 0.5f, flag ? this.ThemeColor * 0.12f : Utils.AddativeRed * 0.2f, sb, flag ? PatternDrawer.thinStripe : PatternDrawer.warningStripe);
            dest.X      += 2;
            dest.Width  -= 4;
            dest.Height -= 4;
            if (flag)
            {
                this.System.Draw(dest, sb, false, LocaleTerms.Loc("UNKNOWN"), this.UserColors);
            }
            else
            {
                int       height2    = dest.Height / 4;
                Rectangle rectangle2 = new Rectangle(dest.X - 4, dest.Y + dest.Height / 2 - height2 / 2, dest.Width + 6, height2);
                sb.Draw(Utils.white, rectangle2, this.os.lockedColor);
                rectangle2.Height -= 35;
                TextItem.doCenteredFontLabel(rectangle2, LocaleTerms.Loc("Login To Server"), GuiData.font, Color.White, false);
                if (Button.doButton(84109551, rectangle2.X + rectangle2.Width / 2 - rectangle2.Width / 4, rectangle2.Y + rectangle2.Height - 32, rectangle2.Width / 2, 28, "Login", new Color?()))
                {
                    this.os.runCommand("login");
                }
            }
        }
コード例 #19
0
        public void CannotFindItemWhenItHasNothingToDoWithTheQuery()
        {
            var item = new TextItem("EmacsClient.lnk");

            IndexItemIntoDirectory(item);

            var searcher = GetAutocompleter();

            var results = searcher.Autocomplete("Firefox");

            Assert.False(results.HasAutoCompletion);
        }
コード例 #20
0
        public override void Process(Epub epub)
        {
            Log.log("[Start]" + ToString());
            Log.level = " ";
            List <TextItem> css           = new List <TextItem>();
            Item            jstobedeleted = null;

            foreach (Item item in epub.items)
            {
                if (Path.GetFileName(item.fullName) == "notereplace.js")
                {
                    jstobedeleted = item;
                    continue;
                }
                if (Path.GetExtension(item.fullName).ToLower() == ".xhtml")
                {
                    var x = new ProcXHTML((TextItem)item, option);
                    if (x.contain_footnote)
                    {
                        if (x.css.Count > 0)
                        {
                            bool exi = false;
                            foreach (var a in css)
                            {
                                if (a.fullName == x.css[0])
                                {
                                    exi = true;
                                }
                            }
                            if (!exi)
                            {
                                TextItem i = epub.GetItem <TextItem>(x.css[0]);
                                if (i != null)
                                {
                                    css.Add(i);
                                }
                            }
                        }
                    }
                }
            }
            epub.items.Remove(jstobedeleted);
            Log.log("[Info ]Removed notereplace.js");
            foreach (TextItem p in css)
            {
                new ProcCSS(p, option);
            }
            new ProcOPF(epub);
            epub.DeleteEmpty();
            Log.level = "";
            Log.log("[End]" + ToString());
            Log.log("");
        }
コード例 #21
0
ファイル: Theme.cs プロジェクト: AdamRLukaitis/epicedit
        public Theme(TextItem nameItem, Palettes palettes, RoadTileset roadTileset, Background background)
        {
            this.NameItem       = nameItem;
            this.Palettes       = palettes;
            this.Palettes.Theme = this;
            this.RoadTileset    = roadTileset;
            this.Background     = background;

            this.Palettes.PropertyChanged    += this.OnPropertyChanged;
            this.RoadTileset.PropertyChanged += this.OnPropertyChanged;
            this.Background.PropertyChanged  += this.OnPropertyChanged;
        }
コード例 #22
0
        private void DrawTitleScreen(Rectangle bounds, SpriteBatch sb)
        {
            bool drawShadow = TextItem.DrawShadow;

            TextItem.DrawShadow = false;
            Rectangle destinationRectangle = new Rectangle(bounds.X + 12, bounds.Y + 12, DeathRowDatabaseDaemon.Logo.Width, DeathRowDatabaseDaemon.Logo.Height);

            sb.Draw(DeathRowDatabaseDaemon.Logo, destinationRectangle, Color.White);
            float num1  = 1f;
            float num2  = 1.4f;
            float point = this.os.timer % 3f;

            if ((double)point > 1.0)
            {
                point = 0.0f;
            }
            float num3 = (1f - point) * 0.4f;

            if ((double)point == 0.0)
            {
                num3 = 0.0f;
            }
            float num4 = Utils.QuadraticOutCurve(point) * (num2 - num1);

            if ((double)num4 > 0.0)
            {
                num4 += num1;
            }
            destinationRectangle    = new Rectangle((int)((double)destinationRectangle.X - (double)(destinationRectangle.Width / 2) * (double)num4), (int)((double)destinationRectangle.Y - (double)(destinationRectangle.Height / 2) * (double)num4), (int)((double)destinationRectangle.Width * (double)num4), (int)((double)destinationRectangle.Height * (double)num4));
            destinationRectangle.X += DeathRowDatabaseDaemon.Logo.Width / 2;
            destinationRectangle.Y += DeathRowDatabaseDaemon.Logo.Height / 2;
            sb.Draw(DeathRowDatabaseDaemon.Circle, destinationRectangle, Color.White * num3);
            Vector2 pos = new Vector2((float)(bounds.X + DeathRowDatabaseDaemon.Logo.Width + 22), (float)(bounds.Y + 14));

            TextItem.doFontLabel(pos, "DEATH ROW", GuiData.titlefont, new Color?(this.themeColor), (float)(bounds.Width - DeathRowDatabaseDaemon.Logo.Width) - 26f, 50f, false);
            pos.Y += 45f;
            TextItem.doFontLabel(pos, "EXECUTED OFFENDERS LISTING", GuiData.titlefont, new Color?(Color.White), (float)(bounds.Width - DeathRowDatabaseDaemon.Logo.Width) - 26f, 40f, false);
            pos.Y += (float)(DeathRowDatabaseDaemon.Logo.Height - 40);
            pos.X  = (float)(bounds.X + 12);
            FileEntry fileEntry = this.root.searchForFile("ServerDetails.txt");

            if (fileEntry != null)
            {
                string text = Utils.SmartTwimForWidth(fileEntry.data, bounds.Width - 30, GuiData.tinyfont);
                TextItem.doFontLabel(pos, text, GuiData.tinyfont, new Color?(Color.White), (float)(bounds.Width - 20), (float)bounds.Height - 200f, false);
            }
            if (Button.doButton(166261601, bounds.X + 6, bounds.Y + bounds.Height - 26, bounds.Width - 12, 22, LocaleTerms.Loc("Exit"), new Color?(Color.Black)))
            {
                this.os.display.command = "connect";
            }
            TextItem.DrawShadow = drawShadow;
        }
コード例 #23
0
ファイル: ISPDaemon.cs プロジェクト: hochladen/Hacknet
        private void DrawWelcomeScreen(Rectangle bounds, SpriteBatch sb, Rectangle fullBounds)
        {
            TextItem.doFontLabel(new Vector2((float)(bounds.X + 20), (float)(bounds.Y + 20)), LocaleTerms.Loc("ISP Management System"), GuiData.font, new Color?(Color.White), (float)bounds.Width, float.MaxValue, false);
            int       height = 30;
            int       width  = (int)((double)bounds.Width * 0.800000011920929);
            int       num    = bounds.Y + 90;
            Rectangle destinationRectangle = fullBounds;

            destinationRectangle.Y      = num - 20;
            destinationRectangle.Height = 22;
            bool flag = this.comp.adminIP == this.os.thisComputer.ip;

            sb.Draw(Utils.white, destinationRectangle, flag ? this.os.unlockedColor : this.os.lockedColor);
            string text = LocaleTerms.Loc("Valid Administrator Account Detected");

            if (!flag)
            {
                text = LocaleTerms.Loc("Non-Admin Account Active");
            }
            Vector2 vector2  = GuiData.smallfont.MeasureString(text);
            Vector2 position = new Vector2((float)(destinationRectangle.X + destinationRectangle.Width / 2) - vector2.X / 2f, (float)destinationRectangle.Y);

            sb.DrawString(GuiData.smallfont, text, position, Color.White);
            int y1 = num + 30;

            if (Button.doButton(95371001, bounds.X + 20, y1, width, height, LocaleTerms.Loc("About"), new Color?(this.os.highlightColor)))
            {
                this.state = ISPDaemon.ISPDaemonState.About;
            }
            int y2 = y1 + (height + 10);

            if (Button.doButton(95371004, bounds.X + 20, y2, width, height, LocaleTerms.Loc("Search for IP"), new Color?(this.os.highlightColor)))
            {
                if (this.comp.adminIP == this.os.thisComputer.ip)
                {
                    this.state = ISPDaemon.ISPDaemonState.EnterIP;
                    this.os.execute("getString IP_Address");
                    this.ipSearch = (string)null;
                }
                else
                {
                    this.state = ISPDaemon.ISPDaemonState.AdminOnlyError;
                }
            }
            int y3 = y2 + (height + 10);

            if (!Button.doButton(95371008, bounds.X + 20, y3, width, height, LocaleTerms.Loc("Exit"), new Color?(this.os.highlightColor)))
            {
                return;
            }
            this.os.display.command = "connect";
        }
コード例 #24
0
 private void doCatDisplay()
 {
     if (this.os.hasConnectionPermission(false))
     {
         if (Button.doButton(299999, this.bounds.X + (this.bounds.Width - 41), this.bounds.Y + 12, 27, 29, "<-", new Color?()))
         {
             this.os.runCommand("ls");
         }
         Rectangle tmpRect = GuiData.tmpRect;
         tmpRect.Width  = this.bounds.Width;
         tmpRect.X      = this.bounds.X;
         tmpRect.Y      = this.bounds.Y + 1;
         tmpRect.Height = this.bounds.Height - 2;
         if (this.os.connectedComp != null && this.os.connectedComp.ip != this.LastDisplayedFileSourceIP && this.LastDisplayedFileSourceIP != this.os.thisComputer.ip)
         {
             this.command = "dc";
         }
         else
         {
             string data = "";
             for (int index = 1; index < this.commandArgs.Length; ++index)
             {
                 data = data + this.commandArgs[index] + " ";
             }
             string text1 = LocalizedFileLoader.SafeFilterString(data);
             if (this.LastDisplayedFileFolder.searchForFile(text1.Trim()) == null)
             {
                 this.os.postFXDrawActions += (Action)(() =>
                 {
                     Rectangle rectangle = new Rectangle(this.bounds.X + 1, this.bounds.Y + this.bounds.Height / 2 - 70, this.bounds.Width - 2, 140);
                     this.spriteBatch.Draw(Utils.white, rectangle, this.os.lockedColor);
                     TextItem.doCenteredFontLabel(rectangle, "File Not Found", GuiData.font, Color.White, false);
                 });
                 this.catScroll = Vector2.Zero;
             }
             else
             {
                 TextItem.doFontLabel(new Vector2((float)this.x, (float)(this.y + 3)), text1, GuiData.font, new Color?(Color.White), (float)(this.bounds.Width - 70), float.MaxValue, false);
                 int       num          = 55;
                 Rectangle dest         = new Rectangle(tmpRect.X + 4, tmpRect.Y + num, tmpRect.Width - 6, tmpRect.Height - num - 2);
                 string    displayCache = this.os.displayCache;
                 this.y += 70;
                 string text2 = Utils.SuperSmartTwimForWidth(LocalizedFileLoader.SafeFilterString(displayCache), this.bounds.Width - 40, GuiData.tinyfont);
                 this.catTextRegion.Draw(dest, text2, this.spriteBatch);
             }
         }
     }
     else
     {
         this.command = "connect";
     }
 }
コード例 #25
0
        private void DrawWarningScreen()
        {
            if (this.warningScreenIsActivating)
            {
                this.spriteBatch.Draw(Utils.white, this.fullscreen, Color.White);
            }
            else
            {
                this.DrawFlashingRedBackground();
            }
            string  text      = "WARNING";
            Vector2 vector2_1 = this.titleFont.MeasureString(text);
            float   widthTo   = (float)this.fullscreen.Width * 0.65f;
            float   scale     = widthTo / vector2_1.X;
            Vector2 vector2_2 = new Vector2(20f, -10f);

            this.spriteBatch.DrawString(this.titleFont, text, vector2_2, Color.Black, 0.0f, Vector2.Zero, scale, SpriteEffects.None, 0.5f);
            vector2_2.Y += (float)((double)vector2_1.Y * (double)scale - 55.0);
            TextItem.doFontLabel(vector2_2, LocaleTerms.Loc("COMPLETED TRACE DETECTED : EMERGENCY RECOVERY MODE ACTIVE"), Settings.ActiveLocale.StartsWith("en") ? this.titleFont : GuiData.font, new Color?(Color.Black), widthTo, float.MaxValue, false);
            vector2_2.Y += 40f;
            vector2_2    = this.DrawFlashInString(LocaleTerms.Loc("Unsyndicated foreign connection detected during active trace"), vector2_2, 0.0f, 0.2f, false, 0.2f);
            vector2_2    = this.DrawFlashInString(" :: " + LocaleTerms.Loc("Emergency recovery mode activated"), vector2_2, 0.1f, 0.2f, false, 0.2f);
            vector2_2    = this.DrawFlashInString("-----------------------------------------------------------------------", vector2_2, 0.2f, 0.2f, false, 0.2f);
            vector2_2    = this.DrawFlashInString(" ", vector2_2, 0.5f, 0.2f, false, 0.2f);
            vector2_2    = this.DrawFlashInString(LocaleTerms.Loc("Automated screening procedures will divert incoming connections temporarily"), vector2_2, 0.5f, 0.2f, false, 0.2f);
            vector2_2    = this.DrawFlashInString(LocaleTerms.Loc("This window is a final opportunity to regain anonymity."), vector2_2, 0.6f, 0.2f, false, 0.2f);
            vector2_2    = this.DrawFlashInString(LocaleTerms.Loc("As your current IP Address is known, it must be changed") + " -", vector2_2, 0.7f, 0.2f, false, 0.2f);
            vector2_2    = this.DrawFlashInString(LocaleTerms.Loc("This can only be done on your currently active ISP's routing server"), vector2_2, 0.8f, 0.2f, false, 0.2f);
            Computer computer = Programs.getComputer(this.os, "ispComp");

            vector2_2 = this.DrawFlashInString(string.Format(LocaleTerms.Loc("Reverse tracerouting has located this ISP server's IP address as {0}"), computer != null ? (object)computer.ip : (object)"68.144.93.18"), vector2_2, 0.9f, 0.2f, false, 0.2f);
            vector2_2 = this.DrawFlashInString(string.Format(LocaleTerms.Loc("Your local ip : {0}  must be tracked here and changed."), (object)this.os.thisComputer.ip), vector2_2, 1f, 0.2f, false, 0.2f);
            vector2_2 = this.DrawFlashInString(" ", vector2_2, 1.1f, 0.2f, false, 0.2f);
            vector2_2 = this.DrawFlashInString(LocaleTerms.Loc("Failure to complete this while active diversion holds will result in complete"), vector2_2, 1.1f, 0.2f, false, 0.2f);
            vector2_2 = this.DrawFlashInString(LocaleTerms.Loc("and permanent loss of all account data - THIS IS NOT REPEATABLE AND CANNOT BE DELAYED"), vector2_2, 1.2f, 0.2f, false, 0.2f);
            if (this.warningScreenIsActivating || ((double)this.timeThisState < 1.20000004768372 || !Button.doButton(789798001, 20, (int)((double)vector2_2.Y + 10.0), 400, 40, LocaleTerms.Loc("BEGIN"), new Color?(Color.Black))))
            {
                return;
            }
            this.timeThisState             = 0.0f;
            this.state                     = TraceDangerSequence.TraceDangerState.WarningScreenExiting;
            this.PreventOSRendering        = true;
            this.onBeatFlashTimer          = this.os.timer;
            this.warningScreenIsActivating = true;
            this.spinUpSound.Play(1f, 0.0f, 0.0f);
            this.os.terminal.inputLocked = false;
            this.os.delayer.Post(ActionDelayer.Wait(0.1), (Action)(() => this.spinUpSound.Play(1f, 0.0f, 0.0f)));
            this.os.delayer.Post(ActionDelayer.Wait(0.4), (Action)(() => this.spinUpSound.Play(0.4f, 0.0f, 0.0f)));
            this.os.delayer.Post(ActionDelayer.Wait(0.8), (Action)(() => this.spinUpSound.Play(0.2f, 0.1f, 0.0f)));
            this.os.delayer.Post(ActionDelayer.Wait(1.3), (Action)(() => this.spinUpSound.Play(0.1f, 0.2f, 0.0f)));
            this.os.delayer.Post(ActionDelayer.Wait(0.01), (Action)(() => MusicManager.playSongImmediatley("Music/Traced")));
        }
コード例 #26
0
    static void ProcXHTML(TextItem i)
    {
        Log.log("[Info]" + i.fullName);
        string name = Path.GetFileNameWithoutExtension(i.fullName);
        string r    = i.data.Replace("\r", "").Replace("\n", "");
        Match  m    = Regex.Match(r, "<body(.*)</body>");

        if (!m.Success)
        {
            Log.log("[Error]body?"); return;
        }
        r = m.Groups[0].Value;
        XFragment f       = new XFragment(r, 0);
        string    txt     = "";
        string    counter = "";

        f.parts.ForEach((p) =>
        {
            if (p.GetType() == typeof(XText))
            {
                txt += Util.Trim(p.originalText); counter += Util.Trim(p.originalText);
            }
            if (p.GetType() == typeof(XTag))
            {
                XTag p0 = (XTag)p;
                if (p.type == PartType.tag_start && p0.tagname == "rt")
                {
                    txt += "(";
                }
                if (p.type == PartType.tag_end && p0.tagname == "rt")
                {
                    txt += ")";
                }
                if (p.type == PartType.tag_start && p0.tagname == "p")
                {
                    txt += "//";
                }
                if (p.type == PartType.tag_end && p0.tagname == "p")
                {
                    txt += "\r\n";
                }
                if (p.type == PartType.tag_end && p0.tagname == "div")
                {
                    txt += "\r\n";
                }
            }
        });
        if (Util.Trim(counter).Length > 0)
        {
            File.WriteAllText("epub2note_output/" + name + ".txt", txt);
        }
    }
コード例 #27
0
ファイル: MissionHubServer.cs プロジェクト: hochladen/Hacknet
        private void doContractPreviewScreen(Rectangle bounds, SpriteBatch sb)
        {
            string stringForContractFile = this.getIDStringForContractFile(this.listingsFolder.files[this.selectedElementIndex]);

            if (!this.listingMissions.ContainsKey(stringForContractFile))
            {
                return;
            }
            ActiveMission listingMission = this.listingMissions[stringForContractFile];
            Vector2       vector2        = new Vector2((float)(bounds.X + 20), (float)(bounds.Y + 20));

            TextItem.doFontLabel(vector2 + new Vector2((float)this.getTransitionOffset(0), 0.0f), "CONTRACT:" + stringForContractFile, GuiData.titlefont, new Color?(), (float)(bounds.Width / 2), 40f, false);
            vector2.Y += 40f;
            TextItem.doFontLabel(vector2 + new Vector2((float)this.getTransitionOffset(1), 0.0f), listingMission.postingTitle.Replace("#", ""), GuiData.font, new Color?(), (float)(bounds.Width - 30), float.MaxValue, false);
            vector2.Y += 30f;
            string        str           = DisplayModule.cleanSplitForWidth(listingMission.postingBody, bounds.Width - 110);
            StringBuilder stringBuilder = new StringBuilder();
            int           num1          = (int)((double)(((float)bounds.Width - 20f) / GuiData.smallfont.MeasureString("-").X) / 2.0);

            for (int index = 1; index < num1 - 5; ++index)
            {
                stringBuilder.Append("-");
            }
            string text = str.Replace("###", stringBuilder.ToString());

            if (LocaleActivator.ActiveLocaleIsCJK())
            {
                text       = Utils.SuperSmartTwimForWidth(listingMission.postingBody, bounds.Width - 110, GuiData.smallfont);
                vector2.Y += 20f;
            }
            TextItem.doFontLabel(vector2 + new Vector2((float)this.getTransitionOffset(2), 0.0f), text, GuiData.smallfont, new Color?(), (float)(bounds.Width - 20), float.MaxValue, false);
            int num2 = Math.Max(135, bounds.Height / 6);

            if (Button.doButton(2171618, bounds.X + 20 + this.getTransitionOffset(3), bounds.Y + bounds.Height - num2, bounds.Width / 5, 30, LocaleTerms.Loc("Back"), new Color?()))
            {
                this.state            = MissionHubServer.HubState.Listing;
                this.screenTransition = 1f;
            }
            if (this.os.currentMission == null)
            {
                if (Button.doButton(2171615, bounds.X + 20 + this.getTransitionOffset(4), bounds.Y + bounds.Height - num2 - 40, bounds.Width / 5, 30, LocaleTerms.Loc("Accept"), new Color?(this.os.highlightColor)))
                {
                    this.acceptMission(listingMission, this.selectedElementIndex, stringForContractFile);
                    this.state            = MissionHubServer.HubState.Listing;
                    this.screenTransition = 1f;
                }
            }
            else
            {
                TextItem.doFontLabelToSize(new Rectangle(bounds.X + 20 + this.getTransitionOffset(4), bounds.Y + bounds.Height - num2 - 40, bounds.Width / 2, 30), LocaleTerms.Loc("Abort current contract to accept new ones."), GuiData.smallfont, Color.White, false, false);
            }
        }
コード例 #28
0
    public void UpdateItem(string name, float value)
    {
        TextItem textItem = null;

        if (textItems.TryGetValue(name, out textItem))
        {
            UpdateValue(textItem, value);
        }
        else
        {
            AddItem(name, value);
        }
    }
コード例 #29
0
ファイル: ctlQCChartNew.cs プロジェクト: ewin66/HIS
        private static void AddLabel(string label, float x, float y, GraphPane myPane)
        {
            TextItem myText1 = new TextItem(label, x, y);

            myText1.Location.CoordinateFrame  = CoordType.AxisXYScale;
            myText1.Location.AlignH           = AlignH.Left;
            myText1.Location.AlignV           = AlignV.Center;
            myText1.FontSpec.IsItalic         = true;
            myText1.FontSpec.Fill.IsVisible   = false;
            myText1.FontSpec.Border.IsVisible = false;
            myText1.FontSpec.FontColor        = Color.Teal;
            myPane.GraphItemList.Add(myText1);
        }
コード例 #30
0
 public ActionResult Edit([Bind(Include = "Id,Title,Name,ImageUrl,Summery,Body,LinkUrl,LinkTitle,TextItemTypeId,IsActive,CreationDate,LastModifiedDate,IsDeleted,DeletionDate,Description")] TextItem textItem)
 {
     if (ModelState.IsValid)
     {
         textItem.IsDeleted        = false;
         textItem.LastModifiedDate = DateTime.Now;
         db.Entry(textItem).State  = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.TextItemTypeId = new SelectList(db.TextItemTypes, "Id", "Title", textItem.TextItemTypeId);
     return(View(textItem));
 }
コード例 #31
0
ファイル: TextRendering.cs プロジェクト: Booser/radegast
        void PrepareText(TextItem item)
        {
            // If we're modified and have texture already delete it from graphics card
            if (item.TextureID > 0)
            {
                //GL.DeleteTexture(item.TextureID);
                item.TextureID = -1;
            }

            Size s;

            try
            {
                 s = TextRenderer.MeasureText(
                    item.Text,
                    item.Font,
                    TextRendering.MaxSize,
                    item.Flags);
            }
            catch
            {
                return;
            }

            item.ImgWidth = s.Width;
            item.ImgHeight = s.Height;

            if (!RenderSettings.TextureNonPowerOfTwoSupported)
            {
                item.ImgWidth = RHelp.NextPow2(s.Width);
                item.ImgHeight = RHelp.NextPow2(s.Height);
            }

            Bitmap img = new Bitmap(
                item.ImgWidth,
                item.ImgHeight,
                System.Drawing.Imaging.PixelFormat.Format32bppArgb);

            Graphics g = Graphics.FromImage(img);
            g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;

            TextRenderer.DrawText(
                g,
                item.Text,
                item.Font,
                new Rectangle(0, 0, s.Width + 2, s.Height + 2),
                Color.White,
                Color.Transparent,
                item.Flags);

            item.TextureID = RHelp.GLLoadImage(img, true, false);
            g.Dispose();
            img.Dispose();
        }
コード例 #32
0
ファイル: TextRendering.cs プロジェクト: Booser/radegast
 int GetItemHash(TextItem item)
 {
     int ret = 17;
     ret = ret * 31 + item.Text.GetHashCode();
     ret = ret * 31 + item.Font.GetHashCode();
     ret = ret * 31 + (int)item.Flags;
     return ret;
 }
コード例 #33
0
ファイル: Card.cs プロジェクト: jimva3hj/hamqsler
 /// <summary>
 /// Create a deep clone of this card
 /// </summary>
 /// <returns>Card that is a deep clone of this one</returns>
 public Card Clone()
 {
     Card card = new Card();
     card.BackImage = new BackgroundImage();
     card.CopyCardProperties(this);
     card.BackImage = new BackgroundImage();
     card.BackImage.CopyImageProperties(card, BackImage);
     foreach(SecondaryImage si in SecondaryImages)
     {
         SecondaryImage si2 = new SecondaryImage();
         si2.CopyImageProperties(card, si);
         card.SecondaryImages.Add(si2);
     }
     foreach(TextItem ti in TextItems)
     {
         TextItem ti2 = new TextItem();
         ti2.CopyTextItem(card, ti);
         card.TextItems.Add(ti2);
     }
     if(QsosBox != null)
     {
         card.QsosBox = new QsosBox();
         card.QsosBox.CopyQsosBoxProperties(card, QsosBox);
     }
     return card;
 }
コード例 #34
0
ファイル: Localization.cs プロジェクト: nullsquid/Diviner
        /**
         * Builds a dictionary of localizable text items in the scene.
         */
        protected Dictionary<string, TextItem> FindTextItems()
        {
            Dictionary<string, TextItem> textItems = new Dictionary<string, TextItem>();

            // Add localizable commands in same order as command list to make it
            // easier to localise / edit standard text.
            Flowchart[] flowcharts = GameObject.FindObjectsOfType<Flowchart>();
            foreach (Flowchart flowchart in flowcharts)
            {
                Block[] blocks = flowchart.GetComponentsInChildren<Block>();
                foreach (Block block in blocks)
                {
                    foreach (Command command in block.commandList)
                    {
                        ILocalizable localizable = command as ILocalizable;
                        if (localizable != null)
                        {
                            TextItem textItem = new TextItem();
                            textItem.standardText = localizable.GetStandardText();
                            textItem.description = localizable.GetDescription();
                            textItems[localizable.GetStringId()] = textItem;
                        }
                    }
                }
            }

            // Add everything else that's localizable
            Component[] components = GameObject.FindObjectsOfType<Component>();
            foreach (Component component in components)
            {
                ILocalizable localizable = component as ILocalizable;
                if (localizable != null)
                {
                    string stringId = localizable.GetStringId();
                    if (textItems.ContainsKey(stringId))
                    {
                        // Already added
                        continue;
                    }

                    TextItem textItem = new TextItem();
                    textItem.standardText = localizable.GetStandardText();
                    textItem.description = localizable.GetDescription();
                    textItems[stringId] = textItem;
                }
            }

            return textItems;
        }
コード例 #35
0
ファイル: Localization.cs プロジェクト: nullsquid/Diviner
        /**
         * Adds localized strings from CSV file data to a dictionary of text items in the scene.
         */
        protected virtual void AddCSVDataItems(Dictionary<string, TextItem> textItems, string csvData)
        {
            CsvParser csvParser = new CsvParser();
            string[][] csvTable = csvParser.Parse(csvData);

            if (csvTable.Length <= 1)
            {
                // No data rows in file
                return;
            }

            // Parse header row
            string[] columnNames = csvTable[0];

            for (int i = 1; i < csvTable.Length; ++i)
            {
                string[] fields = csvTable[i];
                if (fields.Length < 3)
                {
                    // No standard text or localized string fields present
                    continue;
                }

                string stringId = fields[0];

                if (!textItems.ContainsKey(stringId))
                {
                    if (stringId.StartsWith("CHARACTER.") ||
                        stringId.StartsWith("SAY.") ||
                        stringId.StartsWith("MENU.") ||
                        stringId.StartsWith("WRITE.") ||
                        stringId.StartsWith("SETTEXT."))
                    {
                        // If it's a 'built-in' type this probably means that item has been deleted from its flowchart,
                        // so there's no need to add a text item for it.
                        continue;
                    }

                    // Key not found. Assume it's a custom string that we want to retain, so add a text item for it.
                    TextItem newTextItem = new TextItem();
                    newTextItem.description = CSVSupport.Unescape(fields[1]);
                    newTextItem.standardText = CSVSupport.Unescape(fields[2]);
                    textItems[stringId] = newTextItem;
                }

                TextItem textItem = textItems[stringId];

                for (int j = 3; j < fields.Length; ++j)
                {
                    if (j >= columnNames.Length)
                    {
                        continue;
                    }
                    string languageCode = columnNames[j];
                    string languageEntry = CSVSupport.Unescape(fields[j]);

                    if (languageEntry.Length > 0)
                    {
                        textItem.localizedStrings[languageCode] = languageEntry;
                    }
                }
            }
        }
コード例 #36
0
ファイル: SplashText.cs プロジェクト: Grutn/B.rain-project
 public TextItem Write(string text, Color color, double time = 1.0)
 {
     TextItem i = new TextItem();
     i.Text = text;
     i.Color = color;
     i.Time = time;
     items.Add(i);
     return i;
 }
コード例 #37
0
ファイル: Localization.cs プロジェクト: alalwww/OverlayPlugin
 public string this[TextItem item, string locale]
 {
     get
     {
         if (dict.ContainsKey(item))
         {
             if (dict[item].ContainsKey(locale))
             {
                 return dict[item][locale];
             }
             else if (dict[item].ContainsKey(""))
             {
                 return dict[item][""];
             }
             else
             {
                 throw new KeyNotFoundException();
             }
         }
         throw new KeyNotFoundException();
     }
     set
     {
         if (!dict.ContainsKey(item))
         {
             dict.Add(item, new Dictionary<string, string>());
         }
         if (!dict[item].ContainsKey(locale))
         {
             dict[item].Add(locale, value);
         }
         else
         {
             dict[item][locale] = value;
         }
     }
 }
コード例 #38
0
 public void Add(TextItem ti)
 {
   InnerList.Add(ti);
 }
コード例 #39
0
    protected void Interpret(Graphics g)
    {
      this._isMeasureInSync = false; // if structure is changed, the measure is out of sync

      char[] searchchars = new Char[] { '\\', '\r', '\n', ')' };

      // Modification of StringFormat is necessary to avoid 
      // too big spaces between successive words
      StringFormat strfmt = (StringFormat)StringFormat.GenericTypographic.Clone();
      strfmt.FormatFlags |= StringFormatFlags.MeasureTrailingSpaces;

      strfmt.LineAlignment = StringAlignment.Far;
      strfmt.Alignment = StringAlignment.Near;

      // next statement is necessary to have a consistent string length both
      // on 0 degree rotated text and rotated text
      // without this statement, the text is fitted to the pixel grid, which
      // leads to "steps" during scaling
      g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;

      MeasureFont(g, _font, out _cyBaseLineSpace, out _cyBaseAscent, out _cyBaseDescent);

      System.Collections.Stack itemstack = new System.Collections.Stack();

      Font currFont = (Font)_font.Clone();


      if(null!=_cachedTextLines)
        _cachedTextLines.Clear(); // delete old contents 
      else
        _cachedTextLines = new TextLine.TextLineCollection();


      TextLine currTextLine = new TextLine();
        
      // create a new text line first
      _cachedTextLines.Add(currTextLine);
      int currTxtIdx = 0;

      TextItem currTextItem = new TextItem(currFont);
      //      TextItem firstItem = currTextItem; // preserve the first item
      


      currTextLine.Add(currTextItem);


      while(currTxtIdx<_text.Length)
      {

        // search for the first occurence of a backslash
        int bi = _text.IndexOfAny(searchchars,currTxtIdx);

        if(bi<0) // nothing was found
        {
          // move the rest of the text to the current item
          currTextItem.Text += _text.Substring(currTxtIdx,_text.Length-currTxtIdx);
          currTxtIdx = _text.Length;
        }
        else // something was found
        {
          // first finish the current item by moving the text from
          // currTxtIdx to (bi-1) to the current text item
          currTextItem.Text += _text.Substring(currTxtIdx,bi-currTxtIdx);
          
          if('\r'==_text[bi]) // carriage return character : simply ignore it
          {
            // simply ignore this character, since we search for \n
            currTxtIdx=bi+1;
          }
          else if('\n'==_text[bi]) // newline character : create a new line
          {
            currTxtIdx = bi+1;
            // create a new line
            currTextLine = new TextLine();
            _cachedTextLines.Add(currTextLine);
            // create also a new text item
            currTextItem = new TextItem(currTextItem,null);
            currTextLine.Add(currTextItem);
          }
          else if('\\'==_text[bi]) // backslash : look what comes after
          {
            if(bi+1<_text.Length && (')'==_text[bi+1] || '\\'==_text[bi+1])) // if a closing brace or a backslash, take these as chars
            {
              currTextItem.Text += _text[bi+1];
              currTxtIdx = bi+2;
            }
              // if the backslash not followed by a symbol and than a (, 
            else if(bi+3<_text.Length && !char.IsSeparator(_text,bi+1) && '('==_text[bi+2])
            {
              switch(_text[bi+1])
              {
                case 'b':
                case 'B':
                {
                  itemstack.Push(currTextItem);
                  currTextItem = new TextItem(currTextItem, new Font(currTextItem.Font.FontFamily,currTextItem.Font.Size,currTextItem.Font.Style | FontStyle.Bold, GraphicsUnit.World));
                  currTextLine.Add(currTextItem);
                  currTxtIdx = bi+3;
                }
                  break; // bold
                case 'i':
                case 'I':
                {
                  itemstack.Push(currTextItem);
                  currTextItem = new TextItem(currTextItem, new Font(currTextItem.Font.FontFamily,currTextItem.Font.Size,currTextItem.Font.Style | FontStyle.Italic, GraphicsUnit.World));
                  currTextLine.Add(currTextItem);
                  currTxtIdx = bi+3;
                }
                  break; // italic
                case 'u':
                case 'U':
                {
                  itemstack.Push(currTextItem);
                  currTextItem = new TextItem(currTextItem, new Font(currTextItem.Font.FontFamily,currTextItem.Font.Size,currTextItem.Font.Style | FontStyle.Underline, GraphicsUnit.World));
                  currTextLine.Add(currTextItem);
                  currTxtIdx = bi+3;
                }
                  break; // underlined
                case 's':
                case 'S': // strikeout
                {
                  itemstack.Push(currTextItem);
                  currTextItem = new TextItem(currTextItem, new Font(currTextItem.Font.FontFamily,currTextItem.Font.Size,currTextItem.Font.Style | FontStyle.Strikeout, GraphicsUnit.World));
                  currTextLine.Add(currTextItem);
                  currTxtIdx = bi+3;
                }
                  break; // end strikeout
                case 'g':
                case 'G':
                {
                  itemstack.Push(currTextItem);
                  currTextItem = new TextItem(currTextItem, new Font("Symbol",currTextItem.Font.Size,currTextItem.Font.Style, GraphicsUnit.World));
                  currTextLine.Add(currTextItem);
                  currTxtIdx = bi+3;
                }
                  break; // underlined
                case '+':
                case '-':
                {
                  itemstack.Push(currTextItem);
                  // measure the current font size
                  float cyLineSpace,cyAscent,cyDescent;
                  MeasureFont(g,currTextItem.Font,out cyLineSpace, out cyAscent, out cyDescent);
                  
                  currTextItem = new TextItem(currTextItem, new Font(currTextItem.Font.FontFamily,0.65f*currTextItem.Font.Size,currTextItem.Font.Style, GraphicsUnit.World));
                  currTextLine.Add(currTextItem);
                  currTextItem.m_SubIndex += ('+'==_text[bi+1] ? 1 : -1);


                  if('-'==_text[bi+1]) 
                    currTextItem.m_yShift += 0.15f*cyAscent; // Carefull: plus (+) means shift down
                  else
                    currTextItem.m_yShift -= 0.35f*cyAscent; // be carefull: minus (-) means shift up
                  
                  currTxtIdx = bi+3;
                }
                  break; // underlined
                case 'l': // Plot Curve Symbol
                case 'L':
                {
                  // parse the arguments
                  // either in the Form 
                  // \L(PlotCurveNumber) or
                  // \L(LayerNumber, PlotCurveNumber) or
                  // \L(LayerNumber, PlotCurveNumber, DataPointNumber)


                  // find the corresponding closing brace
                  int closingbracepos = _text.IndexOf(")",bi+1);
                  if(closingbracepos<0) // no brace found, so threat this as normal text
                  {
                    currTextItem.Text += _text.Substring(bi,3);
                    currTxtIdx += 3;
                    continue;
                  }
                  // count the commas between here and the closing brace to get
                  // the number of arguments
                  int parsepos=bi+3;
                  int[] arg = new int[3];
                  int args;
                  for(args=0;args<3 && parsepos<closingbracepos;args++)
                  {
                    int commapos = _text.IndexOf(",",parsepos,closingbracepos-parsepos);
                    int endpos = commapos>0 ? commapos : closingbracepos; // the end of this argument
                    try { arg[args]=System.Convert.ToInt32(_text.Substring(parsepos,endpos-parsepos)); }
                    catch(Exception) { break; }
                    parsepos = endpos+1;
                  }
                  if(args==0) // if not successfully parsed at least one number
                  {
                    currTextItem.Text += _text.Substring(bi,3);
                    currTxtIdx += 3;
                    continue;   // handle it as if it where normal text
                  }

                  // itemstack.Push(currTextItem); // here we don't need to put the item on the stack, since we pared until the closing brace
                  currTextItem = new TextItem(currTextItem,null);
                  currTextLine.Add(currTextItem);
                  currTextItem.SetAsSymbol(args,arg);

                  currTextItem = new TextItem(currTextItem,null); // create a normal text item behind the symbol item
                  currTextLine.Add(currTextItem); // to have room for the following text
                  currTxtIdx = closingbracepos+1;
                }
                  break; // curve symbol
                case '%': // Plot Curve Name
                {
                  // parse the arguments
                  // either in the Form 
                  // \%(PlotCurveNumber) or
                  // \%(LayerNumber, PlotCurveNumber) or
                  Match match;
                  int layerNumber=-1;
                  int plotNumber=-1;
                  string plotLabelStyle=null;
                  bool   plotLabelStyleIsPropColName=false;
                  if((match = _regexIntArgument.Match(_text,bi+2)).Success)
                  {
                    plotNumber = int.Parse(match.Result("${argone}"));
                  }
                  else if((match = _regexIntIntArgument.Match(_text,bi+2)).Success)
                  {
                    layerNumber = int.Parse(match.Result("${argone}"));
                    plotNumber =  int.Parse(match.Result("${argtwo}"));
                  }
                  else if((match = _regexIntQstrgArgument.Match(_text,bi+2)).Success)
                  {
                    plotNumber     = int.Parse(match.Result("${argone}"));
                    plotLabelStyle =  match.Result("${argtwo}");
                    plotLabelStyleIsPropColName=true;
                  }
                  else if((match = _regexIntStrgArgument.Match(_text,bi+2)).Success)
                  {
                    plotNumber     = int.Parse(match.Result("${argone}"));
                    plotLabelStyle =  match.Result("${argtwo}");
                  }
                  else if((match = _regexIntIntStrgArgument.Match(_text,bi+2)).Success)
                  {
                    layerNumber = int.Parse(match.Result("${argone}"));
                    plotNumber =  int.Parse(match.Result("${argtwo}"));
                    plotLabelStyle = match.Result("${argthree}");
                  }
                  else if((match = _regexIntIntQstrgArgument.Match(_text,bi+2)).Success)
                  {
                    layerNumber = int.Parse(match.Result("${argone}"));
                    plotNumber =  int.Parse(match.Result("${argtwo}"));
                    plotLabelStyle = match.Result("${argthree}");
                    plotLabelStyleIsPropColName=true;
                  }
      
                  if(match.Success)
                  {
                    itemstack.Push(currTextItem);
                    currTextItem = new TextItem(currTextItem,null);
                    currTextLine.Add(currTextItem);
                    currTextItem.SetAsPlotCurveName(layerNumber,plotNumber,plotLabelStyle,plotLabelStyleIsPropColName);

                    currTextItem = new TextItem(currTextItem,null); // create a normal text item behind the symbol item
                    currTextLine.Add(currTextItem); // to have room for the following text
                    currTxtIdx = bi+2+match.Length;
                  }
                  else
                  {
                    currTextItem.Text += _text.Substring(bi,2);
                    currTxtIdx += 3;
                    continue;   // handle it as if it where normal text
                  }
                }
                  break; // percent symbol
                default:
                  // take the sequence as it is
                  currTextItem.Text += _text.Substring(bi,3);
                  currTxtIdx = bi+3;
                  break;
              } // end of switch
            }
            else // if no formatting and also no closing brace or backslash, take it as it is
            {
              currTextItem.Text += _text[bi];
              currTxtIdx = bi+1;
            }
          } // end if it was a backslash
          else if(')'==_text[bi]) // closing brace
          {
            // the formating is finished, we can return to the formating of the previous section
            if(itemstack.Count>0)
            {
              TextItem preservedprevious = (TextItem)itemstack.Pop();
              currTextItem = new TextItem(preservedprevious,null);
              currTextLine.Add(currTextItem);
              currTxtIdx = bi+1;
            }
            else // if the stack is empty, take the brace as it is, and use the default style
            {
              currTextItem.Text += _text[bi];
              currTxtIdx = bi+1;
            }

          }
        }

      } // end of while loop

      this._isStructureInSync=true; // now the text was interpreted
    }
コード例 #40
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="from"></param>
 /// <param name="ft"></param>
 public TextItem(TextItem from, Font ft)
 {
   m_Type = InnerType.Empty;
   m_Text = "";
   m_bUnderlined = from.m_bUnderlined;
   m_bItalic = from.m_bItalic;
   m_bBold = from.m_bBold;
   m_bGreek = from.m_bGreek;
   m_SubIndex = from.m_SubIndex;
   m_yShift = from.m_yShift;
   m_Font = null != ft ? ft : from.m_Font;
 }
コード例 #41
0
        /**
         * Buidls a dictionary of localizable text items in the scene.
         */
        protected Dictionary<string, TextItem> FindTextItems()
        {
            Dictionary<string, TextItem> textItems = new Dictionary<string, TextItem>();

            // Export all character names
            foreach (Character character in GameObject.FindObjectsOfType<Character>())
            {
                // String id for character names is CHARACTER.<Character Name>
                TextItem textItem = new TextItem();
                textItem.standardText = character.nameText;
                textItem.description = character.description;
                string stringId = "CHARACTER." + character.nameText;
                textItems[stringId] = textItem;
            }

            // Export all Say and Menu commands in the scene
            // To make it easier to localize, we preserve the command order in each exported block.
            Flowchart[] flowcharts = GameObject.FindObjectsOfType<Flowchart>();
            foreach (Flowchart flowchart in flowcharts)
            {
                // Have to set a unique localization id to export strings
                if (flowchart.localizationId.Length == 0)
                {
                    continue;
                }

                Block[] blocks = flowchart.GetComponentsInChildren<Block>();
                foreach (Block block in blocks)
                {
                    foreach (Command command in block.commandList)
                    {
                        string stringId = "";
                        string standardText = "";
                        string description = "";

                        System.Type type = command.GetType();
                        if (type == typeof(Say))
                        {
                            // String id for Say commands is SAY.<Flowchart id>.<Command id>.<Character Name>
                            Say sayCommand = command as Say;
                            standardText = sayCommand.storyText;
                            description = sayCommand.description;
                            stringId = "SAY." + flowchart.localizationId + "." + sayCommand.itemId + ".";
                            if (sayCommand.character != null)
                            {
                                stringId += sayCommand.character.nameText;
                            }
                        }
                        else if (type == typeof(Menu))
                        {
                            // String id for Menu commands is MENU.<Flowchart id>.<Command id>
                            Menu menuCommand = command as Menu;
                            standardText = menuCommand.text;
                            description = menuCommand.description;
                            stringId = "MENU." + flowchart.localizationId + "." + menuCommand.itemId;
                        }
                        else
                        {
                            continue;
                        }

                        TextItem textItem = null;
                        if (textItems.ContainsKey(stringId))
                        {
                            textItem = textItems[stringId];
                        }
                        else
                        {
                            textItem = new TextItem();
                            textItems[stringId] = textItem;
                        }

                        // Update basic properties,leaving localised strings intact
                        textItem.standardText = standardText;
                        textItem.description = description;
                    }
                }
            }

            return textItems;
        }
コード例 #42
0
        /**
         * 绘制文字,该文字随地图变化有透视效果
         * @return 文字对象
         */
        public TextItem DrawText()
        {
            double mLat = 39.86923;
            double mLon = 116.397428;
            int lat = (int)(mLat * 1E6);
            int lon = (int)(mLon * 1E6);
            //构建文字
            TextItem item = new TextItem();
            //设置文字位置
            item.Pt = new GeoPoint(lat, lon);
            //设置文件内容
            item.Text = "百度地图SDK";
            //设文字大小
            item.FontSize = 40;
            Symbol symbol = new Symbol();
            Symbol.Color bgColor = new Com.Baidu.Mapapi.Map.Symbol.Color(symbol);
            //设置文字背景色
            bgColor.Red = 0;
            bgColor.Blue = 0;
            bgColor.Green = 255;
            bgColor.Alpha = 50;

            Symbol.Color fontColor = new Com.Baidu.Mapapi.Map.Symbol.Color(symbol);
            //设置文字着色
            fontColor.Alpha = 255;
            fontColor.Red = 0;
            fontColor.Green = 0;
            fontColor.Blue = 255;
            //设置对齐方式
            item.Align = TextItem.AlignCenter;
            //设置文字颜色和背景颜色
            item.FontColor = fontColor;
            item.BgColor = bgColor;
            return item;
        }
コード例 #43
0
ファイル: Card.cs プロジェクト: jimva3hj/hamqsler
 /// <summary>
 /// Adds a TextItem to the card. 
 /// </summary>
 public void AddText()
 {
     TextItem ti = new TextItem();
     ti.QslCard = this;
     TextItems.Add(ti);
     StaticText sText = new StaticText();
     sText.Text = "Text Item";
     ti.Text.Add(sText);
     //			ti.SetDisplayText();
     CardItem ci = GetHighlighted();
     if(ci != null)
     {
         ci.IsHighlighted = false;
     }
     ti.IsSelected = true;
     IsDirty = true;
 }
コード例 #44
0
ファイル: Card.cs プロジェクト: jimva3hj/hamqsler
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="width">Width of the card in device independent units</param>
        /// <param name="height">Height of the card in device independent units</param>
        /// <param name="isInDesignMode">Boolean to indicate if this image is to be displayed
        /// in design mode</param>
        public Card(double width, double height, bool isInDesignMode)
            : base(new Rect(0, 0, width, height), isInDesignMode)
        {
            userPreferences = ((App)Application.Current).UserPreferences;
            // card properties
            // background image
            BackImage = new BackgroundImage(isInDesignMode);
            BackImage.QslCard = this;
            // call text item
            TextItem call = new TextItem(isInDesignMode);
            call.QslCard = this;
            foreach(TextPart part in userPreferences.Callsign)
            {
                call.Text.Add(part);
            }
            call.TextFontFace = userPreferences.DefaultTextItemsFontFace;
            call.TextFontWeight = FontWeights.Black;
            call.FontSize = 72.0;
            call.DisplayX = -70;
            call.DisplayY = 0;
            call.DisplayWidth = 0;
            call.DisplayHeight = 0;
            TextItems.Add(call);
            // name Qth text item
            TextItem nameQth = new TextItem(isInDesignMode);
            nameQth.QslCard = this;
            foreach(TextPart part in userPreferences.NameQth)
            {
                nameQth.Text.Add(part);
            }
            nameQth.TextFontFace = userPreferences.DefaultTextItemsFontFace;
            nameQth.TextFontWeight = FontWeights.Normal;
            nameQth.FontSize = 12.0;
            nameQth.DisplayX = DisplayWidth / 2;
            nameQth.DisplayY = 15;
            nameQth.DisplayWidth = 0;
            nameQth.DisplayHeight = 0;
            TextItems.Add(nameQth);
            // salutation
            TextItem salutation = new TextItem(isInDesignMode);
            salutation.QslCard = this;
            foreach(TextPart part in userPreferences.Salutation)
            {
                salutation.Text.Add(part);
            }
            salutation.TextFontFace = userPreferences.DefaultTextItemsFontFace;
            salutation.FontSize = 12.0;
            salutation.DisplayX = 5;
            salutation.DisplayY = DisplayHeight - 25;
            salutation.DisplayWidth = 0;
            salutation.DisplayHeight = 0;
            TextItems.Add(salutation);

            // QsosBox
            qsosBox = new QsosBox(isInDesignMode);
            qsosBox.QslCard = this;
            // more card properties
            QslCard = this;
            IsDirty = false;
        }
コード例 #45
0
        public async void AutoComplete()
        {
            _cancelationTokenSource.Cancel();
            _cancelationTokenSource = new CancellationTokenSource();

            var token = _cancelationTokenSource.Token;
            await Task.Run(() =>
            {
                if (string.IsNullOrWhiteSpace(Input)) return;

                var result = _autoCompleteText.Autocomplete(Input);

                token.ThrowIfCancellationRequested();

                _log.Info("Got autocompletion '{0}' for '{1}' with {2} alternatives",
                    result.AutoCompletedCommand, result.OriginalText,
                    result.OtherOptions.Count());

                ListWithCurrentSelection<AutoCompletionResult.CommandResult> options;
                if (result.HasAutoCompletion)
                {
                    options = new[] {result.AutoCompletedCommand}
                        .Concat(result.OtherOptions)
                        .ToListWithCurrentSelection();
                }
                else
                {
                    options = new TextItem(Input, string.Empty).ToListWithCurrentSelection();
                }

                UpdateCommandOptions(options);
            }, token)
                .GuardForException(SetError);
        }
コード例 #46
0
ファイル: Card.cs プロジェクト: jimva3hj/hamqsler
 /// <summary>
 /// Load values for this Card from QslDnP card file contents
 /// </summary>
 /// <param name="itemNode">The Card node</param>
 /// <param name="culture">CultureInfo that the card was created in</param>
 private void LoadCard(XmlNode cardNode, CultureInfo culture)
 {
     XmlNode node = XmlProcs.GetFirstChildElement(cardNode);
     while(node != null)
     {
         switch(node.Name)
         {
             case "CardItem":
                 base.Load(node, culture);
                 QslCard = this;
                 // upper left corner of hamqsler cards always 0, 0
                 QslCard.DisplayX = 0;
                 QslCard.DisplayY = 0;
                 break;
             case "BackgroundImage":
                 BackImage = new BackgroundImage(true);
                 BackImage.Load(node, culture);
                 BackImage.QslCard = this;
                 break;
             case "SecondaryImage":
                 SecondaryImage sImage = new SecondaryImage();
                 sImage.Load(node, culture);
                 SecondaryImages.Add(sImage);
                 sImage.QslCard = this;
                 break;
             case "TextItem":
                 TextItem ti = new TextItem();
                 ti.Load(node, culture);
                 TextItems.Add(ti);
                 ti.QslCard = this;
                 break;
             case "QsosBox":
                 QsosBox = new QsosBox(true);
                 QsosBox.Load(node, culture);
                 QsosBox.QslCard = this;
                 break;
         }
         node = XmlProcs.GetNextSiblingElement(node);
     }
 }
コード例 #47
0
ファイル: SplashText.cs プロジェクト: Grutn/B.rain-project
 public void Hide(TextItem i)
 {
     i.Time = 1.0f;
 }
コード例 #48
0
ファイル: Localization.cs プロジェクト: alalwww/OverlayPlugin
 public static string GetText(TextItem item)
 {
     return dict[item, GetCurrentLocale()];
 }