Ejemplo n.º 1
0
        void OpenImage(Bitmap bitmap)
        {
            try {
                Applydatas();

                var file = ReskinFile.ParseFile(bitmap);
                var ctrl = (Datas[0].control as ImageSelectControl);
                ctrl.ImageDisplay.Image = file.Hat;
                ctrl.ImageSize          = file.Hat.Size;
                foreach (var data in file.OtherData)
                {
                    Datas.Find(x => x.Name == data.Key)?.parseData(data);
                }
                bitmap.Dispose();
            }
            catch
            {
                MessageBox.Show("Picture doesnt contain any reskin data", "Oh noes!");
            }
        }
Ejemplo n.º 2
0
        void AddFile(string path)
        {
            string fileName = Path.GetFileName(path);

            switch (Path.GetExtension(path))
            {
            case ".rsk":
                File.Copy(path, DumpDirectory + fileName, true);
                return;

            case ".png":
                try {
                    ReskinFile file = ReskinFile.ParseFile(new Bitmap(Image.FromFile(path)));

                    string name = Path.GetFileNameWithoutExtension(path);
                    File.WriteAllBytes(DumpDirectory + name + ".rsk", file.getHat(name));
                    return;
                } catch { }
                break;
            }

            ShowWarning("Could not load " + path, "Invalid reskin");
        }