public TourneyOptions(TourneyConfig config)
        {
            Config = config;

            InitializeComponent();
            DG_RankValues.ItemsSource = RankValues;
        }
Esempio n. 2
0
        public static bool IsWorthMoreThan(string rank1, string rank2)
        {
            TourneyConfig config = TourneyConfig.ReadFromFile();

            try
            {
                RankValue firstOne  = config.RankValues.Find(rv => rv.Rank == rank1);
                RankValue secondOne = config.RankValues.Find(rv => rv.Rank == rank2);
                return(firstOne.Value > secondOne.Value);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Esempio n. 3
0
 public static TourneyConfig ReadFromFile()
 {
     try
     {
         XmlSerializer serializer = new XmlSerializer(typeof(TourneyConfig));
         if (!File.Exists(ConfigPath))
         {
             WriteBlankFile();
         }
         StreamReader  reader = new StreamReader(ConfigPath);
         TourneyConfig result = serializer.Deserialize(reader) as TourneyConfig;
         reader.Close();
         return(result);
     }
     catch (Exception)
     {
         return(null);
     }
 }
Esempio n. 4
0
 private static void WriteBlankFile()
 {
     TourneyConfig temp = new TourneyConfig(new List<RankValue>());
     temp.WriteToFile();
 }
Esempio n. 5
0
        private static void WriteBlankFile()
        {
            TourneyConfig temp = new TourneyConfig(new List <RankValue>());

            temp.WriteToFile();
        }