Exemplo n.º 1
0
        public LoadProgress LoadAll()
        {
            var progress = new LoadProgress();

            Task.Run(() => LoadAll(progress));
            return(progress);
        }
Exemplo n.º 2
0
    // Use this for initialization
	void Start () {
       controlScript =  GameObject.FindGameObjectWithTag(StateManager.CONTROL_SCRIPT_TAG);
       loadAssetBundle = controlScript.GetComponent<LoadAssetBundle>();
       saveProgress = controlScript.GetComponent<SaveProgress>();
       loadProgress = controlScript.GetComponent<LoadProgress>();
       stateManager = controlScript.GetComponent<StateManager>();
	}
Exemplo n.º 3
0
        protected override void SetUp()
        {
            base.SetUp();

            RepositoryLocator.CatalogueRepository.MEF.AddTypeToCatalogForTesting(typeof(TestDataWriter));
            RepositoryLocator.CatalogueRepository.MEF.AddTypeToCatalogForTesting(typeof(TestDataInventor));

            _lmd                     = new LoadMetadata(CatalogueRepository, "Ive got a lovely bunch o' coconuts");
            _LoadDirectory           = LoadDirectory.CreateDirectoryStructure(new DirectoryInfo(TestContext.CurrentContext.TestDirectory), @"EndToEndCacheTest", true);
            _lmd.LocationOfFlatFiles = _LoadDirectory.RootPath.FullName;
            _lmd.SaveToDatabase();

            Clear(_LoadDirectory);

            _cata = new Catalogue(CatalogueRepository, "EndToEndCacheTest");
            _cata.LoadMetadata_ID = _lmd.ID;
            _cata.SaveToDatabase();

            _lp = new LoadProgress(CatalogueRepository, _lmd);
            _cp = new CacheProgress(CatalogueRepository, _lp);

            _lp.OriginDate = new DateTime(2001, 1, 1);
            _lp.SaveToDatabase();

            _testPipeline = new TestDataPipelineAssembler("EndToEndCacheTestPipeline" + Guid.NewGuid(), CatalogueRepository);
            _testPipeline.ConfigureCacheProgressToUseThePipeline(_cp);

            _cp.CacheFillProgress = DateTime.Now.AddDays(-NumDaysToCache);
            _cp.SaveToDatabase();

            _cp.SaveToDatabase();
        }
Exemplo n.º 4
0
        public void LoadProgress_Equals()
        {
            var loadMetadata = new LoadMetadata(CatalogueRepository);


            LoadProgress progress     = new LoadProgress(CatalogueRepository, loadMetadata);
            LoadProgress progressCopy = CatalogueRepository.GetObjectByID <LoadProgress>(progress.ID);

            progressCopy.Name       = "fish";
            progressCopy.OriginDate = new DateTime(2001, 01, 01);

            try
            {
                //values are different
                Assert.AreNotEqual(progressCopy.OriginDate, progress.OriginDate);
                Assert.AreNotEqual(progressCopy.Name, progress.Name);

                //IDs are the same
                Assert.AreEqual(progressCopy.ID, progress.ID);

                //therefore objects are the same
                Assert.IsTrue(progressCopy.Equals(progress));
            }
            finally
            {
                progress.DeleteInDatabase();
                loadMetadata.DeleteInDatabase();
            }
        }
