コード例 #1
0
        public override void LoadContent()
        {
            World = new World(new Vector2(0, -20));
            base.LoadContent();

            DebugMaterial material = new DebugMaterial(MaterialType.Waves)
                                         {
                                             Color = Color.OliveDrab,
                                             Scale = 4f
                                         };

            Fixture _temp;
            _temp = FixtureFactory.CreateEdge(World, new Vector2(-20f, 17f), new Vector2(10f, 8f));
            _temp = FixtureFactory.CreateEdge(World, new Vector2(13.5f, 11f), new Vector2(13.5f, 7f));

            _temp = FixtureFactory.CreateEdge(World, new Vector2(-10f, -4f), new Vector2(20f, 4f));
            _temp = FixtureFactory.CreateEdge(World, new Vector2(-13.5f, -1f), new Vector2(-13.5f, -5f));

            _temp = FixtureFactory.CreateEdge(World, new Vector2(-20f, -8f), new Vector2(10f, -17f));

            float[] friction = new[] {0.75f, 0.5f, 0.35f, 0.1f, 0.0f};
            for (int i = 0; i < 5; ++i)
            {
                _temp = FixtureFactory.CreateRectangle(World, 2.5f, 2.5f, 1f, material);
                _temp.Body.BodyType = BodyType.Dynamic;
                _temp.Body.Position = new Vector2(-18f + 5.2f*i, 20.0f);
                _temp.Friction = friction[i];
            }
        }
コード例 #2
0
        public static IHtmlString RenderApplicationUrls(this HtmlHelper helper)
        {
            var url = new UrlHelper(helper.ViewContext.RequestContext);

            var applicationUrls = new
            {
                LoginUrl = url.Action(MVC.Authentication.Login()),
                LogoutUrl = url.Action(MVC.Authentication.Logout()),
                LoginCheckUrl = url.Action(MVC.Authentication.LoginCheck()),
                ListUsersUrl = url.Action("Index", "Api/Users"),
                CreateUserUrl = url.Action("Create", "Api/Users"),
                UpdateUserUrl = url.Action("Update", "Api/Users"),
                DeleteUsersUrl = url.Action("Delete", "Api/Users"),
                ListDashboardPermissionsUrl = url.Action("Index", "Api/DashboardPermissions"),
                ListMessagesUrl = url.Action("Index", "Api/Messages"),
                CreateMessageUrl = url.Action("Create", "Api/Messages"),
                DeleteMessagesUrl = url.Action("Delete", "Api/Messages"),
                ListOrganizationsUrl = url.Action("Index", "Api/Organizations"),
                CreateOrganizationUrl = url.Action("Create", "Api/Organizations"),
                UpdateOrganizationUrl = url.Action("Update", "Api/Organizations"),
                DeleteOrganizationsUrl = url.Action("Delete", "Api/Organizations"),
                ListRolesUrl = url.Action("Index", "Api/Roles")
            };

            var script = @"<script type='text/javascript'>
                        angular.module('colorSoft').constant('ApplicationUrls', <INSERT_URLS>);
                    </script>".Replace("<INSERT_URLS>", CreateJavascriptHash(applicationUrls));

            return MvcHtmlString.Create(script);
        }
コード例 #3
0
        protected override object GenerateCore(Project project, Column column)
        {
            var words = new[] { "lorem", "ipsum", "dolor", "sit", "amet", "consectetuer", "adipiscing", "elit", "sed", "diam", "nonummy", "nibh", "euismod", "tincidunt", "ut", "laoreet", "dolore", "magna", "aliquam", "erat" };
            var ponctuation = new[] { ". ", "! ", "? " };
            StringBuilder sb = new StringBuilder();

            int numParagraphs = Random.NextInt32(MinimumParagraphs, MaximumParagraphs);
            for (int p = 0; p < numParagraphs; p++)
            {
                int numSentences = Random.NextInt32(MinimumSentences, MaximumSentences) + 1;
                for (int s = 0; s < numSentences; s++)
                {
                    int numWords = Random.NextInt32(MinimumWords, MaximumWords);
                    for (int w = 0; w < numWords; w++)
                    {
                        if (w > 0)
                        {
                            sb.Append(" ");
                        }

                        sb.Append(Random.NextFromArray(words));
                    }

                    sb.Append(Random.NextFromArray(ponctuation));
                }

                sb.AppendLine();
            }

            return StringGenerator.CoerceValue(sb.ToString(), column);
        }
