Ejemplo n.º 1
0
        private BasicTeraData(string resourceDirectory)
        {
            ResourceDirectory = resourceDirectory;
            Directory.CreateDirectory(Path.Combine(resourceDirectory, "config")); //ensure config dir is created
            var repo = LogManager.GetRepository(Assembly.GetEntryAssembly());

            XmlConfigurator.Configure(repo, 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
            ;
        }
Ejemplo n.º 2
0
        private void LoadServers()
        {
            Servers = new ServerDatabase(ResourceDirectory);

            //handle overrides
            var serversOverridePath = Path.Combine(_overridesDirectory, "server-overrides.txt");

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

            Servers.AddOverrides(overriddenServers);
        }
Ejemplo n.º 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/"));
        }
Ejemplo n.º 4
0
        private void LoadServers()
        {
            Servers = new ServerDatabase(ResourceDirectory);

            //handle overrides
            var serversOverridePath = Path.Combine(_overridesDirectory, "server-overrides.txt");
            if (!File.Exists(serversOverridePath))//create the default file if it doesn't exist
                File.WriteAllText(serversOverridePath, Properties.Resources.server_overrides);
            var overriddenServers = GetServers(serversOverridePath).ToList();
            Servers.AddOverrides(overriddenServers);
        }