private void Save_Click(object sender, RoutedEventArgs e)
        {
            string str = Interaction.InputBox("Theme name", "BlueStacks Theme Editor Tool", string.Format((IFormatProvider)CultureInfo.CurrentCulture, "{0:F}", (object)DateTime.Now), 0, 0);

            if (Directory.Exists(Path.Combine(RegistryManager.Instance.ClientInstallDir, str)))
            {
                int num = (int)System.Windows.MessageBox.Show("Already Exists. Please retry");
            }
            else
            {
                Directory.CreateDirectory(Path.Combine(RegistryManager.Instance.ClientInstallDir, str));
                ThemeEditorWindow.CopyEverything(this.DraftDirectory, Path.Combine(RegistryManager.Instance.ClientInstallDir, str));
                RegistryManager.Instance.SetClientThemeNameInRegistry(str);
                Window w = (Window)BlueStacksUIUtils.DictWindows.Values.ToList <MainWindow>()[0];
                w.Dispatcher.Invoke((Delegate)(() =>
                {
                    RenderTargetBitmap renderTargetBitmap = new RenderTargetBitmap((int)w.ActualWidth, (int)w.ActualHeight, 0.0, 0.0, PixelFormats.Pbgra32);
                    renderTargetBitmap.Render((Visual)BlueStacksUIUtils.DictWindows.Values.ToList <MainWindow>()[0]);
                    PngBitmapEncoder pngBitmapEncoder = new PngBitmapEncoder();
                    pngBitmapEncoder.Frames.Add(BitmapFrame.Create((BitmapSource)renderTargetBitmap));
                    using (Stream stream = (Stream)File.Create(Path.Combine(CustomPictureBox.AssetsDir, "ThemeThumbnail.png")))
                        pngBitmapEncoder.Save(stream);
                }));
                BlueStacksUIColorManager.AppliedTheme.Save(BlueStacksUIColorManager.GetThemeFilePath(RegistryManager.ClientThemeName));
                CustomPictureBox.UpdateImagesFromNewDirectory("");
            }
        }
 private void ThemeEditorWindow_Activated(object sender, EventArgs e)
 {
     if (!this.isCreateDraftDirectory)
     {
         return;
     }
     this.ListView2.ItemsSource  = (IEnumerable)BlueStacksUIBinding.Instance.ImageModel.Keys.ToList <string>();
     this.isCreateDraftDirectory = false;
     ThemeEditorWindow.CopyEverything(CustomPictureBox.AssetsDir, this.DraftDirectory);
     File.Delete(Path.Combine(this.DraftDirectory, "ThemeThumbnail.png"));
 }
 private void Load_Click(object sender, RoutedEventArgs e)
 {
     using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog()
     {
         SelectedPath = RegistryManager.Instance.ClientInstallDir
     })
     {
         if (folderBrowserDialog.ShowDialog() != DialogResult.OK || string.IsNullOrEmpty(folderBrowserDialog.SelectedPath))
         {
             return;
         }
         string selectedPath = folderBrowserDialog.SelectedPath;
         if (File.Exists(Path.Combine(folderBrowserDialog.SelectedPath, "ThemeFile")))
         {
             string fileName = Path.GetFileName(folderBrowserDialog.SelectedPath);
             if (!folderBrowserDialog.SelectedPath.Contains(RegistryManager.Instance.ClientInstallDir))
             {
                 string str = Path.Combine(RegistryManager.Instance.ClientInstallDir, fileName);
                 if (Directory.Exists(str))
                 {
                     int num = (int)System.Windows.MessageBox.Show("Theme with this name already exists. Please rename the folder an try again");
                 }
                 else
                 {
                     Directory.CreateDirectory(str);
                     ThemeEditorWindow.CopyEverything(folderBrowserDialog.SelectedPath, str);
                 }
             }
             BlueStacksUIColorManager.ReloadAppliedTheme(fileName);
         }
         else
         {
             int num1 = (int)System.Windows.MessageBox.Show("Please select theme folder");
         }
     }
 }