Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Collections;
  7. using System.Threading.Tasks;
  8.  
  9.  
  10. namespace ConsoleApp1
  11. {
  12. class Program
  13. {
  14.  
  15. public static List<string> InputChord(string chord)
  16. {
  17. // define notes
  18. Dictionary<string, int> rootKey = new Dictionary<string, int>
  19. {
  20. {"A", 0},
  21. {"A#", 1},
  22. {"B", 2},
  23. {"C", 3},
  24. {"C#", 4},
  25. {"D", 5},
  26. {"D#", 6},
  27. {"E", 7},
  28. {"F", 8},
  29. {"F#", 9},
  30. {"G", 10},
  31. {"G#", 11}
  32. };
  33.  
  34. var rootKeyList = rootKey.Keys.ToList();
  35.  
  36. // input check
  37. Console.WriteLine("Please put the chord notes divided with '-' : ");
  38.  
  39. bool check = true;
  40. while (check)
  41. {
  42. var input = Console.ReadLine().ToUpper();
  43. var chordTones = input.Split('-').ToList();
  44. foreach (var note in chordTones)
  45. {
  46. if (String.IsNullOrWhiteSpace(input))
  47. {
  48. Console.WriteLine("Please provide chord tones (at least three notes): ");
  49. break;
  50.  
  51. }
  52. else if (input.Count() < 3)
  53. {
  54. Console.WriteLine("Please provide at least 3 notes: ");
  55. break;
  56. }
  57. else if (!rootKeyList.Contains(note))
  58. {
  59. Console.WriteLine("Incorrect {0} note, please correct: ", note);
  60. break;
  61. };
  62.  
  63. }
  64. return chordTones;
  65. }
  66.  
  67. }
  68.  
  69. static void Main(string[] args)
  70. {
  71.  
  72. }
  73.  
  74.  
  75.  
  76. }
  77.  
  78.  
  79.  
  80.  
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement