private void UpdateMirror(List <FileInstance> files)
        {
            // new mirror based on current file system state
            var newMirror = new MirrorModel();

            files.ForEach(
                file =>
            {
                newMirror.AddFile(file);
            }
                );

            // add newly discovered files
            newMirror.All.ForEach(
                newFile =>
            {
                if (null == newMirror.All.FirstOrDefault(oldFile => oldFile.Path == newFile.Path))
                {
                    this._mirror.AddFile(newFile);
                }
            }
                );

            this._mirror = newMirror;
            // rearrange file locations in mirror
            this._mirror.All.ForEach(
                file => { file.Move(); });

            this.SaveMirror();
        }
Esempio n. 2
0
 public IActionResult MirrorResponse(MirrorModel viewModel)
 {
     if (viewModel.HTTPStatus != 200)
     {
         return(StatusCode(viewModel.HTTPStatus));
     }
     foreach (var ac in viewModel.AlterCookies)
     {
         Response.Cookies.Append(ac.Key, ac.Value);
     }
     return(View(viewModel));
 }
Esempio n. 3
0
        public IActionResult Index(string id)
        {
            var model = new MirrorModel();

            if (!String.IsNullOrWhiteSpace(id))
            {
                Player player = GameManager.GetPlayerByMirrorId(id);
                if (player != null)
                {
                    model.Player = player;
                    model.Game   = player.Game;
                    model.User   = new GcUser()
                    {
                        TelegramUserId = player.ChatId
                    };
                }
            }
            return(View(model));
        }
 public Cleaner(InputService inputService)
 {
     this._inputService = inputService;
     this._mirror       = this.LoadMirror();
 }