Ejemplo n.º 1
0
        public static ReskinFile ParseFile(Bitmap Image, bool loadHat = true)
        {
            var file = new ReskinFile();

            file.Parse(Image, loadHat);
            return(file);
        }
Ejemplo n.º 2
0
        ReskinFile SaveImage()
        {
            string s;

            if (!Datas.TrueForAll(x => x.isValid(out s)))
            {
                return(null);
            }

            ReskinFile file = new ReskinFile((Bitmap)(Datas[0].control as ImageSelectControl).ImageDisplay.Image, Datas.Skip(1).Select(x => x.getData()).Where(x => x != null).ToArray());

            return(file);
        }
Ejemplo n.º 3
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.º 4
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");
        }