public static void SaveUser(UserInfo user_info) { string path = PathTool.GeUserSavePath(user_info.UserId); FileStream file = File.Create(path); user_info.WriteTo(file); file.Close(); Log.Debug("Save To:" + path); }
public static UserInfo LoadUser(int user_id) { string path = PathTool.GeUserSavePath(user_id); if (PathTool.IsExistFile(path)) { FileStream file = File.Open(path, FileMode.Open); UserInfo user_info = UserInfo.Parser.ParseFrom(file); file.Close(); Log.Debug("Load From:" + path); return(user_info); } else { return(null); } }