コード例 #4
0
      public void test_issue_599()
      {
         var codewords = new[]
                            {
                               48, 901, 56, 141, 627, 856, 330, 69, 244, 900, 852, 169, 843, 895, 852, 895, 913, 154, 845,
                               778, 387, 89, 869, 901, 219, 474, 543, 650, 169, 201, 9, 160, 35, 70, 900, 900, 900, 900,
                               900, 900, 900, 900, 900, 900, 900, 900, 900, 900, 769, 843, 591, 910, 605, 206, 706, 917,
                               371, 469, 79, 718, 47, 777, 249, 262, 193, 620, 597, 477, 450, 806, 908, 309, 153, 871, 686
                               , 838, 185, 674, 68, 679, 691, 794, 497, 479, 234, 250, 496, 43, 347, 582, 882, 536, 322,
                               317, 273, 194, 917, 237, 420, 859, 340, 115, 222, 808, 866, 836, 417, 121, 833, 459, 64,
                               159
                            };
         var expectedResultBytes = new byte[]
                                 {
                                    0x21, 0x82, 0x9f, 0x09, 0x21, 0x1a, 0x45, 0xf4, 0x09, 0x35, 0x2f, 0x44, 0x3f, 0x09, 0x3f, 0x9a,
                                    0x46, 0x5a, 0x09, 0x63, 0x27, 0x82, 0xff, 0x09, 0x6d, 0x15, 0x41, 0xc9, 0x09, 0xa0, 0x23, 0x46
                                 };
#if !SILVERLIGHT
         var expectedResult = Encoding.UTF7.GetString(expectedResultBytes);
#else
         var expectedResult = Encoding.GetEncoding("UTF-7").GetString(expectedResultBytes, 0, expectedResultBytes.Length);
#endif
         var result = DecodedBitStreamParser.decode(codewords, "L");
         Assert.AreEqual(expectedResult, result.Text);
      }
コード例 #5
0
        private void ShowResults()
        {
            // This scenario illustrates time zone support in Windows.Globalization.Calendar class

            // Displayed time zones in addition to the local time zone.
            string[] timeZones = new[] { "UTC", "America/New_York", "Asia/Kolkata" };

            // Store results here.
            StringBuilder results = new StringBuilder();

            // Create default Calendar object
            Calendar calendar = new Calendar();
            string localTimeZone = calendar.GetTimeZone();

            // Show current time in local time zone
            results.AppendLine("Current date and time:");
            results.AppendLine(ReportCalendarData(calendar));

            // Show current time in additional time zones
            foreach (string timeZone in timeZones)
            {
                calendar.ChangeTimeZone(timeZone);
                results.AppendLine(ReportCalendarData(calendar));
            }
            results.AppendLine();

            // Change back to local time zone
            calendar.ChangeTimeZone(localTimeZone);

            // Show a time on 14th day of second month of next year.
            // Note the effect of daylight saving time on the results.
            results.AppendLine("Same time on 14th day of second month of next year:");
            calendar.AddYears(1); calendar.Month = 2; calendar.Day = 14;
            results.AppendLine(ReportCalendarData(calendar));
            foreach (string timeZone in timeZones)
            {
                calendar.ChangeTimeZone(timeZone);
                results.AppendLine(ReportCalendarData(calendar));
            }
            results.AppendLine();

            // Change back to local time zone
            calendar.ChangeTimeZone(localTimeZone);

            // Show a time on 14th day of tenth month of next year.
            // Note the effect of daylight saving time on the results.
            results.AppendLine("Same time on 14th day of tenth month of next year:");
            calendar.AddMonths(8);
            results.AppendLine(ReportCalendarData(calendar));
            foreach (string timeZone in timeZones)
            {
                calendar.ChangeTimeZone(timeZone);
                results.AppendLine(ReportCalendarData(calendar));
            }
            results.AppendLine();

            // Display the results
            OutputTextBlock.Text = results.ToString();
        }
コード例 #6
0
		public void Can_tokenize_quoted_strings()
		{
			var lexer = new LispLexer();
			var list = "(test \"neki string\" \"drugi string\")";
			var result = lexer.GetTokenList(list);
			var expected = new[] { "(", "test", "neki string", "drugi string", ")" };
			CollectionAssert.AreEqual(expected, result);
		}
コード例 #7
0
		public void Can_tokenize_integer()
		{
			var lexer = new LispLexer();
			var list = "(1 22 3456789 )";
			var result = lexer.GetTokenList(list);
			var expected = new[] { "(", "1", "22", "3456789", ")" };
			CollectionAssert.AreEqual(expected, result);
		}
