using System.Collections;
using System.Resources;
using System.Reflection;
+using System.Xml;
class ResGen {
}
static void Usage () {
-#if NET_2_0
- string Usage = @"Mono Resource Generator version " + Consts.MonoVersion +
- @" for the 2.0 profile
-Usage:
- resgen2 source.ext [dest.ext]
- resgen2 [options] /compile source.ext[,dest.resources] [...]";
-#else
+
string Usage = @"Mono Resource Generator version " + Consts.MonoVersion +
- @" for the 1.0 profile
+ @"
Usage:
resgen source.ext [dest.ext]
- resgen /compile source.ext[,dest.resources] [...]";
-#endif
+ resgen [options] /compile source.ext[,dest.resources] [...]";
Usage += @"
Convert a resource file from one format to another.
The currently supported formats are: '.txt' '.resources' '.resx' '.po'.
If the destination file is not specified, source.resources will be used.";
-#if NET_2_0
+
Usage += @"
Options:
-usesourcepath, /useSourcePath
to resolve relative file paths, use the directory of the resource
file as current directory.";
-#else
- Usage += @"
-The /compile option takes a list of .resX or .txt files to convert to
-.resources files in one bulk operation, replacing .ext with .resources for
-the output file name (if not set).";
-#endif
Usage += @"
";
Console.WriteLine( Usage );
} catch (Exception e) {
Console.WriteLine ("Error: {0}", e.Message);
Exception inner = e.InnerException;
+
+ // under 2.0 ResXResourceReader can wrap an exception into an XmlException
+ // and this hides some helpful message from the original exception
+ XmlException xex = (inner as XmlException);
+ if (xex != null) {
+ // message is identical to the inner exception (from MWF ResXResourceReader)
+ Console.WriteLine ("Position: Line {0}, Column {1}.", xex.LineNumber, xex.LinePosition);
+ inner = inner.InnerException;
+ }
+
if (inner is TargetInvocationException && inner.InnerException != null)
inner = inner.InnerException;
if (inner != null)
}
compileMultiple = true;
break;
-#if NET_2_0
+
case "/usesourcepath":
case "-usesourcepath":
if (compileMultiple) {
}
useSourcePath = true;
break;
-#endif
+
default:
if (!IsFileArgument (args [i])) {
Usage ();
// check for Unix platforms - see FAQ for more details
// http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
int platform = (int) Environment.OSVersion.Platform;
- return ((platform == 4) || (platform == 128));
+ return ((platform == 4) || (platform == 128) || (platform == 6));
}
}
case 't':
b.Append ('\t');
break;
-#if NET_2_0
case 'u':
int ch = int.Parse (value.Substring (++i, 4), NumberStyles.HexNumber);
b.Append (char.ConvertFromUtf32 (ch));
i += 3;
break;
-#endif
case '\\':
b.Append ('\\');
break;