Example #1
0
        static void Main(string[] args)
        {
            try
            {
                Console.Title = "WineExcel";
            #if DEBUG
                Console.ForegroundColor = ConsoleColor.DarkMagenta;
            #endif
                RawReader.ReadProducts("productMapping.txt");
                RawReader.ReadFile("data.dat");
                _storeProducts = RawReader.GetStoreProductEntries();
                _products = RawReader.GetProducts();
                RawReader.ResetStoreProductPairs();

                using (_eIo = new ExcelIO()) {
                    _eIo.OpenProducers();
                    _producers = _eIo.ReadProducers();
                }
                using (_eIo = new ExcelIO()) {
                    _eIo.OpenTemplate();
                    _eIo.SetupDocument(_products);
                    _eIo.WriteProductDataToStores(_storeProducts,_products, _producers);
                    _eIo.CleanupAndSaveCopy();
                }

            }
            catch (Exception e) {
                Console.WriteLine("An error occurred somewhere, a log will be written to 'ERROR" + DateTime.UtcNow.ToFileTimeUtc() + ".txt'. Please infom the developer");
                try {
                    File.WriteAllText("ERROR-" + DateTime.UtcNow.ToFileTimeUtc() + ".txt", e.Message+"\n" + e.StackTrace);
                }
                catch (Exception e2) {
                    Console.WriteLine("Writing the error log failed: " + e2.Message + "\nOriginal: " + e.Message + "\n" + e.StackTrace);
            #if DEBUG
                    throw e2;
            #endif
                }
            #if DEBUG
                throw e;
            #endif
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            try
            {
                Console.Title = "WineExcel";
#if DEBUG
                Console.ForegroundColor = ConsoleColor.DarkMagenta;
#endif
                RawReader.ReadProducts("productMapping.txt");
                RawReader.ReadFile("data.dat");
                _storeProducts = RawReader.GetStoreProductEntries();
                _products      = RawReader.GetProducts();
                RawReader.ResetStoreProductPairs();

                using (_eIo = new ExcelIO()) {
                    _eIo.OpenProducers();
                    _producers = _eIo.ReadProducers();
                }
                using (_eIo = new ExcelIO()) {
                    _eIo.OpenTemplate();
                    _eIo.SetupDocument(_products);
                    _eIo.WriteProductDataToStores(_storeProducts, _products, _producers);
                    _eIo.CleanupAndSaveCopy();
                }
            }
            catch (Exception e) {
                Console.WriteLine("An error occurred somewhere, a log will be written to 'ERROR" + DateTime.UtcNow.ToFileTimeUtc() + ".txt'. Please inform the developer");
                try {
                    File.WriteAllText("ERROR-" + DateTime.UtcNow.ToFileTimeUtc() + ".txt", e.Message + "\n" + e.StackTrace);
                }
                catch (Exception e2) {
                    Console.WriteLine("Writing the error log failed: " + e2.Message + "\nOriginal: " + e.Message + "\n" + e.StackTrace);
#if DEBUG
                    throw e2;
#endif
                }
#if DEBUG
                throw e;
#endif
            }
        }