public bool Save(string path) { bool success = serializableObject.Save(path); if (success) { this.HasChanges = false; } return(success); }
void SaveObject(string table, string id, object obj, bool update) { byte[] data; string sql = ""; SqliteConnection conn = new SqliteConnection("URI=file:" + dbFile); conn.Open(); using (var cmd = conn.CreateCommand()) { using (MemoryStream stream = new MemoryStream()) { SerializableObject.Save(obj, stream); data = stream.ToArray(); } if (update) { sql = String.Format("UPDATE {0} SET Data=@data WHERE id='{1}'", table, id); } else { sql = String.Format("INSERT INTO {0} ([ID], [Data]) VALUES('{1}', @data)", table, id); } cmd.CommandText = sql; cmd.Parameters.Add("@data", DbType.Binary, data.Length).Value = data; cmd.ExecuteNonQuery(); } conn.Close(); }
public static void Save() { try { SerializableObject.Save(state, Config.ConfigFile, SerializableObject.SerializationType.Xml); } catch (Exception ex) { Log.Error("Errro saving config"); Log.Exception(ex); } }
public void AddProject(Project project) { string path = Path.Combine(project_path, project.UUID.ToString()); project.Description.LastModified = DateTime.Now; if (File.Exists(path)) { File.Delete(path); } SerializableObject.Save(project, path); SerializableObject.Save(project.Description, Path.Combine(desc_path, project.UUID.ToString())); }
public void TestCase() { var assembly = Assembly.GetExecutingAssembly(); var resourceName = "default.ltt"; using (Stream stream = assembly.GetManifestResourceStream(resourceName)) { TeamTemplate template = SerializableObject.Load <TeamTemplate> (stream, SerializationType.Binary); var cstream = new MemoryStream(); SerializableObject.Save(template, cstream, SerializationType.Json); cstream.Seek(0, SeekOrigin.Begin); var jsonString = new StreamReader(cstream).ReadToEnd(); Console.WriteLine(jsonString); } }
public static void Export(Project project, string file) { file = Path.ChangeExtension(file, Constants.PROJECT_EXT); SerializableObject.Save(project, file); }
public void Save(string filePath) { SerializableObject.Save(this, filePath); }
public static void Export(Project project, string file) { file = Path.ChangeExtension(file, "lpr"); SerializableObject.Save(project, file); }