Example #1
0
        public static T LoadConfig <T>(ConfigDatabase cfgDB, IFileLoader fileLoader, int fileFormat, string filePath) where T : Configuration, new()
        {
            T local = default(T);

            switch (fileFormat)
            {
            case 1:
                local = Activator.CreateInstance <T>();
                local.LoadFromXml(fileLoader.LoadAsXML(filePath));
                break;

            case 2:
                local = (T)DataSerializer.Deserialize(fileLoader.LoadAsSteam(filePath), typeof(T));
                break;
            }
            if (local != null)
            {
                local.ConstructLogicData(cfgDB, fileFormat);
            }
            return(local);
        }