Exemplo n.º 1
0
        private void OpenAppBrowser(string browsePath)
        {
            if (!Directory.Exists(browsePath))
            {
                ErrorBox("An error occured!"); return;
            }

            ThemeMii_AppBrowse appBrowser = new ThemeMii_AppBrowse();

            appBrowser.RootPath        = browsePath;
            appBrowser.ViewOnly        = browseInfo.viewOnly;
            appBrowser.ContainerBrowse = browseInfo.containerBrowse;
            appBrowser.SelectedPath    = browseInfo.selectedNode;
            appBrowser.OnlyTpls        = browseInfo.onlyTpls;

            if (appBrowser.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (panStaticData.Visible)
                {
                    tbStaticDataFile.Text = appBrowser.SelectedPath;
                }
                else if (panStaticImage.Visible)
                {
                    tbStaticImageFile.Text = appBrowser.SelectedPath;

                    if (settings.imageSizeFromTpl)
                    {
                        try
                        {
                            byte[] tempTpl = Wii.Tools.LoadFileToByteArray(appBrowser.FullPath, 0, 500);
                            tbStaticImageWidth.Text  = Wii.TPL.GetTextureWidth(tempTpl).ToString();
                            tbStaticImageHeight.Text = Wii.TPL.GetTextureHeight(tempTpl).ToString();
                        }
                        catch { }
                    }
                }
                else if (panCustomData.Visible)
                {
                    tbCustomDataFile.Text = appBrowser.SelectedPath;
                }
                else if (panCustomImage.Visible)
                {
                    tbCustomImageFile.Text = appBrowser.SelectedPath;

                    if (settings.imageSizeFromTpl)
                    {
                        try
                        {
                            byte[] tempTpl = Wii.Tools.LoadFileToByteArray(appBrowser.FullPath, 0, 500);
                            tbCustomImageWidth.Text  = Wii.TPL.GetTextureWidth(tempTpl).ToString();
                            tbCustomImageHeight.Text = Wii.TPL.GetTextureHeight(tempTpl).ToString();
                        }
                        catch { }
                    }
                }
                else if (panContainer.Visible)
                {
                    tbContainerFile.Text = appBrowser.SelectedPath;
                }
            }
        }
        private void OpenAppBrowser(string browsePath)
        {
            if (!Directory.Exists(browsePath)) { ErrorBox("An error occured!"); return; }

            ThemeMii_AppBrowse appBrowser = new ThemeMii_AppBrowse();
            appBrowser.RootPath = browsePath;
            appBrowser.ViewOnly = browseInfo.viewOnly;
            appBrowser.ContainerBrowse = browseInfo.containerBrowse;
            appBrowser.SelectedPath = browseInfo.selectedNode;
            appBrowser.OnlyTpls = browseInfo.onlyTpls;

            if (appBrowser.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (panStaticData.Visible) tbStaticDataFile.Text = appBrowser.SelectedPath;
                else if (panStaticImage.Visible)
                {
                    tbStaticImageFile.Text = appBrowser.SelectedPath;

                    if (settings.imageSizeFromTpl)
                    {
                        try
                        {
                            byte[] tempTpl = Wii.Tools.LoadFileToByteArray(appBrowser.FullPath, 0, 500);
                            tbStaticImageWidth.Text = Wii.TPL.GetTextureWidth(tempTpl).ToString();
                            tbStaticImageHeight.Text = Wii.TPL.GetTextureHeight(tempTpl).ToString();
                        }
                        catch { }
                    }
                }
                else if (panCustomData.Visible) tbCustomDataFile.Text = appBrowser.SelectedPath;
                else if (panCustomImage.Visible)
                {
                    tbCustomImageFile.Text = appBrowser.SelectedPath;

                    if (settings.imageSizeFromTpl)
                    {
                        try
                        {
                            byte[] tempTpl = Wii.Tools.LoadFileToByteArray(appBrowser.FullPath, 0, 500);
                            tbCustomImageWidth.Text = Wii.TPL.GetTextureWidth(tempTpl).ToString();
                            tbCustomImageHeight.Text = Wii.TPL.GetTextureHeight(tempTpl).ToString();
                        }
                        catch { }
                    }
                }
                else if (panContainer.Visible) tbContainerFile.Text = appBrowser.SelectedPath;
            }
        }