Example #1
0
        public void ParseEndpoint(Endpoint endpoint)
        {
            AddTitle(endpoint);
            AddUrl(endpoint);
            AddDescription(endpoint);

            if (endpoint.Headers.Count > 0)
            {
                ParseHeaders(endpoint.Headers);
            }

            if (endpoint.QueryParams.Count > 0)
            {
                ParseQueryParams(endpoint.QueryParams);
            }

            if (endpoint.Body.Count > 0)
            {
                Styler.SetBodyTitleStyle(Document.InsertParagraph("Body [" + endpoint.BodyMode + "]"));
                ParseBody(endpoint.BodyMode, endpoint.Body);
            }

            //generate CURL example
            GenerateCurlExampleRequest(endpoint);

            if (endpoint.Response.Count > 0)
            {
                Styler.SetResponseTitleStyle(Document.InsertParagraph("Responses"));
                ParseResponse(endpoint.Response);
            }
        }
Example #2
0
 public Expanded(double[,] collection, Styler styler)
     : this()
 {
     Styler         = styler;
     CollectionList = collection;
     createRowCol(collection);
 }
        /// <summary>
        /// Adds a style classification to the StyleSheet.
        /// </summary>
        /// <param name="target">The string to be styled.</param>
        /// <param name="color">The color to be applied to the target.</param>
        public void AddStyle(string target, Color color)
        {
            Styler.MatchFound handler = (s, l, m) => m;
            Styler styler = new Styler(target, color, handler);

            Styles.Add(styler);
        }
Example #4
0
        public void AddTitle(Endpoint endpoint)
        {
            Paragraph p = Document.InsertParagraph();

            Styler.SetMethodStyle(p.Append(endpoint.Method), endpoint.Method);
            Styler.SetEndpointTitleStyle(p.Append(" " + endpoint.Title));
        }
        /// <summary>
        /// Adds a style classification to the StyleSheet.
        /// </summary>
        /// <param name="target">The string to be styled.</param>
        /// <param name="color">The color to be applied to the target.</param>
        /// <param name="matchHandler">A delegate instance which describes a simpler transformation that
        /// can be applied to the target.</param>
        public void AddStyle(string target, Color color, Styler.MatchFoundLite matchHandler)
        {
            Styler.MatchFound wrapper = (s, l, m) => matchHandler.Invoke(m);
            Styler styler = new Styler(target, color, wrapper);

            Styles.Add(styler);
        }
Example #6
0
        private void CariListesi_Load(object sender, EventArgs e)
        {
            try
            {
                DataTable cariList = new DataTable();
                sqlCmd     = new SqlCommand("SELECT CARI_INCKEY, CARI_KOD, TC_NO, ADSOYAD, IL, ILCE, ADRES, TICARI_UNVAN, VERGI_DAIRE, VERGI_NO, TEL_NO, EPOSTA, CEP_TEL, FAX_NO, CARI_DURUM FROM CARI ORDER BY CARI_INCKEY DESC", Program.connection);
                sqlAdapter = new SqlDataAdapter(sqlCmd);
                sqlAdapter.Fill(cariList);

                typeof(DataGridView).InvokeMember(
                    "DoubleBuffered",
                    BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty,
                    null,
                    cariListesiGridView,
                    new object[] { true });

                cariListesiGridView.DataSource = cariList;
                Styler.gridViewCommonStyle(cariListesiGridView);

                cariListesiGridView.Columns[0].Visible = false;
            }catch (Exception ex)
            {
                Notification.messageBoxError(ex.Message);
            }
        }
Example #7
0
 public ContentList(int count, int item, Styler styler)
     : this()
 {
     Styler = styler;
     called(count, Styler.Lists[item]);
     Styler.windowState = WindowState.Minimized;
 }