コード例 #8
0
		public void Can_tokenize_multiple_brackets()
		{
			var lexer = new LispLexer();
			var list = "(() (()()()())";
			var result = lexer.GetTokenList(list);
			var expected = new[] { "(", "(", ")", "(", "(", ")", "(", ")", "(", ")", "(", ")", ")" };
			CollectionAssert.AreEqual(expected, result);
		}
コード例 #9
0
        private string FormatFullName()
        {
            //TODO:Format the name based on a preference; possibly something defined globally.
            var names = new[] { FirstName, MiddleName, LastName };
            var separator = " ";

            return StaffFullNameFormatter ( names, separator );
        }
コード例 #10
0
		public void Can_tokenize_empty_list()
		{
			var lexer = new LispLexer();
			var list = "()";
			var result = lexer.GetTokenList(list);
			var expected = new[] { "(", ")" };
			CollectionAssert.AreEqual(expected, result);
		}
コード例 #11
0
 public void ItCanGetAByteRange()
 {
     const string responseString = "Hello World";
     var responseBytes = Encoding.ASCII.GetBytes(responseString);
     var range = new [] {6, 5};
     var responseRange = ResponseUtils.GetByteRange(responseBytes, range);
     Encoding.ASCII.GetString(responseRange).ShouldEqual("World");
 }
コード例 #12
0
        public void ToPaginatedList()
        {
            var list = new[] {"one", "two", "three"}.ToPaginatedList(1, 3);

            Assert.IsTrue(list is PaginatedCollection<string>);
            Assert.AreEqual(3, list.Count);
            Assert.AreEqual(1, list.Page);
            Assert.AreEqual(1, list.PageCount);
        }
コード例 #13
0
        public void TestSpecialCharactersAreRemoved()
        {
            var chars = new[] { '[', ']', '*', '/', ':', '?', '\\' };

            foreach (var c in chars)
            {
                SheetNamer namer = new SheetNamer();
                Assert.AreEqual("a b", namer.GetSheetName("a" + c + "b"));
            }
        }
コード例 #14
0
 public void Trim()
 {
     var trimChars = new[] {' ', '\r', '\n', '\t'};
     Assert.AreEqual("test", new StringBuilder("test").Trim(trimChars).ToString());
     Assert.AreEqual("test", new StringBuilder("  test").Trim(trimChars).ToString());
     Assert.AreEqual("test", new StringBuilder("test  ").Trim(trimChars).ToString());
     Assert.AreEqual("test", new StringBuilder("  test  ").Trim(trimChars).ToString());
     Assert.AreEqual("test", new StringBuilder(" \r\ntest\r\n").Trim(trimChars).ToString());
     Assert.AreEqual("test", new StringBuilder("\ttest\t   ").Trim(trimChars).ToString());
 }
コード例 #15
0
        public void ForEach()
        {
            var list = new[] {"one", "two", "three"};

            var sb = new StringBuilder();

            list.ForEach(s => sb.Append(s));

            Assert.AreEqual("onetwothree", sb.ToString());
        }
コード例 #16
0
        public ActionResult Index()
        {
            var pizzas = new[]
                         {
                             new Pizza {Number = 1, Name = "Pizza 1", Price = "$10"},
                             new Pizza {Number = 2, Name = "Pizza 2", Price = "$13"},
                             new Pizza {Number = 3, Name = "Pizza 3", Price = "$20"}
                         };

            return View(pizzas);
        }
コード例 #17
0
		public async Task<object> Invoke(dynamic input)  
		{
			var s = new StringBuilder();
			s.Append(input.secondPart); //Note the casing of 'secondPart' here
			var resultText = ".NET welcomes " + input.firstPart.ToString() + ". " + s.ToString();
			var result = new {
				resultString = resultText,
				resultLength = new DoStuff().GetLength(resultText)
			};
			return result;
		}
コード例 #18
0
        /// <summary>
        /// Removes invalid characters from a tree View item
        /// </summary>
        /// <param name="originalText"></param>
        /// <returns>sanatized tree view text</returns>
        public static string ValidateStringForTreeViewItem(string originalText)
        {
            var invalidChars = new[] {"@", ",", "!", " "};

            var output = new StringBuilder(originalText);

            foreach (var r in invalidChars)
            {
                output.Replace(r, string.Empty);
            }

            return output.ToString();
        }
