Install from Zip: Zip format errors
#1
The error I get when it doesn't work (*-1.0.4.zip) is "This addon does not have the correct structure"

So I created three zips (with my addon repo).

http://services.erayan.com/kodirepo/addo...-1.0.3.zip (works, made using the windows 8.1 copy to compressed folder command)

http://services.erayan.com/kodirepo/addo...-1.0.4.zip (doesn't work, made using .NET 4.5.2 ZipArchive class (System.IO.Compression), code below)

http://services.erayan.com/kodirepo/addo...-1.0.5.zip (works, made using winrar 5 64-bit)

The content are exactly the same, all of those work in winrar and they are according to winrar "valid" zip files.

Also if you rename repository.erayan.addons-1.0.4.zip to repository.erayan.addons.zip, it does work.

Now I don't know what library kodi uses to open up zipfiles on windows, but it struggles.

I'm not too sure if that mean there is something funky about the zip implementation used. The debug log doesn't even show the line that it is actually opening the zip file.

Also if anyone knows a good (in-depth) zip-verifier that would be great, maybe I need to bash microsoft on their zip implementation or the kodi dev team.

Code:
#region zip the files
using (FileStream fs = new FileStream(addonpackagepath,FileMode.Create)) //create file stream
{
    using(ZipArchive zip = new ZipArchive(fs, ZipArchiveMode.Create, false, Encoding.UTF8)){ //wrap ZipArchive around the FileStream
        DirectoryInfo addonfilesdi = new DirectoryInfo(addonfiles); // Make a directory info out of the addon file path
        FileInfo[] addonfilesfis = addonfilesdi.GetFiles("*.*", SearchOption.AllDirectories); // Get all addon files.
        foreach(FileInfo addonfilesfi in addonfilesfis){
            String ZipPath = Path.Combine(addon.Name,GetRelativePath(addonfilesfi.FullName,addonfiles)).Replace(Path.DirectorySeparatorChar,'/'); // Make all addon files like addon.id/<filepath> in the zip file and also replace the slashes (doesn't seem to have any effect)
            Console.WriteLine("\'{0}\'", ZipPath); //Write every file zip path to console for debugging
            zip.CreateEntryFromFile(addonfilesfi.FullName, ZipPath, CompressionLevel.Optimal); // Use the extension method from System.IO.Compression.FileSystem                            
        }
    }
    Console.WriteLine("Wrote {0}", addonpackagename);
}
#endregion

The output of this piece of code looks like this:

Code:
'repository.erayan.addons/addon.xml'
Wrote repository.erayan.addons-1.0.4.zip

EDIT: Ofcourse my Kodi got scared after I posted this and now all seems well..
Reply

Logout Mark Read Team Forum Stats Members Help
Install from Zip: Zip format errors0