tinke icon indicating copy to clipboard operation
tinke copied to clipboard

Raw Image (or Palette) Writing Error Message on Map (or Image) importing

Open MetLob opened this issue 9 years ago • 1 comments

If I create raw palette or image entity without real FAT id then on importing of a new image I see Error Message with text:

clipboard02

Cause of this in next lines (ImageControl.cs in Ekona):

    private void Save_Files()
    {
        if (image.ID >= 0)
        {
            try
            {
                string imageFile = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar + Path.GetRandomFileName() + image.FileName;
                image.Write(imageFile, palette);
                pluginHost.ChangeFile(image.ID, imageFile);
            }
            catch (Exception e) { MessageBox.Show("Error writing new image:\n" + e.Message); };
        }
        if (palette.ID >= 0 && radioReplacePal.Checked)
        {
            try
            {
                string paletteFile = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar + Path.GetRandomFileName() + palette.FileName;
                palette.Write(paletteFile);
                pluginHost.ChangeFile(palette.ID, paletteFile);
            }
            catch (Exception e) { MessageBox.Show("Error writing new palette:\n" + e.Message); };
        }
        if (isMap && map.ID >= 0)
        {
            try
            {
                string mapFile = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar + Path.GetRandomFileName() + map.FileName;
                map.Write(mapFile, image, palette);
                pluginHost.ChangeFile(map.ID, mapFile);
            }
            catch (Exception e) { MessageBox.Show("Error writing new map:\n" + e.Message); };
        }
    }

Because the image.ID and palette.ID has zero as default value.

This is issue will be fixed on Pull Request #31 in last update.

MetLob avatar Jun 08 '16 09:06 MetLob

Yeah, I agree with you. I will try to review the pull request soon (hopefully today).

pleonex avatar Jun 08 '16 17:06 pleonex