private void OpenSkin(object sender, EventArgs e)
        {
            //TODO: Catched exceptions show message box with info about exception
            openFileDialog.Filter           = "Audiosurf Skins (.askin)|*.askin";
            openFileDialog.InitialDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\Skins";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                skin             = skinPackager.Decompile(openFileDialog.FileName);
                pathToOpenedSkin = openFileDialog.FileName;
                try
                {
                    Sphere1.Image = ((Bitmap)skin.SkySpheres.Group[0]).Rescale(picBoxSizes["SkySphere"]);
                    Sphere2.Image = ((Bitmap)skin.SkySpheres.Group[1]).Rescale(picBoxSizes["SkySphere"]);
                    Sphere3.Image = ((Bitmap)skin.SkySpheres.Group[2]).Rescale(picBoxSizes["SkySphere"]);
                }
                catch { }

                try
                {
                    var tilesheet = ((Bitmap)skin.Tiles).Squarify();
                    tile1.Image = tilesheet[0].Rescale(picBoxSizes["Texture"]);
                    tile2.Image = tilesheet[1].Rescale(picBoxSizes["Texture"]);
                    tile3.Image = tilesheet[2].Rescale(picBoxSizes["Texture"]);
                    tile4.Image = tilesheet[3].Rescale(picBoxSizes["Texture"]);
                }
                catch { }
                try
                {
                    tileflyup.Image = ((Bitmap)skin.TilesFlyup).Rescale(picBoxSizes["Texture"]);
                }
                catch { }

                try
                {
                    ring1.Image = ((Bitmap)skin.Rings.Group[0]).Rescale(picBoxSizes["Texture"]);
                    ring2.Image = ((Bitmap)skin.Rings.Group[1]).Rescale(picBoxSizes["Texture"]);
                    ring3.Image = ((Bitmap)skin.Rings.Group[2]).Rescale(picBoxSizes["Texture"]);
                    ring4.Image = ((Bitmap)skin.Rings.Group[3]).Rescale(picBoxSizes["Texture"]);
                }
                catch { }

                try
                {
                    part1.Image = ((Bitmap)skin.Particles.Group[0]).Rescale(picBoxSizes["Texture"]);
                    part2.Image = ((Bitmap)skin.Particles.Group[1]).Rescale(picBoxSizes["Texture"]);
                    part3.Image = ((Bitmap)skin.Particles.Group[2]).Rescale(picBoxSizes["Texture"]);
                    hit1.Image  = ((Bitmap)skin.Hits.Group[0]).Rescale(picBoxSizes["Texture"]);
                    hit2.Image  = ((Bitmap)skin.Hits.Group[1]).Rescale(picBoxSizes["Texture"]);
                }
                catch { }
                CreateSkinFieldsAssotiationTables();
                AllPictureboxes.ForEach(x => RemoveMouseActions(x));
                openFileDialog.Filter   = "Supported Images(*.PNG; *.JPG)| *.PNG; *.JPG| All files(*.*) | *.*";
                openFileDialog.FileName = "";
                button1.Text            = "Rewrite current";
                button1.Click          -= ExportSkin;
                button1.Click          += RewriteSkin;
            }
        }
Beispiel #2
0
        private void LoadSkins(string[] files, bool reload = false)
        {
            progressBar1.Invoke(new Action(() => progressBar1.Value = progressBar1.Minimum));
            if (reload)
            {
                EnvironmentalVeriables.Skins.Clear();
                SkinsListBox.Invoke(new Action(() => SkinsListBox.Items.Clear()));
            }
            var progBarPart = progressBar1.Maximum / files.Length;

            foreach (var path in files)
            {
                if (new FileInfo(path).Extension != ".askin")
                {
                    continue;
                }

                AudiosurfSkin skin = skinPackager.Decompile(path);
                if (skin == null)
                {
                    return;
                }

                var tempLink = new SkinLink(path, skin.Name);
                loadingSkinNameLabel.Invoke(new Action(() => loadingSkinNameLabel.Text = tempLink.Name));
                progressBar1.Invoke(new Action(() => progressBar1.Value += progBarPart));
                EnvironmentalVeriables.Skins.Add(tempLink);
                SkinsListBox.Invoke(new Action(() => SkinsListBox.Items.Add(tempLink)));
            }

            if (SkinsListBox.Items.Count == 0)
            {
                return;
            }

            progressBar1.Invoke(new Action(() => progressBar1.Value = progressBar1.Maximum));
            SkinsListBox.SetProperty(() => SkinsListBox.SelectedIndex, 0);
            SkinsListBox.Invoke(new Action(() => SkinsListBox.Invalidate()));
            loadingSkinNameLabel.Invoke(new Action(() => loadingSkinNameLabel.Text = "Complete"));
        }
Beispiel #3
0
 public AudiosurfSkin Load()
 {
     return(packager.Decompile(Path));
 }