public static void SaveToFile(string fileName, Model model, ModelExchangeFormat format = ModelExchangeFormat.Xmi) { using (StreamWriter writer = new StreamWriter(fileName)) { writer.WriteLine(ModelExchange.SaveToString(model, format)); } }
public static Model LoadFromFile(string fileName, ModelExchangeFormat format = ModelExchangeFormat.Xmi) { using (StreamReader reader = new StreamReader(fileName)) { string text = reader.ReadToEnd(); return ModelExchange.LoadFromString(text, format); } }
public static Model LoadFromString(string text, ModelExchangeFormat format = ModelExchangeFormat.Xmi) { switch (format) { case ModelExchangeFormat.Xmi: return ModelExchange.FromXmi(text); case ModelExchangeFormat.Json: return ModelExchange.FromJson(text); default: return null; } }
public static string SaveToString(Model model, ModelExchangeFormat format = ModelExchangeFormat.Xmi) { switch (format) { case ModelExchangeFormat.Xmi: return ModelExchange.ToXmi(model); case ModelExchangeFormat.Json: return ModelExchange.ToJson(model); default: return string.Empty; } }