Exemplo n.º 1
0
            protected override IEnumerable <TaskInfo> GetChildren()
            {
                yield return(TaskInfo.FromAction("beginLoadRepositories",
                                                 1.0,
                                                 p => p.ReportStatusMessage(this.L("game_client_manager", "status_loading_game_clients"))));

                if (!File.Exists(s_repositoriesConfigFile))
                {
                    yield break;
                }

                var paths = File.ReadAllLines(s_repositoriesConfigFile)
                            .Where(s => !string.IsNullOrWhiteSpace(s))
                            .ToArray();


                foreach (var path in paths)
                {
                    if (LocalGameClientPath.IsPathValid(path))
                    {
                        yield return(new TaskInfo(new AddRepositoryTask(_repositoryManager, path), 1.0));
                    }
                    else
                    {
                        this.LogError("invalid local game client path '{0}'", path);
                    }
                }
            }
Exemplo n.º 2
0
        internal LocalGameClient(string rootPath, IProgressScope progress)
        {
            this.RootPath    = rootPath;
            _paths           = new LocalGameClientPath(this);
            this.ClientPaths = _paths.ClientPaths;

            this.CacheManager = new LocalGameClientCacheManager(this);

            this.Localization = new LocalGameClientLocalization(_paths.TextSettingsFile, _paths.TextFolder);
            this.Language     = this.Localization.Language;

            this.PackageIndexer = new LocalGameClientPackageIndexer(this);
            this.PackageImages  = new LocalGameClientPackageImage(_paths);

            this.LoadConfig();
            this.LoadXml();

            Application.Current.Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted;
        }
Exemplo n.º 3
0
        public bool AddRepository(string path)
        {
            // todo: non-local game client support
            if (!LocalGameClientPath.IsPathValid(path))
            {
                this.LogWarning("invalid local game client path '{0}'", path);
                return(false);
            }

            if (this.Repositories.Any(r => PathEx.Equals(path, r.Path)))
            {
                this.LogWarning("a local game client with the path '{0}' is already existed", path);
                return(false);
            }

            DialogManager.Instance.ShowProgressAsync(this.L("game_client_manager", "adding_repository_dialog_title"),
                                                     new AddRepositoryTask(this, path));

            return(true);
        }
        internal LocalGameClientPackageImage(LocalGameClientPath paths)
        {
            _paths = paths;


            using (var reader = new BigworldXmlReader(_paths.GetShellListFile(_paths.Nations[0])))
            {
                var element = XElement.Load(reader);
                _shellIcons = element.Element("icons")
                              .Elements()
                              .ToDictionary(e => e.Name.ToString(),
                                            e => PackageImage.Load(_paths.GuiPackageFile, "gui/maps/icons/shell/" + e.Value.Split(' ').First()));
            }

            _accessoryIcons   = new Dictionary <string, ImageSource>();
            _skillIcons       = new Dictionary <string, ImageSource>();
            _skillSmallIcons  = new Dictionary <string, ImageSource>();
            _nationSmallIcons = new Dictionary <string, ImageSource>();

            _tankSmallIcons   = new Dictionary <string, ImageSource>();
            _tankBigIcons     = new Dictionary <string, ImageSource>();
            _tankCountorIcons = new Dictionary <string, ImageSource>();

            using (var reader = new BigworldXmlReader(_paths.CommonCrewDataFile))
            {
                var element = XElement.Load(reader);
                _crewRoleIcons = element.Element("roles")
                                 .Elements()
                                 .ToDictionary(e => e.Name.ToString(),
                                               e => PackageImage.Load(_paths.GuiPackageFile, "gui/maps/icons/tankmen/roles/big/" + e.Element("icon").Value));
                _crewRoleSmallIcons = element.Element("roles")
                                      .Elements()
                                      .ToDictionary(e => e.Name.ToString(),
                                                    e => PackageImage.Load(_paths.GuiPackageFile, "gui/maps/icons/tankmen/roles/small/" + e.Element("icon").Value));
            }
        }
 public BigworldXmlPreprocessor(LocalGameClientPath paths, LocalGameClientLocalization localization)
 {
     _paths                 = paths;
     _localization          = localization;
     _lazyCommonVehicleData = new Lazy <XElement>(this.ProcessCommonVehicleDataFile);
 }