示例#1
0
        private async void loadAsync()
        {
            if (ImageUriHelper.canUseGameContent())
            {
                showBusyIndicator();
                await ImageUriHelper.loadGameContentAsync();
            }

            doneLoading();
        }
示例#2
0
        private async void loadGameContentAsync(string paksFolderPath)
        {
            showBusyIndicator();
            try
            {
                await ImageUriHelper.loadGameContentAsync(paksFolderPath);
            }
            catch (Exception e)
            {
                MessageBox.Show($"{e.Message}\n{e.StackTrace}", R.ERROR);
                this.Shutdown();
                return;
            }
            await preloadImages();

            showMainWindow();
        }
示例#3
0
        private void load()
        {
            //check default install locations
            string?paksFolderPath = ImageUriHelper.usableGameContentIfExists();

            if (_askForGameContentLocation || string.IsNullOrWhiteSpace(paksFolderPath))
            {
                //show dialog asking for install location
                EventLogger.logEvent("showGameFilesWindow");
                var gameFilesWindow = new GameFilesWindow(allowNoContent: true);
                gameFilesWindow.Owner = this.MainWindow;
                gameFilesWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                gameFilesWindow.ShowDialog();
                var gameFilesWindowResult = gameFilesWindow.result;
                switch (gameFilesWindowResult)
                {
                case GameFilesWindow.GameFilesWindowResult.exit:
                    this.Shutdown();
                    break;

                case GameFilesWindow.GameFilesWindowResult.useSelectedPath:
                    loadGameContentAsync(gameFilesWindow.selectedPath !);
                    break;

                case GameFilesWindow.GameFilesWindowResult.noContent:
                    showMainWindow();
                    break;
                }
            }
            else
            {
                try
                {
                    loadGameContentAsync(paksFolderPath !);
                }
                catch (Exception e)
                {
                    MessageBox.Show($"{e.Message}\n{e.StackTrace}", R.ERROR);
                    this.Shutdown();
                    return;
                }
            }
        }
示例#4
0
        public static BitmapImage?extractBitmap(this PakIndex pakIndex, string fullPath)
        {
            var package = pakIndex.extractPackage(fullPath);
            var texture = package?.GetExport <UTexture2D>();

            if (texture == null)
            {
                EventLogger.logError($"Could not get texture from package {fullPath}");
                return(null);
            }
            var bitmap = ImageUriHelper.bitmapImageFromSKImage(texture.Image);

            if (bitmap == null)
            {
                EventLogger.logError($"Could not get bitmap from texture {fullPath}");
                return(null);
            }
            bitmap.Freeze();
            return(bitmap);
        }