Exemple #1
0
        public string ReadJson(string path, ICrypt crypt = null, IRoles role = null)
        {
            if (System.IO.Path.GetExtension(path).ToLower() != ".json")
            {
                throw new Exception("Wrong file type.");
            }
            if (role != null)
            {
                role.check(path);
            }

            if (crypt == null)
            {
                return(System.IO.File.ReadAllText(path));
            }
            else
            {
                return(crypt.Decode(System.IO.File.ReadAllText(path)));
            }
        }