OpenStorage() public static method

public static OpenStorage ( CASCExplorer.CASCConfig config, BackgroundWorkerEx worker = null ) : CASCHandler
config CASCExplorer.CASCConfig
worker BackgroundWorkerEx
return CASCHandler
Ejemplo n.º 1
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            string     arg    = (string)e.Argument;
            CASCConfig config = _onlineMode ? CASCConfig.LoadOnlineStorageConfig(arg, "us") : CASCConfig.LoadLocalStorageConfig(arg);

            if (_onlineMode)
            {
                using (SelectBuildForm sb = new SelectBuildForm(config))
                {
                    var result = sb.ShowDialog();

                    if (result != DialogResult.OK || sb.SelectedIndex == -1)
                    {
                        e.Cancel = true;
                        return;
                    }

                    config.ActiveBuild = sb.SelectedIndex;
                }
            }

            var casc = CASCHandler.OpenStorage(config, backgroundWorker1);

            casc.Root.LoadListFile(Path.Combine(Application.StartupPath, "listfile.txt"), backgroundWorker1);
            var fldr = casc.Root.SetFlags(Settings.Default.LocaleFlags, Settings.Default.ContentFlags);

            casc.Root.MergeInstall(casc.Install);

            e.Result = new object[] { casc, fldr };
        }
Ejemplo n.º 2
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            string arg = (string)e.Argument;

            CASCConfig.LoadFlags |= LoadFlags.Install;
            CASCConfig config = _onlineMode ? CASCConfig.LoadOnlineStorageConfig(arg, "us") : CASCConfig.LoadLocalStorageConfig(arg);

            if (_onlineMode)
            {
                using (SelectBuildForm sb = new SelectBuildForm(config))
                {
                    var result = sb.ShowDialog();

                    if (result != DialogResult.OK || sb.SelectedIndex == -1)
                    {
                        e.Cancel = true;
                        return;
                    }

                    config.ActiveBuild = sb.SelectedIndex;
                }
            }

            var casc = CASCHandler.OpenStorage(config, backgroundWorker1);

            casc.Root.SetFlags(Settings.Default.LocaleFlags, Settings.Default.ContentFlags, false);

            LoadFileDataComplete(casc);

            using (var _ = new PerfCounter("LoadListFile()"))
            {
                casc.Root.LoadListFile(Settings.Default.ListFilePath, backgroundWorker1);
            }

            var fldr = casc.Root.SetFlags(Settings.Default.LocaleFlags, Settings.Default.ContentFlags);

            casc.Root.MergeInstall(casc.Install);

            GC.Collect();

            e.Result = new object[] { casc, fldr };
        }