Example #1
0
 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);
     }
 }
Example #3
0
 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);
     }
 }
Example #4
0
 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();
 }
Example #5
0
        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);
        }
Example #6
0
        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);
        }