Exemplo n.º 5
0
        private void CreateAttacher(ITableInfo t, QueryBuilder qb, LoadMetadata lmd, LoadProgress loadProgressIfAny)
        {
            var pt = new ProcessTask(Activator.RepositoryLocator.CatalogueRepository, lmd, LoadStage.Mounting);

            pt.ProcessTaskType = ProcessTaskType.Attacher;
            pt.Name            = "Read from " + t;
            pt.Path            = typeof(RemoteTableAttacher).FullName;
            pt.SaveToDatabase();

            pt.CreateArgumentsForClassIfNotExists <RemoteTableAttacher>();


            pt.SetArgumentValue("RemoteServer", t.Server);
            pt.SetArgumentValue("RemoteDatabaseName", t.GetDatabaseRuntimeName(LoadStage.PostLoad));
            pt.SetArgumentValue("RemoteTableName", t.GetRuntimeName());
            pt.SetArgumentValue("DatabaseType", DatabaseType.MicrosoftSQLServer);
            pt.SetArgumentValue("RemoteSelectSQL", qb.SQL);

            pt.SetArgumentValue("RAWTableName", t.GetRuntimeName(LoadBubble.Raw));

            if (loadProgressIfAny != null)
            {
                pt.SetArgumentValue("Progress", loadProgressIfAny);
//              pt.SetArgumentValue("ProgressUpdateStrategy", DataLoadProgressUpdateStrategy.UseMaxRequestedDay);
                pt.SetArgumentValue("LoadNotRequiredIfNoRowsRead", true);
            }

            /*
             *
             *  public DataLoadProgressUpdateInfo { get; set; }
             */
        }
Exemplo n.º 6
0
        protected PluginEntryVM(PluginPackageInfoCR plugin, LoadProgress load)
        {
            Plugin = plugin;
            Plugin.PropertyChanged += Plugin_PropertyChanged;

            // Filter the dict to remove empty entries
            FilteredSupportedAlgorithms = new Dictionary <string, List <string> >();
            foreach (var kvp in Plugin.SupportedDevicesAlgorithms)
            {
                if (kvp.Value == null || kvp.Value.Count <= 0)
                {
                    continue;
                }
                FilteredSupportedAlgorithms[kvp.Key] = kvp.Value;
            }

            Load = load;
            Load.PropertyChanged += Install_PropertyChanged;

            Progress = new Progress <Tuple <PluginInstallProgressState, int> >(status =>
            {
                var(state, progress) = status;
                string statusText    = GetStateProgressText(state, progress);

                Load.IsInstalling = state < PluginInstallProgressState.FailedDownloadingPlugin;
                Load.Report((statusText, progress));
            });
            MinerPluginsManager.InstallAddProgress(plugin.PluginUUID, Progress);
        }
Exemplo n.º 7
0
        private void OnJournalEntryRead(object sender, JournalEntryEventArgs eventArgs)
        {
            if (!eventArgs.IsLive)
            {
                if (eventArgs.Filename == _currentLoadFilename)
                {
                    return;
                }

                _currentLoadFilename = eventArgs.Filename;

                var index = _loadJournalFilenames.IndexOf(eventArgs.Filename);
                if (index >= 0)
                {
                    var percentCompleted = (int)(index * 100 / (float)_loadJournalFilenames.Count);
                    LoadProgress.Raise(this, new ProgressEventArgs(percentCompleted));
                }

                return;
            }

            var journalEntry = eventArgs.JournalEntry;
            var siouxEvent   = _siouxData.Events.FirstOrDefault(e => e.Type == journalEntry.Event);

            if (siouxEvent == null)
            {
                return;
            }

            var capitalRegex = new Regex(@"(?<!\A)[A-Z]");
            var header       = capitalRegex.Replace(journalEntry.Event.ToString(), match => " " + match.Value);

            RaiseSiouxEventReceived(siouxEvent, header, journalEntry);
        }
Exemplo n.º 8
0
        public LoadProgressAnnotation(LoadProgress lp, DataTable dt, Chart chart)
        {
            _lp = lp;
            _dt = dt;

            LineAnnotation line;
            TextAnnotation text;

            GetAnnotations("OriginDate", 0.9, lp.OriginDate, chart, out line, out text);
            LineAnnotationOrigin = line;
            TextAnnotationOrigin = text;


            LineAnnotation line2;
            TextAnnotation text2;

            GetAnnotations("Progress", 0.7, lp.DataLoadProgress, chart, out line2, out text2);
            LineAnnotationFillProgress = line2;
            TextAnnotationFillProgress = text2;

            var cp = lp.CacheProgress;

            if (cp != null)
            {
                LineAnnotation line3;
                TextAnnotation text3;
                GetAnnotations("Cache Fill", 0.50, cp.CacheFillProgress, chart, out line3, out text3);
                LineAnnotationCacheProgress = line3;
                TextAnnotationCacheProgress = text3;
            }
        }
