Aujourd'hui, j'ai eu un problème en créant un nouveau créateur de thème pour le chrome. Comme vous le savez, Chrome utilise un "nouveau" format de fichier, appelé CRX, pour gérer ses plugins et ses thèmes. Il est un fichier zip de base, mais un peu modifié:Comment remplacer les appels openSSL par du code C#?
"CR24" + derkey + signature + ZipFile
Et voilà le problème. Il n'y a que deux créateurs CRX, écrits en Ruby ou en Python. Je ne connais pas trop la langue (j'avais une expérience de base en Python, mais surtout avec PyS60), donc je voudrais vous demander de m'aider à convertir cette application python en un code C# qui ne dépend pas de programmes externes .
De plus, voici la source de crxmake.py:
#!/usr/bin/python
# Cribbed from http://github.com/Constellation/crxmake/blob/master/lib/crxmake.rb
# and http://src.chromium.org/viewvc/chrome/trunk/src/chrome/tools/extensions/chromium_extension.py?revision=14872&content-type=text/plain&pathrev=14872
# from: http://grack.com/blog/2009/11/09/packing-chrome-extensions-in-python/
import sys
from array import *
from subprocess import *
import os
import tempfile
def main(argv):
arg0,dir,key,output = argv
# zip up the directory
input = dir + ".zip"
if not os.path.exists(input):
os.system("cd %(dir)s; zip -r ../%(input)s . -x '.svn/*'" % locals())
else:
print "'%s' already exists using it" % input
# Sign the zip file with the private key in PEM format
signature = Popen(["openssl", "sha1", "-sign", key, input], stdout=PIPE).stdout.read();
# Convert the PEM key to DER (and extract the public form) for inclusion in the CRX header
derkey = Popen(["openssl", "rsa", "-pubout", "-inform", "PEM", "-outform", "DER", "-in", key], stdout=PIPE).stdout.read();
out=open(output, "wb");
out.write("Cr24") # Extension file magic number
header = array("l");
header.append(2); # Version 2
header.append(len(derkey));
header.append(len(signature));
header.tofile(out);
out.write(derkey)
out.write(signature)
out.write(open(input).read())
os.unlink(input)
print "Done."
if __name__ == '__main__':
main(sys.argv)
S'il vous plaît pourriez-vous me aider?