Example #8
0
        private void TumKayitListe()
        {
            try
            {
                StokRaporTable     = new DataTable();
                sqlCmd             = new SqlCommand("dbo.Stok_Raporu", Program.connection);
                sqlCmd.CommandType = CommandType.StoredProcedure;
                sqlCmd.Parameters.AddWithValue("@STARTDATE", DBNull.Value);
                sqlCmd.Parameters.AddWithValue("@ENDDATE", DBNull.Value);
                sqlDataAdapter = new SqlDataAdapter(sqlCmd);
                sqlDataAdapter.Fill(StokRaporTable);

                Styler.gridViewCommonStyle(StokRaporuGridView);
                StokRaporuGridView.DataSource = StokRaporTable;

                typeof(DataGridView).InvokeMember(
                    "DoubleBuffered",
                    BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty,
                    null,
                    StokRaporuGridView,
                    new object[] { true });

                StokRaporuGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            }
            catch (Exception ex)
            {
                Notification.messageBoxError(ex.Message);
            }
        }
        private void btnTarihAraligi_Click(object sender, EventArgs e)
        {
            try
            {
                operatorRaporTable = new DataTable();
                sqlCmd             = new SqlCommand("dbo.Operator_Raporu", Program.connection);
                sqlCmd.CommandType = CommandType.StoredProcedure;
                sqlCmd.Parameters.AddWithValue("@STARTDATE", dtStartDate.Value);
                sqlCmd.Parameters.AddWithValue("@ENDDATE", dtEndDate.Value);
                sqlDataAdapter = new SqlDataAdapter(sqlCmd);
                sqlDataAdapter.Fill(operatorRaporTable);

                Styler.gridViewCommonStyle(OperatorRaporuGridView);
                OperatorRaporuGridView.DataSource = operatorRaporTable;

                typeof(DataGridView).InvokeMember(
                    "DoubleBuffered",
                    BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty,
                    null,
                    OperatorRaporuGridView,
                    new object[] { true });

                OperatorRaporuGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            }
            catch (Exception ex)
            {
                Notification.messageBoxError(ex.Message);
            }
        }
        private void SiparisOlustur_Load(object sender, EventArgs e)
        {
            kaydetBttn.Enabled                     = false;
            siparisTipi.SelectedIndex              = 0;
            txtSiparisTarih.Text                   = DateTime.Now.ToString("dd.MM.yyyy");
            txtSiparisTeslimTarih.Text             = DateTime.Now.ToString("dd.MM.yyyy");
            siparisListesiGridView.ColumnCount     = 9;
            siparisListesiGridView.Columns[0].Name = "STOK_DEPO_INCKEY";
            siparisListesiGridView.Columns[1].Name = "STOK_INCKEY";
            siparisListesiGridView.Columns[2].Name = "STOK_KODU";
            siparisListesiGridView.Columns[3].Name = "STOK_ADI";
            siparisListesiGridView.Columns[4].Name = "DEPO";
            siparisListesiGridView.Columns[5].Name = "MIKTAR";
            siparisListesiGridView.Columns[6].Name = "BIRIM";
            siparisListesiGridView.Columns[7].Name = "BIRIM_FIYAT";
            siparisListesiGridView.Columns[8].Name = "TUTAR";

            siparisListesiGridView.Columns[0].Visible = false;
            siparisListesiGridView.Columns[1].Visible = false;

            Styler.gridViewCommonStyle(siparisListesiGridView);
            siparisListesiGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;

            siparisListesiGridView.Rows.Clear();
            siparisListesiGridView.Refresh();
        }
Example #11
0
        public void StylizeTest_Latin_IncompletedOneStyle()
        {
            string textToBeStylized1 = "Confusing!q";
            string textToBeStylized2 = "You are GREAT";

            Assert.AreEqual("Cแต’โฟแถ แต˜หขโฑโฟแต!q", Styler.Stylize(textToBeStylized1, UnicodeSets.LatinModifierUppercaseSet, UnicodeSets.LatinModifierLowercaseSet));
            Assert.AreEqual("๐Œ–ou are GR๐Œ„๐Œ€๐Œ•", Styler.Stylize(textToBeStylized2, UnicodeSets.LatinOldItalicUppercaseSet));
        }
        public void BaseStyling()
        {
            Styler.SetTextColor(UsernameTextField, Colors.mainFontColor);
            Styler.SetTextColor(PasswordTextField, Colors.mainFontColor);
            Styler.SetTextColor(ErrorLabel, UIColor.Red);

            Styler.SetShadows(LoginButton, UIColor.Black, 2, 3, 3f);
        }