Exemplo n.º 9
0
        private void BeginLogReading()
        {
            this.RunOnGuiThread(() => this.view.SetProgress(LoadProgress.FromPercent(0)));

            var    errorMessage = string.Empty;
            Action action       = delegate
            {
                try
                {
                    this.StartReadLog();
                }
                catch (Exception e)
                {
                    errorMessage = e.ToString();
                    throw;
                }
            };

            this.cancellation = new CancellationTokenSource();
            var task = Task.Factory.StartNew(action, this.cancellation.Token, TaskCreationOptions.LongRunning, TaskScheduler.Default);

            Action <Task> onSuccess = obj => this.OnComplete(task, delegate { });
            Action <Task> onFailure = delegate
            {
                this.OnComplete(task, () => this.RunOnGuiThread(() => this.view.OnFailureRead(errorMessage)));
            };

            task.ContinueWith(onSuccess, CancellationToken.None, TaskContinuationOptions.OnlyOnCanceled, TaskScheduler.Default);
            task.ContinueWith(onSuccess, CancellationToken.None, TaskContinuationOptions.OnlyOnRanToCompletion, TaskScheduler.Default);
            task.ContinueWith(onFailure, CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted, TaskScheduler.Default);

            this.runningTasks.Add(task, this.view.LogPath);
        }
Exemplo n.º 10
0
        private void LoadAll(LoadProgress progress)
        {
            var           sw      = Stopwatch.StartNew();
            List <Action> actions = new List <Action>();

            foreach (var mpqLocation in paths.mpq)
            {
                actions.Add(() => Mpq.AddArchive(mpqLocation.filename, mpqLocation.optional));
            }
            actions.Add(() => AnimData.Load(paths.animData));
            actions.Add(Translation.Load);
            actions.Add(SoundInfo.Load);
            actions.Add(SoundEnvironment.Load);
            actions.Add(ObjectInfo.Load);
            actions.Add(BodyLoc.Load);
            actions.Add(ExpTable.Load);
            actions.Add(LevelType.Load);
            actions.Add(LevelWarpInfo.Load);
            actions.Add(LevelPreset.Load);
            actions.Add(LevelMazeInfo.Load);
            actions.Add(LevelInfo.Load);
            actions.Add(OverlayInfo.Load);
            actions.Add(MissileInfo.Load);
            actions.Add(ItemStat.Load);
            actions.Add(ItemRatio.Load);
            actions.Add(ItemType.Load);
            actions.Add(ItemPropertyInfo.Load);
            actions.Add(ItemSet.Load);
            actions.Add(UniqueItem.Load);
            actions.Add(SetItem.Load);
            actions.Add(TreasureClass.Load);
            actions.Add(MagicAffix.Load);
            actions.Add(CharStatsInfo.Load);
            actions.Add(MonLvl.Load);
            actions.Add(MonPreset.Load);
            actions.Add(MonSound.Load);
            actions.Add(MonStatsExtended.Load);
            actions.Add(MonStat.Load);
            actions.Add(SuperUnique.Load);
            actions.Add(SkillDescription.Load);
            actions.Add(SkillInfo.Load);
            actions.Add(SpawnPreset.Load);
            actions.Add(StateInfo.Load);
            progress.totalCount = actions.Count;
            try
            {
                foreach (Action action in actions)
                {
                    action();
                    progress.doneCount++;
                }
            }
            catch (Exception e)
            {
                progress.exception = e;
            }
            progress.finished = true;
            Debug.Log("DataLoader finished in " + sw.ElapsedMilliseconds + " ms");
        }
Exemplo n.º 11
0
        public void SetLoadProgress(LoadProgress lp, IActivateItems activator)
        {
            SetItemActivator(activator);
            _loadProgress = lp;
            RefreshUIFromDatabase();

            DoTransparencyProperly.ThisHoversOver(pathLinkLabel1, cacheState);
        }