コード例 #19
0
ファイル: FruaSavedGame.cs プロジェクト: bsimser/goldbox
        public override string ToString()
        {
            var directions = new[]
                {
                    "North",
                    "Northeast",
                    "East",
                    "Southeast",
                    "South",
                    "Southwest",
                    "West",
                    "Northwest",
                };

            var sb = new StringBuilder();

            sb.AppendFormat("Rounds: {0}\r\n", Rounds);
            sb.AppendFormat("Turns: {0}\r\n", Turns);
            sb.AppendFormat("Hours: {0}\r\n", Hours);
            sb.AppendFormat("Days: {0}\r\n", Days);
            sb.AppendFormat("Months: {0}\r\n", Months);
            sb.AppendFormat("Years: {0}\r\n", Years);
            sb.AppendFormat("Facing Direction: {0}\r\n", directions[FacingDirection]);
            sb.AppendFormat("Game Speed: {0}\r\n", GameSpeed);
            sb.AppendFormat("Current Module: {0}\r\n", CurrentModule);
            sb.AppendFormat("Initiated Flag: {0}\r\n", InitiatedFlag);
            sb.AppendFormat("Previous Column: {0}\r\n", PreviousColumn);
            sb.AppendFormat("Previous Row: {0}\r\n", PreviousRow);
            sb.AppendFormat("Search Mode On?: {0}\r\n", SearchModeOn);
            sb.AppendFormat("Overland Flag: {0}\r\n", OverlandFlag);
            sb.AppendFormat("Party Never Dies Flag: {0}\r\n", PartyNeverDiesFlag);
            sb.AppendFormat("No Treasure Flag: {0}\r\n", NoTreasureFlag);
            sb.AppendFormat("No XP For Combat Flag: {0}\r\n", NoXpForCombatFlag);
            sb.AppendFormat("Party Size: {0}\r\n", PartySize);
            sb.AppendFormat("Dungeon Flag: {0}\r\n", DungeonFlag);
            sb.AppendFormat("Second Overland Flag: {0}\r\n", SecondOverlandFlag);
            sb.AppendFormat("Party Column (Overland): {0}\r\n", PartyColumnInOverland);
            sb.AppendFormat("Party Row (Overland): {0}\r\n", PartyRowInOverland);
            sb.AppendFormat("Combat Level: {0}\r\n", CombatLevel);
            sb.AppendFormat("No Rest Zone Flag: {0}\r\n", NoRestZoneFlag);
            sb.AppendFormat("Allowed Train Flag: {0}\r\n", AllowedTrainFlag);
            sb.AppendFormat("Opponents Distance at Start: {0}\r\n", OpponentsDistanceAtStart);
            sb.AppendFormat("Opponents Friendly?: {0}\r\n", FriendlyOpponents);
            sb.AppendFormat("Underwater Flag: {0}\r\n", UnderwaterFlag);
            sb.AppendFormat("Party Column (Dungeon): {0}\r\n", PartyColumnInDungeon);
            sb.AppendFormat("Party Row (Dungeon): {0}\r\n", PartyRowInDungeon);

            return sb.ToString();
        }
コード例 #20
0
        public void Foo()
        {
            var names = new[] { "john", "james", "robin" }; // and many, many more

            // This is how I was doing it by always default
            var sb = new StringBuilder();
            foreach (var name in names)
            {
                sb.Append(name);
            }

            var result = sb.ToString();

            // This is better cause of readability
            var result2 = string.Concat(names);
        }
コード例 #21
0
 /// <summary>
 /// Array initializer
 /// </summary>
 public void D()
 {
     var persons = new[]
                       {
                           new Person
                               {
                                   Age = 36,
                                   Name = "John Doe"
                               },
                           new Person
                               {
                                   Age = -3,
                                   Name = "Alien from Mars"
                               }
                       };
 }
