public List <SimpleSymbol> GetDoubleMana()
        {
            var requestPath = $"/symbology";

            var request = new RestRequest(requestPath, DataFormat.Json);

            var jsonString = _client.Get(request).Content;

            var symbolData = SymbolContainer.FromJson(jsonString);

            var symbols = symbolData.Symbols;

            var simpleSymbols = new List <SimpleSymbol>();

            foreach (var symbol in symbols)
            {
                if (symbol.AppearsInManaCosts && symbol.Colors.Count != 2)
                {
                    var simpleSymbol = new SimpleSymbol
                    {
                        SymbolCode   = symbol.SymbolCode,
                        SymbolText   = symbol.SymbolText,
                        ImgUri       = symbol.SvgUri,
                        SymbolColors = symbol.Colors
                    };
                    simpleSymbols.Add(simpleSymbol);
                }
            }

            return(simpleSymbols);
        }
示例#2
0
        static void Main()
        {
            string textFilePath   = ConfigurationManager.AppSettings["TextFilePath"];
            string symbolFilePath = ConfigurationManager.AppSettings["SymbolsFilePath"];

            SymbolContainer symbolContainer = new SymbolContainer(symbolFilePath);
            TextParser      textParser      = new TextParser(symbolContainer);

            Text text = textParser.ParseText(textFilePath, new List <ISentence>());

            #region Tasks:
            // Returns text ordered by increase count of words in sentences:
            IOrderedEnumerable <ISentence> orderedText = text.GetSentenceOrderedByWordsCount();

            // Returns words with determine length in interrogative sentences:
            IEnumerable <IWord> words = text.GetWordsByLengthInInterrogative(3);

            // Delete all words with determine length from text which starts with coconsonants letters:
            text.DeleteWordsByLength(3);

            // In some sentence words with determine length replaced others sentence items:
            ISentence sentenceItems = textParser.ParseSentenceByItems("insert, this and  this   :");
            text.ReplaceWordsByLength(1, 2, sentenceItems);
            #endregion
        }
        public List <Uri> GetUrisForSymbolCodes(List <String> incSymbolCodes)
        {
            var requestPath = $"/symbology";

            var request = new RestRequest(requestPath, DataFormat.Json);

            var jsonString = _client.Get(request).Content;

            var symbolData = SymbolContainer.FromJson(jsonString);

            var symbols = symbolData.Symbols;

            var uris = new List <Uri>();

            foreach (var symbol in symbols)
            {
                foreach (var incSymbolCode in incSymbolCodes)
                {
                    if (symbol.SymbolCode == incSymbolCode)
                    {
                        uris.Add(symbol.SvgUri);
                    }
                }
            }

            return(uris);
        }
        public SymbolContainer GetAllSymbols()
        {
            var requestPath = $"/symbology";

            var request = new RestRequest(requestPath, DataFormat.Json);

            var jsonString = _client.Get(request).Content;

            var symbolData = SymbolContainer.FromJson(jsonString);

            return(symbolData);
        }
        public async Task <String> getBatch([FromBody] SymbolContainer symbols)
        {
            //Get the list of symbols needed for the batch request
            var listOfSymbols = symbols.Symbols;

            //Capitalize every symbol
            listOfSymbols = listOfSymbols.ConvertAll(symbol => symbol.ToUpper());

            //Return the price and percent change of each symbol
            var batch = await _stockService.FetchBatch(listOfSymbols);

            return(Newtonsoft.Json.JsonConvert.SerializeObject(batch));
        }
示例#6
0
 public WordCreater(SymbolContainer symbolContainer)
 {
     this.symbolContainer = symbolContainer;
 }
示例#7
0
 public PointTextContainer CreatePointTextContainer(Point xy, Display display, int priority, string text, IPaint paintFront, IPaint paintBack, SymbolContainer symbolContainer, Position position, int maxTextWidth)
 {
     return(new SkiaPointTextContainer(xy, display, priority, text, paintFront, paintBack, symbolContainer, position, maxTextWidth));
 }
