protected override IEnumerable <TaskInfo> GetChildren()
            {
                yield return(TaskInfo.FromAction("loadGameClient", 1.0, progress =>
                {
                    progress.ReportStatusMessage(this.L("game_client_manager", "status_loading_game_client"));
                    _client = new LocalGameClient(_path, progress);
                }));

                yield return(TaskInfo.FromAction("loadGameClientConfiguration", 9.0, progress =>
                {
                    progress.ReportStatusMessage(this.L("game_client_manager", "status_loading_game_client_configuration"));

                    var repositoryConfigFile = ApplicationPath.GetRepositoryConfigFile(_client, RepositoryConfigFile);

                    RepositoryConfiguration config;
                    if (File.Exists(repositoryConfigFile))
                    {
                        config = RepositoryConfiguration.Load(repositoryConfigFile);
                        config.MarkerColor = _repositoryManager.MarkerManager.ApplyForColor(config.MarkerColor);
                    }
                    else
                    {
                        config = new RepositoryConfiguration(_client);
                        config.MarkerColor = _repositoryManager.MarkerManager.ApplyForColor();
                    }

                    _repositoryManager._repositoryConfigurations[_client] = config;

                    _repositoryManager._repositories.Add(_client);
                }));
            }
コード例 #2
0
        public LocalGameClientPath(LocalGameClient client)
        {
            this.Client   = client;
            this.RootPath = client.RootPath;
            this.ReadVersion();

            this.LoadClientPaths();

            _nationFolders = Directory.GetDirectories(this.VehiclesFolder).Where(LocalGameClientPath.IsNationFolder).ToArray();
            _nations       = _nationFolders.Select(Path.GetFileName).ToArray();
        }
コード例 #3
0
        public static void Save(LocalGameClient client, LocalGameClientConfiguration config)
        {
            var configFile = LocalGameClientConfiguration.GetConfigFile(client);

            try
            {
                using (var file = File.Create(configFile))
                {
                    Serializer.WriteObject(file, config);
                }
            }
            catch (Exception ex)
            {
                typeof(LocalGameClientConfiguration).LogError("failed to save local game client configuration file '{0}': {1}", configFile, ex.Message);
            }
        }
コード例 #4
0
        public static LocalGameClientConfiguration Load(LocalGameClient client)
        {
            var configFile = LocalGameClientConfiguration.GetConfigFile(client);

            if (File.Exists(configFile))
            {
                try
                {
                    using (var file = File.OpenRead(configFile))
                    {
                        var config = (LocalGameClientConfiguration)Serializer.ReadObject(file);
                        return(config);
                    }
                }
                catch (Exception ex)
                {
                    typeof(LocalGameClientConfiguration).LogError("failed to load local game client configuration file '{0}': {1}", configFile, ex.Message);
                }
            }

            return(new LocalGameClientConfiguration());
        }
コード例 #5
0
 internal LocalGameClientCacheManager(LocalGameClient client)
 {
     _client             = client;
     this.IsCacheExpired = this.GetIsCacheExpired();
 }
コード例 #6
0
 internal LocalGameClientPackageIndexer(LocalGameClient client)
 {
     _client = client;
     this.LoadPackageIndices();
 }
コード例 #7
0
 private static string GetConfigFile(LocalGameClient client)
 {
     return(ApplicationPath.GetRepositoryConfigFile(client, c_configFile));
 }
コード例 #8
0
 public LocalGameClientFileLocator(LocalGameClient client, FileSource source)
 {
     this.Client = client;
     this.Source = source;
 }