コード例 #22
0
ファイル: LexerEncodingTests.cs プロジェクト: onirtuen/scopus
        public void UnicodeTest()
        {
            ITokenizer tokenizer = new RegExpTokenizer();
            tokenizer.SetTransitionFunction(new TableDrivenTransitionFunction());

            var hebrewWord = tokenizer.UseTerminal(RegExp.Literal("עברית", Encoding.Unicode)); // 1
            var russianWord = tokenizer.UseTerminal(RegExp.Literal("русский", Encoding.Unicode)); // 2
            var englishWord = tokenizer.UseTerminal(RegExp.Literal("english", Encoding.Unicode)); // 3

            var whitespace = tokenizer.UseTerminal(RegExp.AtLeastOneOf(RegExp.Choice(
                RegExp.Literal(' ', Encoding.Unicode),
                RegExp.Literal('\t', Encoding.Unicode),
                RegExp.Literal('\n', Encoding.Unicode))));

            tokenizer.BuildTransitions();

            const string tokens  = "1    23      45      67     89      01      23    ";
            const string indices = "01234567890123456789012345678901234567890123456789";
            const string input   = "עברית русский english עברית english русский עברית";
            int[] tokenClasses = new int[input.Length];
            int[] tokenIndices = new int[input.Length];
            int[] tokenLengths = new int[input.Length];

            int hebClass = hebrewWord.TokenClassID;
            int engClass = englishWord.TokenClassID;
            int rusClass = russianWord.TokenClassID;
            int wsClass = whitespace.TokenClassID;

            int[] expectedTokenClasses = new[] { hebClass, wsClass, rusClass, wsClass, engClass,
                wsClass, hebClass, wsClass, engClass, wsClass, rusClass, wsClass, hebClass};
            int[] expectedTokenIndices = new[] { 0, 5, 6, 13, 14, 21, 22, 27, 28, 35, 36, 43, 44 };

            var rawInput = Encoding.Unicode.GetBytes(input);

            tokenizer.TokensClasses = tokenClasses;
            tokenizer.TokensIndices = tokenIndices;
            tokenizer.TokensLengths = tokenLengths;
            int tokensNum = tokenizer.Tokenize(rawInput, 0, rawInput.Length) + 1;

            Assert.That(tokensNum, Is.EqualTo(expectedTokenClasses.Length));

            for (int i = 0; i < tokensNum; i++)
            {
                Assert.That(tokenClasses[i], Is.EqualTo(expectedTokenClasses[i]));
                Assert.That(tokenIndices[i], Is.EqualTo(expectedTokenIndices[i]*2)); // Each symbol takes 2 bytes
            }
        }
コード例 #23
0
        public void Tokenize_Line_Test()
        {
            var columns = new[] {
                new FixedLengthTokenizer.ColumnDefinition(0, 10),
                new FixedLengthTokenizer.ColumnDefinition(10, 20),
            };

            var tokenizer = new FixedLengthTokenizer(columns);

            var input = new StringBuilder()
                .AppendLine("Philipp   Wagner    ")
                .ToString();

            var result = tokenizer.Tokenize(input);

            Assert.AreEqual("Philipp   ", result[0]);
            Assert.AreEqual("Wagner    ", result[1]);
        }
コード例 #24
0
 public void TestBasics()
 {
     var trie = new ByteTrie<string>();
     var strings = new[] { "HELLO", "HELLO WORLD", "HERBERT" };
     foreach (var s in strings)
     {
         trie.AddPath(s, Encoding.UTF8.GetBytes(s));
     }
     foreach (var s1 in strings)
     {
         Assert.Same(s1, trie.Find(Encoding.UTF8.GetBytes(s1)));
     }
     Assert.Null(trie.Find(Encoding.UTF8.GetBytes("Not Included")));
     Assert.Null(trie.Find(Encoding.UTF8.GetBytes("HELL")));
     Assert.Equal("HELLO", trie.Find(Encoding.UTF8.GetBytes("HELLO MUM")));
     Assert.Equal("HELLO WORLD".Length, trie.MaxDepth);
     trie.SetDefaultValue("DEFAULT");
     Assert.Equal("DEFAULT", trie.Find(Encoding.UTF8.GetBytes("Also Not Included")));
 }
コード例 #25
0
        public static string JavascriptIncludes()
        {
            var scriptFiles = new[]
             {
                 "jquery-1.6.2.min.js",
                 "jquery-1.8.16.min.js",
                 "jquery-unobtrusive-ajax.min.js",
                 "jquery.validate.min.js",
                 "jquery.validate.unobtrusive.js",
                 "modernizr-2.0.6-development-only.js"
             };

             var sb = new StringBuilder();
             foreach(var script in scriptFiles)
             {
                 sb.AppendFormat("<script src=\"/scripts/{0}\" type=\"text/javascript\"></script>\n",script);
             }

             return sb.ToString();
        }