Example #13
0
        private void frmNotification_Load(object sender, System.EventArgs e)
        {
            Styler.Start();
            var player = new SoundPlayer(Resources.iPhone_tone);

            player.Play();
            ClosingTimer.Start();
        }
Example #14
0
        public void StylizeTest_Latin_OneStyle()
        {
            string textToBeStylized1 = "Style me!";
            string textToBeStylized2 = "/*- Holy sxxt I gotta go -*/";

            Assert.AreEqual("๐’๐ญ๐ฒ๐ฅ๐ž ๐ฆ๐ž!", Styler.Stylize(textToBeStylized1, UnicodeSets.LatinBoldUppercaseSet, UnicodeSets.LatinBoldLowercaseSet));
            Assert.AreEqual("/*- โ„Œ๐”ฌ๐”ฉ๐”ถ ๐”ฐ๐”ต๐”ต๐”ฑ โ„‘ ๐”ค๐”ฌ๐”ฑ๐”ฑ๐”ž ๐”ค๐”ฌ -*/", Styler.Stylize(textToBeStylized2, UnicodeSets.LatinFrakturUppercaseSet, UnicodeSets.LatinFrakturLowercaseSet));
        }
Example #15
0
        public void StylizeTest_Latin_WithFallbackStyle()
        {
            string textToBeStylized1 = "Without You";
            string textToBeStylized2 = "See You Again";

            Assert.AreEqual("แต‚โฑแต—สฐแต’แต˜แต— ๐šˆแต’แต˜", Styler.Stylize(textToBeStylized1, UnicodeSets.LatinModifierUppercaseSet, UnicodeSets.LatinModifierLowercaseSet, UnicodeSets.LatinMonospaceUppercaseSet, UnicodeSets.LatinMonospaceLowercaseSet));
            Assert.AreEqual("๐Ÿ„ขโ‚‘โ‚‘ ๐Ÿ„จโ‚’แตค ๐Ÿ„โ’ขโ‚แตขโ‚™", Styler.Stylize(textToBeStylized2, UnicodeSets.LatinSubscriptLowercaseSet, UnicodeSets.LatinParenthesizedUppercaseSet, UnicodeSets.LatinParenthesizedLowercaseSet));
        }
Example #16
0
        public void StylizeTest_Number_OneStyle()
        {
            string textToBeStylized1 = "00039039000";
            string textToBeStylized2 = "95423165877";

            Assert.AreEqual("๏ผ๏ผ๏ผ๏ผ“๏ผ™๏ผ๏ผ“๏ผ™๏ผ๏ผ๏ผ", Styler.Stylize(textToBeStylized1, UnicodeSets.NumberFullWidthSet));
            Assert.AreEqual("๐Ÿต๐Ÿฑ๐Ÿฐ๐Ÿฎ๐Ÿฏ๐Ÿญ๐Ÿฒ๐Ÿฑ๐Ÿด๐Ÿณ๐Ÿณ", Styler.Stylize(textToBeStylized2, UnicodeSets.NumberSansSerifBoldSet));
        }
Example #17
0
        public void StylizeTest_Specials()
        {
            string textNull  = null;
            string textEmpty = "";

            Assert.IsNull(Styler.Stylize(textNull, UnicodeSets.LatinBoldUppercaseSet));
            Assert.AreEqual(textEmpty, Styler.Stylize(textEmpty, UnicodeSets.LatinItalicUppercaseSet));
        }
Example #18
0
        public void OneTimeTearDown()
        {
            Task.WaitAll(
                Task.Run(() => WebDriver.Close()),
                Task.Run(() => WebServer.AfterTests()));

            Styler.Set(new EmptyStyle());
        }
Example #19
0
 public ContentList(int m, int n, int item, Styler styler)
     : this()
 {
     Styler           = styler;
     TempMatListValue = new double[m, n];
     Mat(m, n, Styler.MatList[item]);
     Styler.windowState = WindowState.Minimized;
 }
