コード例 #1
0
 private void ExportSkin(object sender, EventArgs e)
 {
     if (!isRescaleCheckButton.Checked)
     {
         RescaleSkinTextures();
     }
     skin.Name = skinNameEntry.Text;
     skinPackager.CompileTo(skin, "Skins");
     MessageBox.Show("Done!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
     OnSkinExprotrted?.Invoke();
 }
コード例 #2
0
 private Task PackFolderIntoSkin(string directory)
 {
     return(Task.Run(() =>
     {
         lock (skinPackager)
         {
             AudiosurfSkin skin = skinPackager.CreateSkinFromFolder(directory);
             if (skin == null)
             {
                 MessageBox.Show($"Error during packaging {directory} into audiosurf skin. Please, Check selected folder", "Package Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 return;
             }
             if (MessageBox.Show("Do you want to name new skin?", "new skin", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
             {
                 new OpenNewSkinForm().ShowDialog();
                 skin.Name = EnvironmentalVeriables.TempSkinName;
             }
             else
             {
                 string name = new DirectoryInfo(directory).Name;
                 foreach (var skinName in EnvironmentalVeriables.Skins.Select(x => x.Name))
                 {
                     if (name == skinName)
                     {
                         MessageBox.Show("Skin with same name already exist! Enter new name for this skin", "Naming Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                         new OpenNewSkinForm().ShowDialog();
                         name = EnvironmentalVeriables.TempSkinName;
                         break;
                     }
                 }
                 skin.Name = name;
             }
             skinPackager.CompileTo(skin, "Skins");
             var link = new SkinLink(@"Skins\" + skin.Name + SkinPackager.skinExtension, skin.Name);
             EnvironmentalVeriables.Skins.Add(link);
             SkinsListBox.Invoke(new Action(() => SkinsListBox.Items.Add(link)));
             DrawPreviewOfSkin(link);
             currentSkin = skin;
         }
     }));
 }