public IINIResult Load(byte[] iniData) { var result = new INIResult(iniData); result.SetSaveCallback((data) => { throw new CatLibException("not support save with Load(byte[]) loaded result"); }); return(result); }
/// <summary> /// 加载一个INI文件 /// </summary> /// <param name="file">文件</param> /// <returns></returns> public IINIResult Load(IFile file) { if (!file.Exists) { throw new IOException("file is not exists:" + file.FullName); } if (file.Extension != ".ini") { throw new ArgumentException("ini file path is invalid", "path"); } var result = new INIResult(file.Read()); result.SetSaveCallback((data) => { file.Delete(); file.Create(data.ToByte()); }); return(result); }