Example #20
0
        public void AddUrl(Endpoint endpoint)
        {
            Table table = (Table)AddTable(1, 1);

            table.Rows[0].Cells[0].Paragraphs[0].Append(endpoint.Url);
            Styler.SetTableStyle(table);
            Document.InsertParagraph("").InsertTableAfterSelf(table);
        }
        public void TestMarkupExtensionHandling()
        {
            string testInput = MethodBase.GetCurrentMethod().Name + ".xaml";

            Styler styler = new Styler();
            styler.Options.FormatMarkupExtension = true;

            DoTest(testInput, styler);
        }
Example #22
0
        public void BaseStyling()
        {
            Styler.SetTextColor(ErrorLabel, UIColor.Red);
            Styler.SetBorderRadius(AddImageButton, 20f);
            Styler.SetShadows(AddImageButton, UIColor.Black, 2, 3, 2f);
            Styler.SetTextColor(AddImageButton, UIColor.Clear);

            Styler.SetShadows(RegisterButton, UIColor.Black, 2, 3, 3f);
        }
 private void StokDepoListesi_Load(object sender, EventArgs e)
 {
     cellsOfSelectedItem = stokListesi.getSelectedItem().Item2;
     txtStokKod.Text     = cellsOfSelectedItem[1].Value.ToString();
     txtStokAdi.Text     = cellsOfSelectedItem[2].Value.ToString();
     txtStokBirim.Text   = cellsOfSelectedItem[3].Value.ToString();
     Styler.gridViewCommonStyle(stokDepoListGridView);
     listStokDepo();
 }
Example #24
0
        public void NormalizeTest_NumberOnly_MultiStylesPerText()
        {
            string testText1 = "๐Ÿฃ๐Ÿค๐Ÿฅ๐Ÿฐ๐Ÿฑ๐Ÿฒ๐ŸŸ๐Ÿ ๐Ÿก๐Ÿ˜";
            string testText2 = "๐Ÿผ๐Ÿผ๐Ÿบ๐Ÿผ๐Ÿป๐Ÿพ๐Ÿธ๐Ÿน๐Ÿน๐Ÿบ๐Ÿป๐Ÿพ๐Ÿผ๐Ÿฟ๐Ÿฝ๐Ÿปโ‘ผโ‘ผโ‘ทโ‘ตโ‘ดโ‚ƒโ‚…โ‚‡โ‚ˆโ‚‰โ‚‰โ‚…โ‘ปโ‘ธโ‘ตโ‘ตโ‘ดโ‘ทโ‘ตโ‘ธ";
            string testText3 = "๏ผ๏ผ‘๏ผ‘๏ผ’๏ผ๏ผ’๏ผ“๏ผ•๏ผ”๏ผ”๏ผ•๏ผ–๐Ÿซ๐Ÿจ๐Ÿฆ๐Ÿช๐Ÿฉ๐Ÿง๐Ÿค๐Ÿฃ๐Ÿข๐Ÿ ๐Ÿž๐Ÿก๐ŸŸ๐Ÿ๐Ÿ™๐Ÿš๐Ÿœ๐Ÿ ๐Ÿž๐Ÿ›๐Ÿš๐Ÿ›๐Ÿ";

            Assert.AreEqual("1234567890", Styler.Unstylize(testText1), false);
            Assert.AreEqual("664658233458697599421357899585221425", Styler.Unstylize(testText2), false);
            Assert.AreEqual("01120235445696487521086975124863235", Styler.Unstylize(testText3), false);
        }
