/** * Save the current field file. * * @require fieldView.Field != null */ private void Save(string filename) { Field field; string extension, fn; fn = filename.ToLower(); extension = Path.GetExtension(fn); if ((extension == ".fld" && fieldView.Field is FldField) || (extension == ".gat" && fieldView.Field is GatField) || (fn.EndsWith(".fld.gz") && fieldView.Field is GZipFldField)) { field = fieldView.Field; } else if (fn.EndsWith(".fld")) { field = new FldField(fieldView.Field); } else { field = new GZipFldField(fieldView.Field); } try { field.Save(filename); fieldView.Field = field; this.filename = filename; Update(); } catch (IOException e) { ShowError("Cannot save file:\n" + e.Message); } catch (SaveNotSupportedException e) { ShowError(e.Message); } }