Exemplo n.º 12
0
        public void ShowElapsedTime()
        {
            this.view.SetProgress(LoadProgress.FromPercent(100));
            this.totalReadTimeWatch.Stop();
            var text = string.Format(Resources.ReadCompletedTemplate, this.totalReadTimeWatch.Elapsed.TimespanToHumanString());

            this.view.SetLogProgressCustomText(text);
        }
Exemplo n.º 13
0
        protected override void SetBindings(BinderWithErrorProviderFactory rules, LoadProgress databaseObject)
        {
            base.SetBindings(rules, databaseObject);

            Bind(tbID, "Text", "ID", l => l.ID);
            Bind(tbName, "Text", "Name", l => l.Name);
            Bind(nDefaultNumberOfDaysToLoadEachTime, "Value", "DefaultNumberOfDaysToLoadEachTime", l => l.DefaultNumberOfDaysToLoadEachTime);
        }
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="bundleName"></param>
 /// <param name="lp"></param>
 public AssetBundleRelation(string bundleName, LoadProgress lp)
 {
     this.bundleName      = bundleName;
     this.lp              = lp;
     this.finish          = false;
     assetBundleLoader    = new AssetBundleLoader(onLoadComplete, lp, bundleName);
     dependenceBundleList = new List <string>();
     referenceBundleList  = new List <string>();
 }
Exemplo n.º 15
0
 /// <summary>
 /// AB包的依赖关系
 /// </summary>
 /// <param name="assetbundlename"></param>
 /// <param name="lp"></param>
 public AssetBundleRelation(string assetbundlename, LoadProgress lp)
 {
     m_ABloader        = new AssetBundleLoader(assetbundlename, OnLoadCompleted, lp);
     m_assetBundleName = assetbundlename;
     m_lp              = lp;
     m_FinishLoad      = false;
     DependencieBundle = new List <string>();
     ReferenceBundle   = new List <string>();
 }
Exemplo n.º 16
0
        public override void Execute()
        {
            base.Execute();

            var lp = new LoadProgress((ICatalogueRepository)_loadMetadata.Repository, _loadMetadata);

            Publish(_loadMetadata);
            Emphasise(lp);
        }
Exemplo n.º 17
0
 public AssetBundleRelation(string bundleName, LoadProgress loadProgress)
 {
     mBundleName        = bundleName;
     LoadProgress       = loadProgress;
     mFinish            = false;
     mDependenceBundle  = new List <string>();
     mReferenceBundle   = new List <string>();
     mAssetBundleLoader = new AssetBundleLoader(OnLoadComplete, LoadProgress, mBundleName);
 }
Exemplo n.º 18
0
    private AssetLoader abRes; // 下层资源加载类的对象


    public WWWLoader(string bundleName, LoadProgress lp, LoadCompeleted lc)
    {
        this.bundleName = bundleName;
        this.bundlePath = PathUtil.GetWWWPath() + "/" + bundleName;
        www             = null;
        this.lp         = lp;
        this.lc         = lc;
        abRes           = null;
    }
Exemplo n.º 19
0
        public ExecuteCommandCreateNewCacheProgress(IBasicActivateItems activator, LoadProgress loadProgress) : base(activator)
        {
            _loadProgress = loadProgress;

            if (_loadProgress.CacheProgress != null)
            {
                SetImpossible("LoadProgress already has a CacheProgress associated with it");
            }
        }
