Beispiel #1
0
 public StandardGuitar() : base()
 {
     String1.SetTuneNote("E", 4);
     String2.SetTuneNote("B", 3);
     String3.SetTuneNote("G", 3);
     String4.SetTuneNote("D", 3);
     _guitarStrings.Add(new GuitarString("A", 2));
     _guitarStrings.Add(new GuitarString("E", 2));
 }
Beispiel #2
0
 public StandardGuitar() : base()
 {
     String1.SetTuneNote("E", 4);
     String2.SetTuneNote("B", 3);
     String3.SetTuneNote("G", 3);
     String4.SetTuneNote("D", 3);
     s5 = new GuitarString("A", 2);
     s6 = new GuitarString("E", 2);
 }
Beispiel #3
0
        private void butvalidate3_Click(object sender, EventArgs e)
        {
            string b = String3.Text;

            if (b.StartsWith(" ") || b.StartsWith("$") || b.StartsWith("@") || b.StartsWith("%") || b.StartsWith("#"))
            {
                MessageBox.Show("The string3 can't start with a space or $ or @ or % or #");
                String3.Clear();
                String3.Focus();
            }
        }
Beispiel #4
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = String0.GetHashCode();
         hashCode = (hashCode * 397) ^ String1.GetHashCode();
         hashCode = (hashCode * 397) ^ String2.GetHashCode();
         hashCode = (hashCode * 397) ^ String3.GetHashCode();
         hashCode = (hashCode * 397) ^ String4.GetHashCode();
         hashCode = (hashCode * 397) ^ String5.GetHashCode();
         return(hashCode);
     }
 }
Beispiel #5
0
        public void TestCamelCaseSplit()
        {
            const string String1   = "ThisIsOneTestString";
            const string String2   = "ThisOneABCContainsAbreviation";
            const string String3   = "ThisOneContainsASingleCharacterWord";
            const string String4   = "ThisOneEndsWithAbbreviationABC";
            const string String5   = "ThisOneEndsWithASingleCharacterWordZ";
            var          expected1 = new[] { "This", "Is", "One", "Test", "String" };
            var          expected2 = new[] { "This", "One", "ABC", "Contains", "Abreviation" };
            var          expected3 = new[] { "This", "One", "Contains", "A", "Single", "Character", "Word" };
            var          expected4 = new[] { "This", "One", "Ends", "With", "Abbreviation", "ABC" };
            var          expected5 = new[] { "This", "One", "Ends", "With", "A", "Single", "Character", "Word", "Z" };

            var split1 = String1.CamelCaseSplit();

            Assert.AreEqual(expected1.Length, split1.Count);
            for (int i = 0; i < expected1.Length; ++i)
            {
                Assert.AreEqual(expected1[i], split1[i]);
            }
            var split2 = String2.CamelCaseSplit();

            Assert.AreEqual(expected2.Length, split2.Count);
            for (int i = 0; i < expected2.Length; ++i)
            {
                Assert.AreEqual(expected2[i], split2[i]);
            }
            var split3 = String3.CamelCaseSplit();

            Assert.AreEqual(expected3.Length, split3.Count);
            for (int i = 0; i < expected3.Length; ++i)
            {
                Assert.AreEqual(expected3[i], split3[i]);
            }
            var split4 = String4.CamelCaseSplit();

            Assert.AreEqual(expected4.Length, split4.Count);
            for (int i = 0; i < expected4.Length; ++i)
            {
                Assert.AreEqual(expected4[i], split4[i]);
            }
            var split5 = String5.CamelCaseSplit();

            Assert.AreEqual(expected5.Length, split5.Count);
            for (int i = 0; i < expected5.Length; ++i)
            {
                Assert.AreEqual(expected5[i], split5[i]);
            }
        }
Beispiel #6
0
        private void butValidateall_Click(object sender, EventArgs e)
        {
            string a = string1.Text;

            for (int i = 0; i <= a.Length; i++)
            {
                a = a.Replace("$", "");
                a = a.Replace("@", "");
                a = a.Replace("#", "");
                a = a.Replace("%", "");
                a = a.Replace("&", "");
                a = a.Replace("^", "");
                a = a.Replace("*", "");
            }
            outptstring1.Text = a;
            string b = String3.Text;

            if (b.StartsWith(" ") || b.StartsWith("$") || b.StartsWith("@") || b.StartsWith("%") || b.StartsWith("#"))
            {
                MessageBox.Show("The string3 can't start with a space or $ or @ or % or #");
                String3.Clear();
                String3.Focus();
            }
            string c = string2.Text;

            if (c.EndsWith(" ") || c.EndsWith("$") || c.EndsWith("@") || c.EndsWith("%") || c.EndsWith("#"))
            {
                MessageBox.Show("The string2 can't End with a space or $ or @ or % or #");
                string2.Clear();
                string2.Focus();
            }

            try
            {
                int x = int.Parse(String4.Text, System.Globalization.NumberStyles.None);
                String4.Text = x.ToString();
            }

            catch (Exception)
            {
                MessageBox.Show("Enter only numbers");
                String4.Clear();
            }
        }
