示例#1
0
        /// <summary>
        /// Initializes the static data of the program
        /// </summary>
        private static bool Initialize()
        {
            try {
                AssetInfo.GenerateAssetInfoList();
                IconData.itemIconDictionary = new Dictionary <string, byte[]>();
                IconData.uiIconDictionary   = new Dictionary <string, UIIconData>();
            }
            catch (Exception e) {
                ErrorHandler.HandleError("Error while processing icons. Failed to load asset files." + e.Message, e, true);
            }
            try {
                //This step normally fails. Lets suppressed the error message.
                //We get inventory icons
                IconData.PopulateIconDictionaries();
            }
            catch (Exception e) {
                ErrorHandler.HandleError("Error while processing icons. Failed to load asset files." + e.Message, e, false);
            }

            try {
                XmlData.GetBlocks();
                XmlData.GetItems();
                XmlData.ArrangeItemList();
                XmlData.GetSkills();
                AssetInfo.ClearAssetInfoList();
            }
            catch (Exception e) {
                ErrorHandler.HandleError(string.Format("Failed to load XML files!\n\n{0}\n\nProgram will now terminate!", e.Message), e, true);
                return(false);
            }

            return(true);
        }
示例#2
0
        /// <summary>
        /// Initializes the static data of the program
        /// </summary>
        private static bool Initialize()
        {
            try {
                AssetInfo.GenerateAssetInfoList();
                IconData.itemIconDictionary = new Dictionary <string, byte[]>();
                IconData.uiIconDictionary   = new Dictionary <string, UIIconData>();
                IconData.PopulateIconDictionaries();
            }
            catch (Exception e) {
                ErrorHandler.HandleError("No icons will be loaded. Failed to load asset files." + e.Message, e, true);
            }

            try {
                XmlData.GetBlocks();
                XmlData.GetItems();
                XmlData.ArrangeItemList();
                XmlData.GetSkills();
                AssetInfo.ClearAssetInfoList();
            }
            catch (Exception e) {
                ErrorHandler.HandleError(string.Format("Failed to load XML files!\n\n{0}\n\nProgram will now terminate!", e.Message), e, true);
                return(false);
            }

            return(true);
        }