Example #25
0
        public void NormalizeTest_OneStylePerText_MixWithSpecialCharacters()
        {
            string testText1 = "๐”๐ง๐๐ž๐ซ ๐ญ๐ก๐ž ๐ญ๐ซ๐ž๐ž ๐ฐ๐ก๐ž๐ซ๐ž ๐ญ๐ก๐ž ๐ ๐ซ๐š๐ฌ๐ฌ ๐๐จ๐ง'๐ญ ๐ ๐ซ๐จ๐ฐ @@@@##$%!*";
            string testText2 = "๐‘Š๐‘Ž๐‘ก๐‘Ž๐‘ โ„Ž๐‘–, ๐พ๐‘– ๐‘›๐‘– ๐‘๐‘Ž๐‘Ÿ๐‘–๐‘š๐‘Ž๐‘ ๐‘ข! -/**\\|\\()";
            string testText3 = "๐’ฎ๐’ธโ„ดโ„ด๐“‰โ„ฏ๐“‡ ๐’ท๐“‡โ„ด๐“‰๐’ฝโ„ฏ๐“‡๐“ˆ! ๐’ฎ๐’ž๐’ช๐’ช๐’ฏโ„ฐโ„› โ„ฌโ„›๐’ช๐’ฏโ„‹โ„ฐโ„›๐’ฎ!!! ##^&**%!(**)";

            Assert.AreEqual("Under the tree where the grass don't grow @@@@##$%!*", Styler.Unstylize(testText1), false);
            Assert.AreEqual("Watashi, Ki ni Narimasu! -/**\\|\\()", Styler.Unstylize(testText2), false);
            Assert.AreEqual("Scooter brothers! SCOOTER BROTHERS!!! ##^&**%!(**)", Styler.Unstylize(testText3), false);
        }
Example #26
0
        public void NormalizeTest_NumberOnly_OneStylePerText()
        {
            string testText1 = "๐Ÿ๐Ÿ๐Ÿ‘๐Ÿ’๐Ÿ“๐Ÿ”๐Ÿ•๐Ÿ–๐Ÿ—๐ŸŽ";
            string testText2 = "โ‘ขโ‘ฅโ‘กโ‘ขโ‘ โ‘ฅโ‘ฃโ‘งโ‘จโ‘ฃโ‘ฅโ‘คโ‘ โ‘คโ‘ขโ‘ โ‘ขโ‘กโ‘ โ‘ โ‘ฅโ‘ โ‘ฅโ‘คโ“ชโ‘ โ‘ฅโ‘งโ‘ฃโ‘ฅโ‘ฃโ‘งโ‘จโ‘จโ‘คโ‘ฆโ‘จโ‘งโ‘คโ‘กโ‘ขโ“ช";
            string testText3 = "โพโพโฝโพโบโปโถโปโบโถโบโทโ“ฟโ“ฟโถโนโปโนโฝโผโนโฝโพโพโบโปโทโธโ“ฟโถโบโนโปโนโฝโพ";

            Assert.AreEqual("1234567890", Styler.Unstylize(testText1), false);
            Assert.AreEqual("362316489465153132116165016846489957985230", Styler.Unstylize(testText2), false);
            Assert.AreEqual("998956165152001464874899562301546489", Styler.Unstylize(testText3), false);
        }
Example #27
0
        public void NormalizeTest_MixAllTogether()
        {
            string testText1 = "๐–ถ๐–พ ๐–บ๐—‹๐–พ ๐—’๐—ˆ๐—Ž๐—‡๐—€. ๐–พ๐—๐–พ๐—‡ ๐—‚๐–ฟ ๐—’๐—ˆ๐—Ž ๐–บ๐—‹๐–พ ๐Ÿฃ๐Ÿข๐—Œ, ๐Ÿค๐Ÿข๐—Œ, ๐Ÿง๐Ÿข๐—Œ, ๐–บ๐—‡๐–ฝ ๐Ÿฃ๐Ÿข๐Ÿข๐—Œ!";
            string testText2 = "๐šƒ๐š‘๐šŽ ๐™ง๐™–๐™™๐™ž๐™ช๐™จ ๐™ค๐™› ๐™ฉ๐™๐™š ๐™€๐™–๐™ง๐™ฉ๐™ ๐š’๐šœ ๐šŠ๐š‹๐š˜๐šž๐š ๐Ÿผ,๐Ÿน๐Ÿฝ๐Ÿท๐š”๐š–.";
            string testText3 = "๐Ÿ„˜โ’ฏ โ’ฒโ’คโ’งโ’ง โ’ฏโ’œโ’ฆโ’  โ’œโ’โ’ชโ’ฐโ’ฏ ๐Ÿž๐Ÿœ ๐•™๐• ๐•ฆ๐•ฃ๐•ค โ’โ’ด โ’œ โ’žโ’œโ’ญ โ’œโ’ฏ โ‘ โ“ชโ“ชโ“šโ“œ/โ“—.";

            Assert.AreEqual("We are young. even if you are 10s, 20s, 50s, and 100s!", Styler.Unstylize(testText1), false);
            Assert.AreEqual("The radius of the Earth is about 6,371km.", Styler.Unstylize(testText2), false);
            Assert.AreEqual("It will take about 64 hours by a car at 100km/h.", Styler.Unstylize(testText3), false);
        }