Beispiel #7
0
 /// <summary> Get cfg file value by section and key </summary>
 /// <param name="sectionName">Section title</param>
 /// <param name="keyName">Key title</param>
 /// <returns>String value</returns>
 public string this[string sectionName, string keyName]
 {
     get
     {
         return(this[sectionName, keyName, null]);
     }
     set
     {
         for (var i = 0; i < data.Count; i++)
         {
             if (data[i].s1.Equals(sectionName, StringComparison.CurrentCultureIgnoreCase) &&
                 data[i].s2.Equals(keyName, StringComparison.CurrentCultureIgnoreCase))
             {
                 data[i] = new String3(sectionName, keyName, value);
                 SaveToFile();
                 return;
             }
         }
         Add(sectionName, keyName, value);
     }
 }
Beispiel #8
0
 /// <summary> Get cfg file value by section and key </summary>
 /// <param name="sectionName">Section title</param>
 /// <param name="keyName">Key title</param>
 /// <returns>String value</returns>
 public string this[string sectionName, string keyName]
 {
     get
     {
         return this[sectionName, keyName, null];
     }
     set
     {
         for (var i = 0; i < data.Count; i++)
         {
             if (data[i].s1.Equals(sectionName, StringComparison.CurrentCultureIgnoreCase) &&
                 data[i].s2.Equals(keyName, StringComparison.CurrentCultureIgnoreCase))
             {
                 data[i] = new String3(sectionName, keyName, value);
                 SaveToFile();
                 return;
             }
         }
         Add(sectionName, keyName, value);
     }
 }
Beispiel #9
0
        public static void ToLowerTrimmed_StringNotLowercaseOrStringIsNotTrimmedOrBoth_ReturnsLowercaseTrimmedString()
        {
            // Arrange
            const string String1   = "This Is Not%(#*&! lower CASE";
            const string Expected1 = "this is not%(#*&! lower case";

            const string String2   = "  this needs a trim ";
            const string Expected2 = "this needs a trim";

            const string String3   = " LoWer Trimmed   ";
            const string Expected3 = "lower trimmed";

            // Act
            string actual1 = String1.ToLowerTrimmed();
            string actual2 = String2.ToLowerTrimmed();
            string actual3 = String3.ToLowerTrimmed();

            // Assert
            Assert.Equal(Expected1, actual1);
            Assert.Equal(Expected2, actual2);
            Assert.Equal(Expected3, actual3);
        }
Beispiel #10
0
    public override int GetHashCode()
    {
        int hash = 1;

        if (String1.Length != 0)
        {
            hash ^= String1.GetHashCode();
        }
        if (String2.Length != 0)
        {
            hash ^= String2.GetHashCode();
        }
        if (String3.Length != 0)
        {
            hash ^= String3.GetHashCode();
        }
        if (String4.Length != 0)
        {
            hash ^= String4.GetHashCode();
        }
        return(hash);
    }
        protected override DataTemplate SelectTemplateCore(object item, DependencyObject container)
        {
            //validate
            if (item == null)
            {
                return(DefaultTemplate);
            }

            //get string
            var str = item as string;

            if (item.GetType().IsPrimitive || item.GetType().IsEnum)
            {
                str = item.ToString();
            }

            //select template
            if (str == null)
            {
                return(DefaultTemplate);
            }
            if (String1 != null && String1.Split(',').Contains(str))
            {
                return(Template1);
            }
            if (String2 != null && String2.Split(',').Contains(str))
            {
                return(Template2);
            }
            if (String3 != null && String3.Split(',').Contains(str))
            {
                return(Template3);
            }
            if (String4 != null && String4.Split(',').Contains(str))
            {
                return(Template4);
            }
            if (String5 != null && String5.Split(',').Contains(str))
            {
                return(Template5);
            }
            if (String6 != null && String6.Split(',').Contains(str))
            {
                return(Template6);
            }
            if (String7 != null && String7.Split(',').Contains(str))
            {
                return(Template7);
            }
            if (String8 != null && String8.Split(',').Contains(str))
            {
                return(Template8);
            }
            if (String9 != null && String9.Split(',').Contains(str))
            {
                return(Template9);
            }
            if (String10 != null && String10.Split(',').Contains(str))
            {
                return(Template10);
            }
            return(DefaultTemplate);
        }