示例#8
0
        internal SkiaPointTextContainer(Point xy, Display display, int priority, string text, IPaint paintFront, IPaint paintBack, SymbolContainer symbolContainer, Position position, int maxTextWidth) : base(xy, display, priority, text, paintFront, paintBack, symbolContainer, position, maxTextWidth)
        {
            float boxWidth, boxHeight;

            // TODO: Multiline TextBox
            //if (this.textWidth > this.maxTextWidth)
            //{
            //	// if the text is too wide its layout is done by the Android StaticLayout class,
            //	// which automatically inserts line breaks. There is not a whole lot of useful
            //	// documentation of this class.
            //	// For below and above placements the text is center-aligned, for left on the right
            //	// and for right on the left.
            //	// One disadvantage is that it will always keep the text within the maxWidth,
            //	// even if that means breaking text mid-word.
            //	// This code currently does not play that well with the LabelPlacement algorithm.
            //	// The best way to disable it is to make the maxWidth really wide.

            //	TextPaint frontTextPaint = new TextPaint(SkiaGraphicFactory.GetPaint(this.paintFront));
            //	TextPaint backTextPaint = null;

            //	if (this.paintBack != null)
            //	{
            //		backTextPaint = new TextPaint(SkiaGraphicFactory.GetPaint(this.paintBack));
            //	}

            //	Layout.Alignment alignment = Layout.Alignment.ALIGN_CENTER;
            //	if (Position.LEFT == this.position || Position.BELOW_LEFT == this.position || Position.ABOVE_LEFT == this.position)
            //	{
            //		alignment = Layout.Alignment.ALIGN_OPPOSITE;
            //	}
            //	else if (Position.RIGHT == this.position || Position.BELOW_RIGHT == this.position || Position.ABOVE_RIGHT == this.position)
            //	{
            //		alignment = Layout.Alignment.ALIGN_NORMAL;
            //	}

            //	// strange Android behaviour: if alignment is set to center, then
            //	// text is rendered with right alignment if using StaticLayout
            //	frontTextPaint.TextAlign = graphics.Paint.Align.LEFT;
            //	if (this.paintBack != null)
            //	{
            //		backTextPaint.TextAlign = android.graphics.Paint.Align.LEFT;
            //	}

            //	frontLayout = new StaticLayout(this.text, frontTextPaint, this.maxTextWidth, alignment, 1, 0, false);
            //	backLayout = null;
            //	if (this.paintBack != null)
            //	{
            //		backLayout = new StaticLayout(this.text, backTextPaint, this.maxTextWidth, alignment, 1, 0, false);
            //	}

            //	boxWidth = frontLayout.Width;
            //	boxHeight = frontLayout.Height;

            //}
            //else
            {
                boxWidth  = textWidth;
                boxHeight = textHeight;
            }

            switch (this.position)
            {
            case Position.Center:
                boundary = new Rectangle(-boxWidth / 2f, -boxHeight / 2f, boxWidth / 2f, boxHeight / 2f);
                break;

            case Position.Below:
                boundary = new Rectangle(-boxWidth / 2f, 0, boxWidth / 2f, boxHeight);
                break;

            case Position.BelowLeft:
                boundary = new Rectangle(-boxWidth, 0, 0, boxHeight);
                break;

            case Position.BelowRight:
                boundary = new Rectangle(0, 0, boxWidth, boxHeight);
                break;

            case Position.Above:
                boundary = new Rectangle(-boxWidth / 2f, -boxHeight, boxWidth / 2f, 0);
                break;

            case Position.AboveLeft:
                boundary = new Rectangle(-boxWidth, -boxHeight, 0, 0);
                break;

            case Position.AboveRight:
                boundary = new Rectangle(0, -boxHeight, boxWidth, 0);
                break;

            case Position.Left:
                boundary = new Rectangle(-boxWidth, -boxHeight / 2f, 0, boxHeight / 2f);
                break;

            case Position.Right:
                boundary = new Rectangle(0, -boxHeight / 2f, boxWidth, boxHeight / 2f);
                break;

            default:
                break;
            }
        }
 public TextParser(SymbolContainer symbolContainer)
 {
     this.symbolContainer = symbolContainer;
     this.wordCreator     = new WordCreater(symbolContainer);
     this.sentenceCreator = new SentenceCreater();
 }