Example #28
0
        public void NormalizeTest_MultiStylesPerText()
        {
            string testText1 = "โ’ฝโ“”โ“โ“กโ“ฃโ“โ“’โ“—โ“”, ๐—๐–พ๐–บ๐—‹๐—๐–ป๐—‹๐–พ๐–บ๐—„, แตƒหกหก แต’แต›แต‰สณ แต—แต’สทโฟ";
            string testText2 = "๐—ฏ๐˜‚๐˜ ๐˜€๐—ผ๐—บ๐—ฒ๐˜๐—ต๐—ถ๐—ป๐—ด ๐˜ง๐˜ญ๐˜ช๐˜ฑ๐˜ฑ๐˜ฆ๐˜ฅ ๐˜ญ๐˜ช๐˜ฌ๐˜ฆ ๐šŠ ๐šœ๐š ๐š’๐š๐šŒ๐š‘";
            string testText3 = "๐™ฌ๐™๐™š๐™ฃ ๐™ฎ๐™ค๐™ช came ๏ฝ๏ฝ’๐–”๐–š๐“ท๐“ญ";

            Assert.AreEqual("Heartache, heartbreak, all over town", Styler.Unstylize(testText1), false);
            Assert.AreEqual("but something flipped like a switch", Styler.Unstylize(testText2), false);
            Assert.AreEqual("when you came around", Styler.Unstylize(testText3), false);
        }
Example #29
0
        private void KullaniciListeleDuzenle_Load(object sender, EventArgs e)
        {
            Styler.gridViewCommonStyle(kullaniciListesiGridView);
            cbGrupKey.DataSource    = KullaniciOlustur.getGrupDataTableForBindToComboBox();
            cbGrupKey.DisplayMember = "GRUP_ADI";
            cbGrupKey.ValueMember   = "GRUP_INCKEY";
            listKullanici();

            cbGrupKey.SelectedIndex = 0;
        }
Example #30
0
        public void NormalizeTest_OneStylePerText()
        {
            string testText1 = "๐˜๐จ๐ฎ ๐š๐ซ๐ž ๐ฆ๐ฒ ๐’๐‡๐˜ ๐๐Ž๐˜";
            string testText2 = "๐”ธ๐•๐• ๐•€ ๐•Ž๐•’๐•Ÿ๐•ฅ ๐”ฝ๐• ๐•ฃ โ„‚๐•™๐•ฃ๐•š๐•ค๐•ฅ๐•ž๐•’๐•ค ๐•€๐•ค ๐”พ๐•†๐”ป๐”ป๐”ธ๐•„โ„• ๐•„๐•†โ„•๐”ผ๐•";
            string testText3 = "โ„Œ๐”ข๐”ถ ๐”Ÿ๐”ฏ๐”ฌ โ„‘ ๐”ค๐”ฌ๐”ฑ๐”ฑ๐”ž ๐”ช๐”ฌ๐”ณ๐”ข ๐”ฌ๐”ซ";
            string testText4 = "๐Ÿ‡น๐Ÿ‡ญ๐Ÿ‡ช ๐Ÿ‡ถ๐Ÿ‡บ๐Ÿ‡ฎ๐Ÿ‡จ๐Ÿ‡ฐ ๐Ÿ‡ง๐Ÿ‡ท๐Ÿ‡ด๐Ÿ‡ผ๐Ÿ‡ณ ๐Ÿ‡ซ๐Ÿ‡ด๐Ÿ‡ฝ ๐Ÿ‡ฏ๐Ÿ‡บ๐Ÿ‡ฒ๐Ÿ‡ต๐Ÿ‡ธ ๐Ÿ‡ด๐Ÿ‡ป๐Ÿ‡ช๐Ÿ‡ท ๐Ÿ‡น๐Ÿ‡ญ๐Ÿ‡ช ๐Ÿ‡ฑ๐Ÿ‡ฆ๐Ÿ‡ฟ๐Ÿ‡พ ๐Ÿ‡ฉ๐Ÿ‡ด๐Ÿ‡ฌ";

            Assert.AreEqual("You are my SHY BOY", Styler.Unstylize(testText1), false);
            Assert.AreEqual("All I Want For Christmas Is GODDAMN MONEY", Styler.Unstylize(testText2), false);
            Assert.AreEqual("Hey bro I gotta move on", Styler.Unstylize(testText3), false);
            Assert.AreEqual("THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG", Styler.Unstylize(testText4), false);
        }
