Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/ikvm-fork.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjfrijters <jfrijters>2013-02-17 11:15:48 +0400
committerjfrijters <jfrijters>2013-02-17 11:15:48 +0400
commit3c2b09a63484dc46ad8a81ccc41e2364588e3f9c (patch)
tree03bdc55fa2987a300091e08925a1e2a4b2232154
parenteccdd76000f02a363eb6324e292e1d9ab2b4e17a (diff)
Moved manifest parsing to a separate method.
-rw-r--r--ikvmc/Compiler.cs48
1 files changed, 28 insertions, 20 deletions
diff --git a/ikvmc/Compiler.cs b/ikvmc/Compiler.cs
index 5e1b7643..5592c172 100644
--- a/ikvmc/Compiler.cs
+++ b/ikvmc/Compiler.cs
@@ -1317,6 +1317,32 @@ sealed class IkvmcCompiler
return true;
}
+ private void ProcessManifest(CompilerOptions options, ZipFile zf, ZipEntry ze)
+ {
+ if (manifestMainClass == null)
+ {
+ // read main class from manifest
+ // TODO find out if we can use other information from manifest
+ StreamReader rdr = new StreamReader(zf.GetInputStream(ze));
+ string line;
+ while ((line = rdr.ReadLine()) != null)
+ {
+ if (line.StartsWith("Main-Class: "))
+ {
+ line = line.Substring(12);
+ string continuation;
+ while ((continuation = rdr.ReadLine()) != null
+ && continuation.StartsWith(" ", StringComparison.Ordinal))
+ {
+ line += continuation.Substring(1);
+ }
+ manifestMainClass = line.Replace('/', '.');
+ break;
+ }
+ }
+ }
+ }
+
private void ProcessZipFile(CompilerOptions options, string file, Predicate<ZipEntry> filter)
{
try
@@ -1343,27 +1369,9 @@ sealed class IkvmcCompiler
{
// if it's not a class, we treat it as a resource and the manifest
// is examined to find the Main-Class
- if (ze.Name == "META-INF/MANIFEST.MF" && manifestMainClass == null)
+ if (ze.Name == "META-INF/MANIFEST.MF")
{
- // read main class from manifest
- // TODO find out if we can use other information from manifest
- StreamReader rdr = new StreamReader(zf.GetInputStream(ze));
- string line;
- while ((line = rdr.ReadLine()) != null)
- {
- if (line.StartsWith("Main-Class: "))
- {
- line = line.Substring(12);
- string continuation;
- while ((continuation = rdr.ReadLine()) != null
- && continuation.StartsWith(" ", StringComparison.Ordinal))
- {
- line += continuation.Substring(1);
- }
- manifestMainClass = line.Replace('/', '.');
- break;
- }
- }
+ ProcessManifest(options, zf, ze);
}
options.AddResource(ze, ze.Name, ReadFromZip(zf, ze), jar);
}