Esempio n. 1
0
    protected bool ReloadData()
    {
        ResetDisplay();

        m_mapFilePath      = Utils.AppConfig.db_path + MAP_FILE;
        m_cookwareFilePath = Utils.AppConfig.db_path + COOKWARE_FILE;
        m_ingFilePath      = Utils.AppConfig.db_path + INGREDIENT_FILE;
        m_foodFilePath     = Utils.AppConfig.db_path + FOOD_FILE;
        m_custFilePath     = Utils.AppConfig.db_path + CUSTOMER_FILE;
        m_orderFilePath    = m_custFilePath;
        m_levelFilePath    = Utils.AppConfig.db_path + LEVEL_FILE;

        try
        {
            if (File.Exists(m_levelFilePath))
            {
                if (!_lvlMgr.initWithDBFile(m_levelFilePath))
                {
                    return(false);
                }
            }



            if (File.Exists(m_cookwareFilePath))
            {
                if (!_cwMgr.LoadFromDBFile(m_cookwareFilePath))
                {
                    return(false);
                }
            }

            if (File.Exists(m_ingFilePath))
            {
                if (!_ingMgr.LoadFromDBFile(m_ingFilePath))
                {
                    return(false);
                }
            }

            if (File.Exists(m_foodFilePath))
            {
                if (!_foodMgr.LoadFromDBFile(m_foodFilePath))
                {
                    return(false);
                }
            }

            if (File.Exists(m_custFilePath))
            {
                if (!_custMgr.LoadFromDBFile(m_custFilePath))
                {
                    return(false);
                }
            }

            if (File.Exists(m_orderFilePath))
            {
                if (!_ordMgr.LoadFromDBFile(m_orderFilePath))
                {
                    return(false);
                }
            }

            if (File.Exists(m_mapFilePath))
            {
                if (_restMgr.LoadFromDBFile(m_mapFilePath))
                {
                    ReloadLevelData();
                }
                else
                {
                    return(false);
                }
            }
        }
        catch (Exception e)
        {
            Console.WriteLine(e);
            return(false);
        }

        ReloadMapData();

        return(true);
    }