Example #31
0
        public void NormalizeTest_ContainingCJKChars()
        {
            string testText1 = "์ด์   ๐’๐ž๐š๋กœ ๋– ๋‚ ๊ฑฐ์—์š”";
            string testText2 = "๊ฑฐ๋ฏธ๋กœ ๐š†๐šŽ๐š‹ ์ณ์„œ ๐Ÿ„•โ’คโ’ฎโ’ฃ ์žก์œผ๋Ÿฌ";
            string testText3 = "ใใ† โ„๐•’๐•Ÿ๐•• ๐•š๐•Ÿ โ„๐•’๐•Ÿ๐•• ๅ›ใฎใใฎๆ‰‹ใฏ";
            string testText4 = "็Ÿฅใ‚‰ใชใ„่ชฐใ‹ใฎโ„‹๐’ถ๐“ƒ๐’นใ‚’";

            Assert.AreEqual("์ด์   Sea๋กœ ๋– ๋‚ ๊ฑฐ์—์š”", Styler.Unstylize(testText1), false);
            Assert.AreEqual("๊ฑฐ๋ฏธ๋กœ Web ์ณ์„œ Fish ์žก์œผ๋Ÿฌ", Styler.Unstylize(testText2), false);
            Assert.AreEqual("ใใ† Hand in Hand ๅ›ใฎใใฎๆ‰‹ใฏ", Styler.Unstylize(testText3), false);
            Assert.AreEqual("็Ÿฅใ‚‰ใชใ„่ชฐใ‹ใฎHandใ‚’", Styler.Unstylize(testText4), false);
        }
        public void TestAttributeThresholdHandling()
        {
            string testInput = MethodBase.GetCurrentMethod().Name + ".xaml";

            Styler styler = new Styler();
            styler.Options.AttributesTolerance = 0;
            styler.Options.MaxAttributeCharatersPerLine = 80;
            styler.Options.MaxAttributesPerLine = 3;
            styler.Options.PutEndingBracketOnNewLine = true;

            DoTest(testInput, styler);
        }
Example #33
0
 public Others(Styler styler, Mode solve)
     : this()
 {
     Styler             = styler;
     Solve              = solve;
     Styler.ItemSources = new ObservableCollection <ObservableCollection <string> >()
     {
         _angle, _area, _base, _energy, _length, _power, _pressure, _temperature, _time, _velocity, _volume, _weight
     };
     Styler.ItemSource  = _angle;
     from.SelectedIndex = 0;
     to.SelectedIndex   = 0;
 }
