Пример #1
0
        private BasicTeraData(string resourceDirectory)
        {
            ResourceDirectory = resourceDirectory;
            Directory.CreateDirectory(Path.Combine(resourceDirectory, "config")); //ensure config dir is created
            XmlConfigurator.Configure(new Uri(Path.Combine(ResourceDirectory, "log4net.xml")));
            HotkeysData = new HotkeysData(this);
            WindowData  = new WindowData(this);
            LP.Culture  = WindowData.UILanguage != "Auto" ? CultureInfo.GetCultureInfo(WindowData.UILanguage) : CultureInfo.CurrentUICulture;
            EventsData  = new EventsData(this);
            //_dataForRegion = Helpers.Memoize<string, TeraData>(region => new TeraData(region));
            Servers = new ServerDatabase(Path.Combine(ResourceDirectory, "data"));
            //handle overrides
            var serversOverridePath = Path.Combine(ResourceDirectory, "config/server-overrides.txt");

            if (!File.Exists(serversOverridePath)) //create the default file if it doesn't exist
            {
                File.WriteAllText(serversOverridePath, LP.ServerOverrides);
            }
            var overriddenServers = GetServers(serversOverridePath).ToList();

            Servers.AddOverrides(overriddenServers);


            ImageDatabase = new ImageDatabase(Path.Combine(ResourceDirectory, "img/"));
            Icons         = new IconsDatabase(Path.Combine(ResourceDirectory, "data/"));

            // change later
            ;
        }
Пример #2
0
 private BasicTeraData(string resourceDirectory)
 {
     ResourceDirectory = resourceDirectory;
     XmlConfigurator.Configure(new Uri(Path.Combine(ResourceDirectory, "log4net.xml")));
     HotkeysData    = new HotkeysData(this);
     WindowData     = new WindowData(this);
     _dataForRegion = Helpers.Memoize <string, TeraData>(region => new TeraData(region));
     Servers        = new ServerDatabase(Path.Combine(ResourceDirectory, "data"));
     ImageDatabase  = new ImageDatabase(Path.Combine(ResourceDirectory, "img/"));
 }
Пример #3
0
        private BasicTeraData(string resourceDirectory)
        {
            ResourceDirectory = resourceDirectory;
            Directory.CreateDirectory(Path.Combine(resourceDirectory, "config")); //ensure config dir is created
            XmlConfigurator.Configure(new Uri(Path.Combine(ResourceDirectory, "log4net.xml")));
            HotkeysData = new HotkeysData(this);
            WindowData = new WindowData(this);
            EventsData = new EventsData(this);
            _dataForRegion = Helpers.Memoize<string, TeraData>(region => new TeraData(region));
            Servers = new ServerDatabase(Path.Combine(ResourceDirectory, "data"));
            //handle overrides
            var serversOverridePath = Path.Combine(ResourceDirectory, "config/server-overrides.txt");
            if (!File.Exists(serversOverridePath))//create the default file if it doesn't exist
                File.WriteAllText(serversOverridePath, LP.ServerOverrides );
            var overriddenServers = GetServers(serversOverridePath).ToList();
            Servers.AddOverrides(overriddenServers);

            ImageDatabase = new ImageDatabase(Path.Combine(ResourceDirectory, "img/"));
            Icons = new IconsDatabase(Path.Combine(ResourceDirectory, "data/"));
        }