コード例 #26
0
        public static IHtmlString RenderTemplateUrls(this HtmlHelper helper)
        {
            var url = new UrlHelper(helper.ViewContext.RequestContext);

            var templateUrls = new
            {
                ContactUrl = url.Action(MVC.Templates.Contact()),
                AboutUrl = url.Action(MVC.Templates.About()),
                DashboardUrl = url.Action(MVC.Templates.Dashboard()),
                HomeUrl = url.Action(MVC.Templates.Home()),
                RegisterUrl = url.Action(MVC.Templates.Register()),
                ListUsersUrl = url.Action(MVC.Templates.UsersList()),
                ListMessagesUrl = url.Action(MVC.Templates.MessagesList())
            };

            var script = @"<script type='text/javascript'>
                        angular.module('colorSoft').constant('TemplateUrls', <INSERT_URLS>);
                    </script>".Replace("<INSERT_URLS>", CreateJavascriptHash(templateUrls));

            return MvcHtmlString.Create(script);
        }
コード例 #27
0
        public static void Main()
        {
            var lcdProvider = new GpioLcdTransferProvider(Stm32F4Discovery.Pins.PD1, Stm32F4Discovery.Pins.PD2,
                                                          Stm32F4Discovery.Pins.PD9, Stm32F4Discovery.Pins.PD11,
                                                          Stm32F4Discovery.Pins.PD10, Stm32F4Discovery.Pins.PD8);

            var lcd = new Lcd(lcdProvider);
            lcd.Begin(16, 2); //columns, rows

            //znaki specjalne
            //http://www.quinapalus.com/hd44780udg.html
            var customCharacters = new[]
                                       {
                                           new byte[] {0x00, 0x0a, 0x15, 0x11, 0x11, 0x0a, 0x04, 0x00}, //serce
                                           new byte[] {0x04, 0x02, 0x01, 0x1f, 0x01, 0x02, 0x04, 0x00} //strzalka
                                       };

            //ladowanie znakow specjalnych
            for (int i = 0; i < customCharacters.Length; i++)
                lcd.CreateChar(i, customCharacters[i]);

            lcd.Clear();
            lcd.Write("* Hello World! *");
            Thread.Sleep(3000);

            //            lcd.Clear();
            //            lcd.Encoding = Encoding.UTF8;
            //            lcd.Write("ĄąĆćĘꣳŃńÓ󌜯ż");
            //            Thread.Sleep(3000);

            lcd.Clear();
            lcd.WriteByte(0); //pierwszy znak specjalny
            Thread.Sleep(2000);
            lcd.WriteByte(1); //drugi znak specjalny
            Thread.Sleep(3000);

            //nastepna linia
            lcd.SetCursorPosition(0, 1);
            lcd.Write("#     Bye...   #");
        }
コード例 #28
0
    public static string ToUri(this string text)
    {
        byte[] b = Encoding.GetEncoding(1251).GetBytes(text); // 8 bit characters
        string slug = Encoding.ASCII.GetString(b);
        var whitespace = new Regex("\\s+", RegexOptions.IgnoreCase | RegexOptions.Compiled);
        slug = whitespace.Replace(slug, "-");

        var nonword = new Regex("[^a-zA-Z0-9_-]", RegexOptions.IgnoreCase | RegexOptions.Compiled);
        slug = nonword.Replace(slug, "");

        var underscore = new Regex("_+", RegexOptions.IgnoreCase | RegexOptions.Compiled);
        slug = underscore.Replace(slug, "-");
        slug = slug.ToLower();

        var dash = new Regex("-+", RegexOptions.IgnoreCase | RegexOptions.Compiled);
        slug = dash.Replace(slug, "-");

        var charsToTrim = new [] {'-'};
        slug = slug.TrimEnd(charsToTrim).TrimStart(charsToTrim);

        return slug;
    }
コード例 #29
0
ファイル: 02_Stylesheets.cs プロジェクト: chrisortman/CvDnug
        public static string StylesheetIncludes()
        {
            var cssFiles = new[]
             {
                 /*
                  * The order is on purpose here,
                  * jquery is first so that your own stylesheets can override it
                  * The webforms stylesheet comes last because that would be
                  * the existing stylesheet which i want to have precedence over
                  * anything declared in boiler plate mvc project
                  */
                "/content/themes/base/jquery.ui.all.css",
                "/content/site.css",
                "/Styles/Site.css"
             };

             var sb = new StringBuilder();
             foreach(var stylesheet in cssFiles)
             {
                 sb.AppendFormat("<link href=\"{0}\" type=\"text/css\" rel=\"stylesheet\" />\n",stylesheet);
             }

             return sb.ToString();
        }
コード例 #30
0
ファイル: OfType.cs プロジェクト: mortezabarzkar/SharpNative
 public SomeClass()
 {
     var a = new[] { 1, 2, 3 };
     var b = a.OfType<StringBuilder>().ToList();
 }