public string SaveAndReturnString() { switch (UpdaterDataType) { case UpdaterDataTypeFormat.XDocument: logger.Info("Saving XML: " + FileName); string xml = ""; try { xml = UpdaterXDocument.Save(this).ToString(); logger.Info("Successfully saved xml file."); return(xml); } catch (Exception ex) { logger.Error(ex, Strings.exceptionThrown + " while saving xml file." + Environment.NewLine); return(xml); } case UpdaterDataTypeFormat.JavaScriptObjectNotation: logger.Info("Saving JSON: " + FileName); string json = ""; try { json = UpdaterJson.SaveAndReturnString(this); logger.Info("Successfully saved json file."); return(json); } catch (Exception ex) { logger.Error(ex, Strings.exceptionThrown + " while saving json file." + Environment.NewLine); return(json); } default: return("Error"); } }
public bool Save() { switch (UpdaterDataType) { case UpdaterDataTypeFormat.XDocument: logger.Info("Saving XML: " + FileName); try { UpdaterXDocument.Save(this); logger.Info("Successfully saved xml file."); return(true); } catch (Exception ex) { logger.Error(ex, Strings.exceptionThrown + " while saving xml file." + Environment.NewLine); return(false); } case UpdaterDataTypeFormat.JavaScriptObjectNotation: logger.Info("Saving JSON: " + FileName); try { UpdaterJson.Save(this); logger.Info("Successfully saved json file."); return(true); } catch (Exception ex) { logger.Error(ex, Strings.exceptionThrown + " while saving json file." + Environment.NewLine); return(false); } default: return(false); } }