public ExcelApplication() { try { ExcelApp = new Excel.Application(); IsExcelOpened = true; LW.E("Excel Opened!"); } catch (Exception ex) { LW.E("Excel Opening Error: " + ex.Message); } }
public static bool ToParsedObject <T>(this string JSON, out T data) { try { data = JsonConvert.DeserializeObject <T>(JSON); return(data != null); } catch (Exception ex) { LW.E(ex); data = default(T); return(false); } }
public bool OpenExcelFile(string FilePath, bool ReadOnly, bool Editable) { try { xWorkbook = ExcelApp.Workbooks._Open(FilePath, ReadOnly: ReadOnly, Editable: Editable); LW.E($"Excel Open File Seccess: FilePath: {FilePath}, ReadOnly: {ReadOnly.ToString()}"); return(true); } catch (Exception ex) { LW.E("Excel Open File Error: " + ex.Message); return(false); } }
public bool QuitExcel() { try { ExcelApp.Quit(); IsExcelOpened = false; LW.E("Excel Quited!"); return(true); } catch (Exception ex) { LW.E("Excel Quiting Error: " + ex.Message); return(false); } GC.Collect(); GC.WaitForPendingFinalizers(); }
public static bool LoadConfig(string ConfigFile) { LW.D("Reading Config...."); if (!File.Exists(ConfigFile)) { return(false); } string ConfigString = File.ReadAllText(ConfigFile); var config = JsonConvert.DeserializeObject <ConfigCollection>(ConfigString); LW.D("Finished Reading Config...."); LW.D("Loading Config...."); if (config == null) { LW.E("Failed Load Config.... Exiting..."); return(false); } Current = config; LW.D("Finished Loading Config...."); return(true); }
public static bool LoadMessages(string MessageFile) { LW.D("Reading Messages...."); if (!File.Exists(MessageFile)) { return(false); } string ConfigString = File.ReadAllText(MessageFile); var msg = JsonConvert.DeserializeObject <LocalisedMessages>(ConfigString); LW.D("Finished Reading Messages...."); LW.D("Loading Messages...."); if (msg == null) { LW.E("Failed Load Messages.... Exiting..."); return(false); } Messages = msg; LW.D("Finished Loading Messages...."); return(true); }