/// <summary>
        /// Gets name of tone and add it to Tones list at once.
        /// </summary>
        /// <param name="arrTone"></param>
        /// <param name="it"></param>
        /// <returns></returns>
        private string GetToneName(string arrTone, List <Tone2014> it)
        {
            string       ToneName = "";
            const string Default  = "Default";

            if (!String.IsNullOrEmpty(arrTone))
            {
                // recognize that ToneBase name alpha case mismatches do exist and process it
                // take the first if there are multiple matches so error is not thrown
                var matchedTone = it.FirstOrDefault(t => t.Name.ToLower() == arrTone.ToLower());
                if (ReferenceEquals(matchedTone, null))
                {
                    return(ToneName);
                }

                if (matchedTone.GearList.IsNull())
                {
                    ToneName = Default;
                }
                else
                {
                    if (!Tones.Contains(matchedTone))
                    {
                        Tones.Add(matchedTone);
                    }
                    ToneName = arrTone;
                }
            }
            return(ToneName);
        }
示例#2
0
        /// <summary>
        /// Gets name of tone and add it to Tones list at once.
        /// </summary>
        /// <param name="arrTone"></param>
        /// <param name="it"></param>
        /// <returns></returns>
        private string GetToneName(string arrTone, List <Tone2014> it)
        {
            string       ToneName = "";
            const string Default  = "Default";

            if (!String.IsNullOrEmpty(arrTone))
            {
                var matchedTone = it.SingleOrDefault(t => t.Name == arrTone);
                if (ReferenceEquals(matchedTone, null))
                {
                    return(ToneName);
                }

                if (matchedTone.GearList.IsNull())
                {
                    ToneName = Default;
                }
                else
                {
                    if (!Tones.Contains(matchedTone))
                    {
                        Tones.Add(matchedTone);
                    }
                    ToneName = arrTone;
                }
            }
            return(ToneName);
        }
示例#3
0
 public void setContent(string content)
 {
     Tones.Clear();
     string[] tones = content.Split('-');
     tones = tones.Take(tones.Count() - 1).ToArray();
     if (tones.Count() > 0)
     {
         Beat = tones[0];
         for (int i = 1; i <= tones.Count() - 2; i += 2)
         {
             Tone t = new Tone(tones[i], tones[i + 1]);
             Tones.Add(t);
         }
     }
 }