RankSystem.RankConfigFile.Read C# (CSharp) Method

Read() public static method

public static Read ( string path ) : RankConfigFile
path string
return RankConfigFile
        public static RankConfigFile Read(string path)
        {
            if (!File.Exists(path))
                return new RankConfigFile();
            using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                return Read(fs);
            }
        }

Same methods

RankConfigFile::Read ( Stream stream ) : RankConfigFile

Usage Example

 private static void SetupConfig()
 {
     try
     {
         if (File.Exists(RankConfigPath))
         {
             RankConfig = RankConfigFile.Read(RankConfigPath);
             // Add all the missing config properties in the json file
         }
         RankConfig.Write(RankConfigPath);
     }
     catch (Exception ex)
     {
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine("Error in config file");
         Console.ForegroundColor = ConsoleColor.Gray;
         Log.Error("Config Exception");
         Log.Error(ex.ToString());
     }
 }
RankConfigFile