Exemplo n.º 1
0
        protected sealed override void OnStart(object[] args)
        {
            _file = (DynamicFile)args[0];

            if (System.IO.File.Exists(_file.Path))
            {
                StartCoroutine(LoadFile(_file.Path));
            }
            else
            {
                Download();
            }
        }
Exemplo n.º 2
0
        public DynamicFile Download(DynamicFile file)
        {
            file.Path = Path.Combine(_folderPath, file.FileName);

            if (_cache.ContainsKey(file.Path))
            {
                return(_cache[file.Path]);
            }
            else
            {
                _downloadQueue.Add(file.Path);
                _cache.Add(file.Path, file);

                _stateMachine.Execute(_fileToCommand[file.GetType()], file).AsyncToken.AddResponder(
                    new Responder <StateCommand>(OnDownloadFinished, OnDownloadFault));
            }

            return(file);
        }