private string WriteIvyFile(string outputPath, string filename, bool savePath) { if (filename == null) { filename = "ivy.xml"; } if (!Directory.Exists(outputPath)) { Directory.CreateDirectory(outputPath); } string text = Path.Combine(outputPath, filename); if (!savePath) { this.BasePath = (this.IvyFile = null); } string value = IvyParser.Serialize(this); using (StreamWriter streamWriter = File.CreateText(text)) { streamWriter.Write(value); } this.BasePath = outputPath; this.IvyFile = filename; return(text); }
public static T Parse <T>(string xml) where T : class { object obj = IvyParser.Deserialize <T>(xml); if (obj != null && typeof(T) == typeof(IvyModule)) { ((IvyModule)obj).IvyFile = "ivy.xml"; } return(obj as T); }
public string WriteIvyFile(string outputPath, string filename) { if (filename == null) { filename = "ivy.xml"; } if (!Directory.Exists(outputPath)) { Directory.CreateDirectory(outputPath); } string path = Path.Combine(outputPath, filename); string str2 = IvyParser.Serialize(this); using (StreamWriter writer = File.CreateText(path)) { writer.Write(str2); } return(path); }
public static T ParseFile <T>(string path) where T : class { IvyParser.HasErrors = false; IvyParser.ErrorMessage = null; IvyParser.ErrorException = null; if (!File.Exists(path)) { IvyParser.HasErrors = true; IvyParser.ErrorMessage = string.Format("File does not exist: {0}", path); return((T)((object)null)); } object obj = IvyParser.Parse <T>(File.ReadAllText(path, Encoding.UTF8)); if (obj != null && typeof(T) == typeof(IvyModule)) { ((IvyModule)obj).BasePath = Path.GetDirectoryName(path); ((IvyModule)obj).IvyFile = Path.GetFileName(path); } return(obj as T); }
public static IvyModule FromIvyFile(string fullpath) { return(IvyParser.ParseFile <IvyModule>(fullpath)); }
public override string ToString() { return(IvyParser.Serialize(this)); }
public override string ToString() => IvyParser.Serialize(this);
public static ModuleRepository FromIvyFile(string fullpath) => IvyParser.ParseFile <ModuleRepository>(fullpath);
public static ModuleRepository FromIvyFile(string fullpath) { return(IvyParser.ParseFile <ModuleRepository>(fullpath)); }
public static IvyModule FromIvyFile(string fullpath) => IvyParser.ParseFile <IvyModule>(fullpath);