public static int saveBoxerConfig(BoxerConfig config, string dirPath, string fileName) { int result = 0; try { if (dirPath == null || dirPath.Length <= 0) { result = -1; return(result); } if (fileName == null || fileName.Length <= 0) { result = -1; return(result); } if (UtilityJson.saveToJson <BoxerConfig>(config, dirPath, fileName) != 0) { result = -1; return(result); } } catch (Exception ex) { Console.WriteLine("exception: {0}", ex.Message); result = -1; } finally { } return(result); }
public static BoxerConfig loadBoxerConfig(string filePath) { BoxerConfig result = null; try { if (filePath == null || filePath.Length <= 0) { result = null; return(result); } BoxerConfig config = null; if (UtilityJson.loadFromJson <BoxerConfig>(out config, filePath) != 0) { result = null; return(result); } result = config; } catch (Exception ex) { Console.WriteLine("exception: {0}", ex.Message); result = null; } finally { } return(result); }