Exemplo n.º 20
0
        protected PluginEntryVM(PluginPackageInfoCR plugin, LoadProgress load)
        {
            Plugin = plugin;

            // Filter the dict to remove empty entries
            FilteredSupportedAlgorithms = new Dictionary <string, List <string> >();
            foreach (var kvp in Plugin.SupportedDevicesAlgorithms)
            {
                if (kvp.Value == null || kvp.Value.Count <= 0)
                {
                    continue;
                }
                FilteredSupportedAlgorithms[kvp.Key] = kvp.Value;
            }

            Load = load;
            Load.PropertyChanged += Install_PropertyChanged;

            Progress = new Progress <Tuple <PluginInstallProgressState, int> >(status =>
            {
                var(state, progress) = status;

                string statusText;

                switch (state)
                {
                case PluginInstallProgressState.Pending:
                    statusText = Tr("Pending Install");
                    break;

                case PluginInstallProgressState.DownloadingMiner:
                    statusText = Tr("Downloading Miner: {0} %", $"{progress:F2}");
                    break;

                case PluginInstallProgressState.DownloadingPlugin:
                    statusText = Tr("Downloading Plugin: {0} %", $"{progress:F2}");
                    break;

                case PluginInstallProgressState.ExtractingMiner:
                    statusText = Tr("Extracting Miner: {0} %", $"{progress:F2}");
                    break;

                case PluginInstallProgressState.ExtractingPlugin:
                    statusText = Tr("Extracting Plugin: {0} %", $"{progress:F2}");
                    break;

                default:
                    statusText = Tr("Pending Install");
                    break;
                }

                Load.IsInstalling = state < PluginInstallProgressState.FailedDownloadingPlugin;
                Load.Report((statusText, progress));
            });
            MinerPluginsManager.InstallAddProgress(plugin.PluginUUID, Progress);
        }
Exemplo n.º 21
0
        public async Task LoadLibraryAsync(string fileName, bool precache = false)
        {
            try
            {
                LoadProgress?.Invoke(this, new TransitionLibraryProgressEventArgs(0, 1, "loading transitions settings"));
                var transitions = await ConfigParser.ParseAsync(fileName);

                foreach (var transition in transitions)
                {
                    TransitionData?transitionData = null;
                    switch (transition[0])
                    {
                    case "SoundAndGif":
                        float.TryParse(transition[3], out var duration);
                        transitionData = new SoundAndGifTransitionData(transition[1], transition[2], duration);

                        break;
                    }
                    if (transitionData != null)
                    {
                        if (TransitionCache.ContainsKey(transitionData.Hash))
                        {
                            TransitionCache[transitionData.Hash].Count++;
                        }
                        else
                        {
                            TransitionCache.Add(transitionData.Hash, transitionData);
                        }
                    }
                }
                ListReady?.Invoke(this, null);
                if (precache)
                {
                    int current = 0;
                    int total   = TransitionCache.Count();
                    while (current < TransitionCache.Count())
                    {
                        var    toCache = TransitionCache.Skip(current).Take(2).ToList();
                        Task[] tasks   = toCache.Select(tc => tc.Value.PreloadAsync()).ToArray();
                        await Task.WhenAll(tasks);

                        current += toCache.Count();
                        LoadProgress?.Invoke(this, new TransitionLibraryProgressEventArgs(current, total, "Preloading"));
                    }
                }
            }
            catch (Exception ex)
            {
                CustomMainForm.Log($"{ex.StackTrace}");
                CustomMainForm.Log($"{ex.Message}");
            }
            finally
            {
                LoadComplete?.Invoke(this, null);
            }
        }
Exemplo n.º 22
0
    private LoadCompleted m_lc;        //加载完成回调函数

    /// <summary>
    /// ABloader构造函数
    /// </summary>
    /// <param name="assetbundlename">AB包名</param>
    /// <param name="lc">加载完成回调</param>
    /// <param name="lp">加载进度回调</param>
    public AssetBundleLoader(string assetbundlename, LoadCompleted lc, LoadProgress lp)
    {
        m_assetLoader     = null;
        m_www             = null;
        m_assetBundleName = assetbundlename;
        m_assetBundlePath = PathUtil.getWWWPath() + "/" + m_assetBundleName;
        m_progress        = 0.0f;
        m_lp = lp;
        m_lc = lc;
    }
Exemplo n.º 23
0
    public AssetBundleRelation(string bundleName, LoadProgress lp)
    {
        isloadFinished  = false;
        this.bundleName = bundleName;
        this.lp         = lp;
        assetLoader     = new WWWLoader(bundleName, lp, LoadFinished);

        dependenceBundleList = new List <string>();
        referBundleList      = new List <string>();
    }
