Esempio 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);
                    }
                }
            }
Esempio n. 2
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);
        }