internal void Save() { try { using (WaitCursor wc = new WaitCursor(this, Locale.Get("_savingData") + "...")) { if (app.Connection == null) { string filePath = SaveAs(); if (filePath != null) { app.Lib.SetSaved(); string connName = Path.GetFileNameWithoutExtension(filePath); app.Connection = new ConnectionInfo(connName, "", "", "file=" + filePath); } } else { GLib lib = app.Lib; if (lib != null) { if (app.Connection.connectionString.Length > 0) { using (Context context = lib.GetContext()) { context.Filter = Filter.All; lib.Save(context); lib.SetSaved(); } } else if (app.Connection.FilePath.Length > 0) { string filePath = app.Connection.FilePath; using (FileStream fs = new FileStream(filePath, FileMode.OpenOrCreate)) { using (BinaryWriter bw = new BinaryWriter(fs)) { using (Context context = lib.GetContext()) { context.Filter = new Filter(BatchLevel.Object); lib.Write(context, bw); lib.SetSaved(); } } } } } } } } catch (Exception ex) { Log.Exception(ex); } finally { UpdateLibControls(); } }