Esempio n. 1
0
        public static void Main(string[] args)
        {
            try {
                DatabaseExample example = new DatabaseExample();
                example.SetPath();
                example.ParseArgs(args);
                example.SetupDirs();
                example.myDbs = new MyDbs(example.myDbsPath);

                DatabaseLoader loader = new DatabaseLoader(example.myDbs);
                DatabaseReader reader = new DatabaseReader(example.myDbs);

                if (example.databaseLoad)
                {
                    /* Load the inventory database. */
                    Console.WriteLine("loading inventory db ...");
                    Console.WriteLine();
                    loader.LoadInventoryDB(example.dataDir);

                    /* Load the vendor database. */
                    Console.WriteLine("loading vendor db ...");
                    Console.WriteLine();
                    loader.LoadVendorDB(example.dataDir);
                }

                if (example.databaseRead)
                {
                    if (example.locateItem != null)
                    {
                        /* Show an item. */
                        reader.showItem(example.locateItem);
                    }
                    else
                    {
                        /* Show the full inventory. */
                        reader.showAllInventory();
                    }
                }
            }
            catch (Exception e) {
                Console.WriteLine("Test Error.");
                Console.WriteLine(e.Message);
                throw e;
            }
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            try {
                DatabaseExample example = new DatabaseExample();
                example.SetPath();
                example.ParseArgs(args);
                example.SetupDirs();
                example.myDbs = new MyDbs(example.myDbsPath);

                DatabaseLoader loader = new DatabaseLoader(example.myDbs);
                DatabaseReader reader = new DatabaseReader(example.myDbs);

                if (example.databaseLoad) {
                    /* Load the inventory database. */
                    Console.WriteLine("loading inventory db ...");
                    Console.WriteLine();
                    loader.LoadInventoryDB(example.dataDir);

                    /* Load the vendor database. */
                    Console.WriteLine("loading vendor db ...");
                    Console.WriteLine();
                    loader.LoadVendorDB(example.dataDir);
                }

                if (example.databaseRead) {
                    if (example.locateItem != null)
                        /* Show an item. */
                        reader.showItem(example.locateItem);
                    else
                        /* Show the full inventory. */
                        reader.showAllInventory();
                }
            }
            catch (Exception e) {
                Console.WriteLine("Test Error.");
                Console.WriteLine(e.Message);
                throw e;
            }
        }