Ejemplo n.º 1
0
        public async static Task <BarViewModel> Load(string filename, bool doCRC32)
        {
            BarViewModel barViewModel = new BarViewModel();

            barViewModel.extractingState = 0;
            barViewModel.barFilePath     = filename;
            barViewModel.IsCRC32Checked  = doCRC32;
            barViewModel.barFile         = await BarFile.Load(filename, doCRC32);

            barViewModel.ResetProgress();

            barViewModel.entriesCollection         = new CollectionViewSource();
            barViewModel.entriesCollection.Source  = barViewModel.barFile.BarFileEntrys;
            barViewModel.entriesCollection.Filter += barViewModel.Filter;
            return(barViewModel);
        }
Ejemplo n.º 2
0
        public static async Task <BarViewModel> Create(string rootFolder, uint version)
        {
            BarViewModel barViewModel = new BarViewModel();

            barViewModel.extractingState = 0;

            var filename = rootFolder;

            if (rootFolder.EndsWith(Path.DirectorySeparatorChar.ToString()))
            {
                filename = rootFolder.Substring(0, rootFolder.Length - 1);
            }
            barViewModel.IsCRC32Checked = true;
            barViewModel.barFilePath    = filename + ".bar";
            barViewModel.barFile        = await BarFile.Create(rootFolder, version);

            barViewModel.entriesCollection = new CollectionViewSource();
            barViewModel.ResetProgress();

            barViewModel.entriesCollection.Source  = barViewModel.barFile.BarFileEntrys;
            barViewModel.entriesCollection.Filter += barViewModel.Filter;

            return(barViewModel);
        }