You've already forked linux-packaging-mono
Imported Upstream version 5.2.0.175
Former-commit-id: bb0468d0f257ff100aa895eb5fe583fb5dfbf900
This commit is contained in:
parent
4bdbaf4a88
commit
966bba02bb
@ -15,32 +15,12 @@ using System.IO;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Resources;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
|
||||
class ResGen {
|
||||
|
||||
static Assembly swf;
|
||||
static Type resxr;
|
||||
static Type resxw;
|
||||
static HashSet<string> symbols = new HashSet<string> ();
|
||||
|
||||
/*
|
||||
* We load the ResX format stuff on demand, since the classes are in
|
||||
* System.Windows.Forms (!!!) and we can't depend on that assembly in mono, yet.
|
||||
*/
|
||||
static void LoadResX () {
|
||||
if (swf != null)
|
||||
return;
|
||||
try {
|
||||
swf = Assembly.Load (Consts.AssemblySystem_Windows_Forms);
|
||||
resxr = swf.GetType ("System.Resources.ResXResourceReader");
|
||||
resxw = swf.GetType ("System.Resources.ResXResourceWriter");
|
||||
} catch (Exception e) {
|
||||
throw new Exception ("Cannot load support for ResX format: " + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
static void Usage () {
|
||||
|
||||
string Usage = @"Mono Resource Generator version " + Consts.MonoVersion +
|
||||
@ -91,16 +71,8 @@ Options:
|
||||
case ".resources":
|
||||
return new ResourceReader (stream);
|
||||
case ".resx":
|
||||
LoadResX ();
|
||||
IResourceReader reader = (IResourceReader) Activator.CreateInstance (
|
||||
resxr, new object[] {stream});
|
||||
if (useSourcePath) { // only possible on 2.0 profile, or higher
|
||||
PropertyInfo p = reader.GetType ().GetProperty ("BasePath",
|
||||
BindingFlags.Public | BindingFlags.Instance);
|
||||
if (p != null && p.CanWrite) {
|
||||
p.SetValue (reader, Path.GetDirectoryName (name), null);
|
||||
}
|
||||
}
|
||||
var reader = new ResXResourceReader (stream);
|
||||
reader.BasePath = Path.GetDirectoryName (name);
|
||||
return reader;
|
||||
default:
|
||||
throw new Exception ("Unknown format in file " + name);
|
||||
@ -118,8 +90,7 @@ Options:
|
||||
case ".resources":
|
||||
return new ResourceWriter (stream);
|
||||
case ".resx":
|
||||
LoadResX ();
|
||||
return (IResourceWriter)Activator.CreateInstance (resxw, new object[] {stream});
|
||||
return new ResXResourceWriter (stream);
|
||||
default:
|
||||
throw new Exception ("Unknown format in file " + name);
|
||||
}
|
||||
@ -165,7 +136,7 @@ Options:
|
||||
inner = inner.InnerException;
|
||||
}
|
||||
|
||||
if (inner is TargetInvocationException && inner.InnerException != null)
|
||||
if (inner is System.Reflection.TargetInvocationException && inner.InnerException != null)
|
||||
inner = inner.InnerException;
|
||||
if (inner != null)
|
||||
Console.WriteLine ("Inner exception: {0}", inner.Message);
|
||||
|
Reference in New Issue
Block a user