Example #34
0
 public void ParseResponse(List <Response> responses)
 {
     foreach (Response response in responses)
     {
         Styler.SetResponseNameStyle(Document.InsertParagraph(response.Name + " [" + response.Status + "]"));
         Document.InsertParagraph("");
         Document.InsertParagraph("Response Status Code: " + response.StatusCode);
         Table table = (Table)AddTable(1, 1);
         table.Rows[0].Cells[0].Paragraphs[0].Append(response.Body);
         Styler.SetTableStyle(table, Styler.Table1Row);
         Document.InsertParagraph("").InsertTableAfterSelf(table);
     }
 }
        public void TestAttributeSortingOptionHandling()
        {
            string testInput = MethodBase.GetCurrentMethod().Name + ".xaml";

            Styler styler = new Styler();
            styler.Options.AttributeOrderClass = "x:Class";
            styler.Options.AttributeOrderWpfNamespace = "xmlns, xmlns:x";
            styler.Options.AttributeOrderKey = "Key, x:Key";
            styler.Options.AttributeOrderName = "Name, x:Name, Title";
            styler.Options.AttributeOrderAttachedLayout = "Grid.Column, Grid.ColumnSpan, Grid.Row, Grid.RowSpan, Canvas.Right, Canvas.Bottom, Canvas.Left, Canvas.Top";
            styler.Options.AttributeOrderCoreLayout = "MinWidth, MinHeight, Width, Height, MaxWidth, MaxHeight, Margin";
            styler.Options.AttributeOrderAlignmentLayout = "Panel.ZIndex, HorizontalAlignment, VerticalAlignment, HorizontalContentAlignment, VerticalContentAlignment";
            styler.Options.AttributeOrderOthers = "Offset, Color, TargetName, Property, Value, StartPoint, EndPoint, PageSource, PageIndex";
            styler.Options.AttributeOrderBlendRelated = "mc:Ignorable, d:IsDataSource, d:LayoutOverrides, d:IsStaticText";

            DoTest(testInput, styler);
        }
        private void DoTest(string testInput, Styler styler)
        {
            string actualOutputFile = testInput.Replace(".xaml", "_output.xaml");
            string expectedOutputFile = testInput.Replace(".xaml", "_output_expected.xaml");

            string output = styler.FormatFile(testInput);

            File.WriteAllText(actualOutputFile, output);

            Assert.IsTrue(this.FileCompare(actualOutputFile, expectedOutputFile));
        }
        /// <summary>
        /// Beautifies a document.
        /// </summary>
        /// <param name="document">The document to beautify.</param>
        private void BeautifyDocument(Document document)
        {
            if (!IsFormattableDocument(document))
            {
                return;
            }

            var xamlEditorProps = DTE.get_Properties("TextEditor", "XAML");
            var insertTabs = (bool)xamlEditorProps.Item("InsertTabs").Value;

            var styler = new Styler()
            {
                IndentCharacter = insertTabs ? '\t' : ' ',
                IndentSize = Int32.Parse(xamlEditorProps.Item("IndentSize").Value.ToString()),
                Options = StylerOptions
            };

            var textDocument = document.Object("TextDocument") as TextDocument;

            var currentPoint = textDocument.Selection.ActivePoint;
            int originalLine = currentPoint.Line;
            int originalOffset = currentPoint.LineCharOffset;

            var startPoint = textDocument.StartPoint.CreateEditPoint();
            var endPoint = textDocument.EndPoint.CreateEditPoint();

            var xamlSource = styler.Format(startPoint.GetText(endPoint));

            startPoint.ReplaceText(endPoint, xamlSource, 0);

            if (originalLine <= textDocument.EndPoint.Line)
                textDocument.Selection.MoveToLineAndOffset(originalLine, originalOffset, false);
            else
                textDocument.Selection.GotoLine(textDocument.EndPoint.Line);
        }
        /// <summary>
        /// Adds a style classification to the StyleSheet.
        /// </summary>
        /// <param name="target">The string to be styled.</param>
        /// <param name="color">The color to be applied to the target.</param>
        /// <param name="matchHandler">A delegate instance which describes a transformation that
        /// can be applied to the target.</param>
        public void AddStyle(string target, Color color, Styler.MatchFound matchHandler)
        {
            Styler styler = new Styler(target, color, matchHandler);

            Styles.Add(styler);
        }