Esempio n. 1
0
 public static void ReadFiles(string path)
 {
     if (File.Exists(@path + @"\Users.json"))
     {
         Users = new List <User>();
         string users = File.ReadAllText(@path + @"\Users.json");
         Users = JsonConvert.DeserializeObject <List <User> >(users);
     }
     else
     {
         Users = new List <User>();
     }
     if (File.Exists(@path + @"\Awards.json"))
     {
         Awards = new List <Award>();
         string awards = File.ReadAllText(@path + @"\Awards.json");
         Awards = JsonConvert.DeserializeObject <List <Award> >(awards);
     }
     else
     {
         Awards = new List <Award>();
     }
     if (File.Exists(@path + @"\Users.json") && File.Exists(@path + @"\Awards.json") && File.Exists(@path + @"\TableUserAward.txt"))
     {
         TableUserAward = new TableUserAward <Guid>();
         string [] alltable = File.ReadAllLines(@path + @"\TableUserAward.txt");
         foreach (string s in alltable)
         {
             string[] GuidTable = s.Split(';');
             TableUserAward.Add(Guid.Parse(GuidTable[0]), Guid.Parse(GuidTable[1]));
         }
     }
     else
     {
         TableUserAward = new TableUserAward <Guid>();
     }
 }
Esempio n. 2
0
 static MemoryStorage()
 {
     Users          = new List <User>();
     Awards         = new List <Award>();
     TableUserAward = new TableUserAward <Guid>();
 }