Exemplo n.º 24
0
        public void CreateNewScheduleTest()
        {
            var loadMetadata = new LoadMetadata(CatalogueRepository);
            var loadProgress = new LoadProgress(CatalogueRepository, loadMetadata);

            Assert.AreEqual(loadProgress.LoadMetadata_ID, loadMetadata.ID);

            loadProgress.DeleteInDatabase();
            loadMetadata.DeleteInDatabase();
        }
Exemplo n.º 25
0
 public AssetBundleLoader(LoadComplete loadComplete, LoadProgress loadProgress, string bundleName)
 {
     mLoadComplete = loadComplete;
     mLoadProgress = loadProgress;
     mBundleName   = bundleName;
     mProgress     = 0f;
     mBundlePath   = PathUtil.GetWWWPath() + "/" + bundleName;
     mWWW          = null;
     mAssetLoader  = null;
 }
Exemplo n.º 26
0
 public IABLoader(LoadProgress loadProgress, LoadFinish loadFinish)
 {
     bundleName             = "";
     commonBundlePath       = "";
     commonResLoaderProcess = 0;
     loadProgress           = null;
     loadFinish             = null;
     abResLoader            = null;
     this.loadProgress      = loadProgress;
     this.loadFinish        = loadFinish;
 }
Exemplo n.º 27
0
    /// <summary>
    /// 构造函数
    /// </summary>
    /// <param name="lc"></param>
    /// <param name="lp"></param>
    /// <param name="bundleName"></param>
    public AssetBundleLoader(LoadComplete lc, LoadProgress lp, string bundleName)
    {
        this.lc         = lc;
        this.lp         = lp;
        this.bundleName = bundleName;
        this.progress   = 0;

        this.bundlePath  = PathUtil.GetWWWPath() + "/" + bundleName;
        this.www         = null;
        this.assetLoader = null;
    }
Exemplo n.º 28
0
    /// <summary>
    /// 加载AB包
    /// </summary>
    public void LoadAB(string fileName, LoadProgress lp, LoadAssetBundleCallBack callBack)
    {
        if (!allAsset.ContainsKey(fileName))
        {
            Debug.LogError("The allAsset Not Contains Key :  " + fileName);
            return;
        }

        string bundleName = allAsset[fileName];

        abManager.LoadAB(bundleName, lp, callBack);
    }
Exemplo n.º 29
0
    // 3.加载AssetBundle包
    /// <summary>
    /// 加载AssetBundle包
    /// </summary>
    public void LoadAssetBundle(string sceneName, string fileName, LoadProgress lp)
    {
        if (!loadManager.ContainsKey(sceneName))
        {
            Debug.Log("loadManager Not Contains Key :  " + sceneName + ", ReadConfiger first");
            ReadConfiger(sceneName);             // 读取配置文件,然后存到 loadManager 里
        }

        ABSceneManager abScene = loadManager[sceneName];

        abScene.LoadAB(fileName, lp, LoadCompeleteCallBack);
    }
Exemplo n.º 30
0
        public McResourcePack(ZipArchive archive, McResourcePackPreloadCallback preloadCallback, LoadProgress progressReporter = null)
        {
            ProgressReporter = progressReporter;

            PngDecoder = new PngDecoder()
            {
                IgnoreMetadata = true
            };
            PreloadCallback = preloadCallback;
            //_archive = archive;
            Load(archive);
        }
Exemplo n.º 31
0
    // 提供加载功能
    public void LoadAsset(string sceneName, string bundleName, LoadProgress loadProgress)
    {
        if (!sceneManagers.ContainsKey(sceneName))
        {
            ReadConfiger(sceneName);
        }

        // 加载指定包
        IABSceneManager sceneManager = sceneManagers[sceneName];

        sceneManager.LoadAsset(bundleName, loadProgress, OnLoadedCallBack);
    }