Compare commits

...
23 Commits
Author SHA1 Message Date
Sebastien Pouliot 751e0fa359 Merge branch 'mono-4.0.0-branch-c5sr4' into xcode7-c5 2015-09-14 09:04:35 -04:00
Rolf Bjarne Kvinge 07e600d669 [mono-api-html] Adding members to an interface is a breaking change, so show it in red. 2015-09-09 11:04:52 -04:00
Rolf Bjarne Kvinge bcb86f00d6 [mono-api-info] Sort constructors using full signature.
So that info files can be compared textually to test for api equality.
2015-09-09 11:02:34 -04:00
Rolf Bjarne Kvinge 72ebbaf68c [mono-api-html] Fix printing of Obsolete attributes. 2015-09-08 20:43:20 -04:00
Rolf Bjarne Kvinge 71a247b91b [mono-api-info] Sort nested types.
So that info files can be compared textually to test for api equality.
2015-09-08 20:43:09 -04:00
Rolf Bjarne Kvinge 594e8fd07c [mono-api-info] Sort methods using full signature.
So that info files can be compared textually to test for api equality.
2015-09-08 20:43:01 -04:00
Rolf Bjarne Kvinge 616caad4e2 [mdbrebase] Make sure to use a unique temporary filename.
Otherwise parallel invocations might end up stomping on eachother
(these two files are processed in parallel):

    Processing /work/maccore/master/maccore/builds/install/mac/xammac/bcl/mscorlib.dll.mdb
    Processing /work/maccore/master/maccore/builds/install/mac/net_4_5/bcl/mscorlib.dll.mdb

    Unhandled Exception:
    System.IO.FileNotFoundException: /var/folders/g9/k5kx4z211ld_lwlbfxv5rq040000gn/T/mscorlib.dll.mdb does not exist
    File name: '/var/folders/g9/k5kx4z211ld_lwlbfxv5rq040000gn/T/mscorlib.dll.mdb'
      at System.IO.File.Move (System.String sourceFileName, System.String destFileName) [0x00000] in <filename unknown>:0
      at Mono.MdbRebase.MdbRebase.RewriteMdbFile (System.String inputFile) [0x00000] in <filename unknown>:0
      at Mono.MdbRebase.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0
    [ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: /var/folders/g9/k5kx4z211ld_lwlbfxv5rq040000gn/T/mscorlib.dll.mdb does not exist
    File name: '/var/folders/g9/k5kx4z211ld_lwlbfxv5rq040000gn/T/mscorlib.dll.mdb'
      at System.IO.File.Move (System.String sourceFileName, System.String destFileName) [0x00000] in <filename unknown>:0
      at Mono.MdbRebase.MdbRebase.RewriteMdbFile (System.String inputFile) [0x00000] in <filename unknown>:0
      at Mono.MdbRebase.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0
2015-08-24 19:43:10 -04:00
Rolf Bjarne Kvinge e36b27c948 [mdbrebase] Add a quiet mode. 2015-08-24 19:42:56 -04:00
Rolf Bjarne Kvinge 31a1ccaab9 [mdbrebase] Indent properly. 2015-08-24 19:42:43 -04:00
Sebastien Pouliot 08f9819131 [tests] iOS9 (beta) have fixed bug #27864, adjust test 2015-08-24 19:12:09 -04:00
Sebastien Pouliot 2bb3416919 [linker] Fix comparison of methods wrt generic parameters [#30488]
The check from [1] is fine when it's done once _or_ with an identical
target. However there's nothing to ensure (if done more than once) that
it's being used to represent the same thing every time.

That makes the code from [1] match methods like:

> System.IObservable`1<TResult> System.Reactive.Linq.IQueryLanguage::Repeat(TResult)

and

> System.IObservable`1<TSource> System.Reactive.Linq.QueryLanguage::Repeat(System.IObservable`1<TSource>)

where `TResult` is different in both checks.

This patch tracks what is used as the generic parameter (on first check)
and make sure it's identical if it's used again in the same signature.

Note: this is a very old bug (i.e. it's always been that way) but recent
changes to mono started to report such issues (a good thing) and, for AOT
compilation on XI, that resulted in MT3001 errors.

[1] https://github.com/mono/mono/blob/mono-3.10.0/mcs/tools/linker/Mono.Linker.Steps/TypeMapStep.cs#L250
2015-08-24 19:11:44 -04:00
Sebastien Pouliot 721a8021ef [linker] Add Mono.Cecil.*.Has* checks when comparing methods/types
* It reduce memory allocations by avoiding the creation of empty
  collections (only used to tell us there's a Count of 0);

* It also speed up execution, less object creation/GC time;

* Patch also remove some double-casts (is + as/cast)
2015-08-24 19:11:40 -04:00
Sebastien Pouliot d2d6def464 [linker] Fix scope resolution of custom attributes (generic/array) argument types that refers to PCL facades [#28823] 2015-08-24 16:25:48 -04:00
Rolf Bjarne Kvinge 46f86234a8 Build an initial version of System.Net.Http.dll for monotouch as part of the regular BCL build.
We have Facade assemblies that depend on System.Net.Http.dll to exist, so
we can't delay building it (at least one version of it).
2015-08-21 16:30:54 -04:00
Sebastien Pouliot 6d2840038b Revert "Build an initial version of System.Net.Http.dll for monotouch as part of the regular BCL build."
This reverts commit 6a4a74c828.
2015-08-21 16:26:15 -04:00
Rolf Bjarne Kvinge 6a4a74c828 Build an initial version of System.Net.Http.dll for monotouch as part of the regular BCL build.
We have Facade assemblies that depend on System.Net.Http.dll to exist, so
we can't delay building it (at least one version of it).
2015-08-21 15:25:38 -04:00
Zoltan Varga d6946b42e4 [runtime] Handle generic methods in mono_method_get_vtable_slot (). Fixes #30276. 2015-07-29 14:21:32 -04:00
Alexander Köplinger e4f44c127c [runtime] Fix "make distcheck"
Use $(srcdir) instead of ./ for commands so the path is correct.
Also added missing files to EXTRA_DIST.
2015-07-20 01:14:28 -04:00
Alexis Christoforides 102a6818db [System.IO.KeventWatcher] Disable the watcher when the root directory is deleted. Fixes #30043
This matches MS.NET behavior.
2015-07-20 00:37:51 -04:00
Zoltan Varga 67aef17d51 [arm] Increase the number of stack args to 10 in the dyn call code. Fixes #31060. 2015-07-16 11:10:21 +02:00
Rodrigo Kumpera dd3c837c44 [utils] Add fallback TLS offset scanning to X86 and AMD64. 2015-07-13 14:10:06 -05:00
Craig S. Bosma 49f82f4fee Add TLS offset for pre-release OS X 10.11 x86, as in #1919 for x64 2015-07-13 14:09:56 -05:00
Craig S. Bosma 693aa8a48b Add TLS offset for pre-release OS X 10.11 on amd64 2015-07-13 14:09:46 -05:00
8 changed files with 216 additions and 203 deletions

No files matched your search

+1 -1
View File
@@ -44,6 +44,7 @@ mobile_common_dirs := \
System.ComponentModel.DataAnnotations \
System.ComponentModel.Composition.4.5 \
System.Net \
System.Net.Http \
System.Windows \
System.Xml.Serialization \
Mono.CSharp \
@@ -57,7 +58,6 @@ mobile_static_dirs := \
mobile_dynamic_dirs := \
$(mobile_common_dirs) \
Mono.CompilerServices.SymbolWriter \
System.Net.Http
xammac_dirs := \
$(mobile_dynamic_dirs)
+3 -5
View File
@@ -92,14 +92,12 @@ namespace MonoTests.Mono.Data.Sqlite {
Assert.AreEqual(dr["Company.Name"], "Test CO");
i += 2;
}
Assert.IsTrue(dr.FieldCount>0);
Assert.IsTrue(dr.FieldCount>0, i.ToString ());
}
if (BCL.Tests.TestRuntime.CheckSystemVersion (8, 2))
Assert.IsTrue (false, "Apple fixed bug 27864, this check can now be removed");
}
} catch (SqliteException ex) {
if (BCL.Tests.TestRuntime.CheckSystemVersion (8, 2)) // Expected Exception on iOS 8.2+, if this does not happen anymore it means apple fixed it
// Expected Exception from iOS 8.2 (broken) to 9.0 (fixed)
if (BCL.Tests.TestRuntime.CheckSystemVersion (8,2) && !BCL.Tests.TestRuntime.CheckSystemVersion (9,0))
Assert.That (ex.Message.Contains ("no such column: com.Name"));
else
throw new AssertionException ("Unexpected Sqlite Error", ex); // This should not happen
@@ -1,54 +0,0 @@
../../build/common/Consts.cs
Assembly/AssemblyInfo.cs
System.Net.Http/ByteArrayContent.cs
System.Net.Http/ClientCertificateOption.cs
System.Net.Http/DelegatingHandler.cs
System.Net.Http/FormUrlEncodedContent.cs
System.Net.Http/HttpClient.cs
System.Net.Http/HttpClientHandler.cs
System.Net.Http/HttpCompletionOption.cs
System.Net.Http/HttpContent.cs
System.Net.Http/HttpMessageHandler.cs
System.Net.Http/HttpMessageInvoker.cs
System.Net.Http/HttpMethod.cs
System.Net.Http/HttpRequestException.cs
System.Net.Http/HttpRequestMessage.cs
System.Net.Http/HttpResponseMessage.cs
System.Net.Http/MessageProcessingHandler.cs
System.Net.Http/MultipartContent.cs
System.Net.Http/MultipartFormDataContent.cs
System.Net.Http/StreamContent.cs
System.Net.Http/StringContent.cs
System.Net.Http.Headers/AuthenticationHeaderValue.cs
System.Net.Http.Headers/CacheControlHeaderValue.cs
System.Net.Http.Headers/CollectionExtensions.cs
System.Net.Http.Headers/CollectionParser.cs
System.Net.Http.Headers/ContentDispositionHeaderValue.cs
System.Net.Http.Headers/ContentRangeHeaderValue.cs
System.Net.Http.Headers/EntityTagHeaderValue.cs
System.Net.Http.Headers/HashCodeCalculator.cs
System.Net.Http.Headers/HeaderInfo.cs
System.Net.Http.Headers/HttpContentHeaders.cs
System.Net.Http.Headers/HttpHeaderKind.cs
System.Net.Http.Headers/HttpHeaders.cs
System.Net.Http.Headers/HttpHeaderValueCollection.cs
System.Net.Http.Headers/HttpRequestHeaders.cs
System.Net.Http.Headers/HttpResponseHeaders.cs
System.Net.Http.Headers/Lexer.cs
System.Net.Http.Headers/MediaTypeHeaderValue.cs
System.Net.Http.Headers/MediaTypeWithQualityHeaderValue.cs
System.Net.Http.Headers/NameValueHeaderValue.cs
System.Net.Http.Headers/NameValueWithParametersHeaderValue.cs
System.Net.Http.Headers/Parser.cs
System.Net.Http.Headers/ProductHeaderValue.cs
System.Net.Http.Headers/ProductInfoHeaderValue.cs
System.Net.Http.Headers/QualityValue.cs
System.Net.Http.Headers/RangeConditionHeaderValue.cs
System.Net.Http.Headers/RangeHeaderValue.cs
System.Net.Http.Headers/RangeItemHeaderValue.cs
System.Net.Http.Headers/RetryConditionHeaderValue.cs
System.Net.Http.Headers/StringWithQualityHeaderValue.cs
System.Net.Http.Headers/TransferCodingHeaderValue.cs
System.Net.Http.Headers/TransferCodingWithQualityHeaderValue.cs
System.Net.Http.Headers/ViaHeaderValue.cs
System.Net.Http.Headers/WarningHeaderValue.cs
@@ -61,6 +61,16 @@ namespace Xamarin.ApiDiff {
{
}
string GetContainingType (XElement el)
{
return el.Ancestors ("class").First ().Attribute ("type").Value;
}
bool IsInInterface (XElement el)
{
return GetContainingType (el) == "interface";
}
public XElement Source { get; set; }
public virtual bool Find (XElement e)
@@ -182,9 +192,10 @@ namespace Xamarin.ApiDiff {
public virtual void BeforeAdding (IEnumerable<XElement> list)
{
first = true;
Output.WriteLine ("<p>Added {0}:</p><pre>", list.Count () > 1 ? GroupName : ElementName);
if (State.Colorize)
Output.Write ("<font color='green'>");
Output.WriteLine ("<p>Added {0}:</p>", list.Count () > 1 ? GroupName : ElementName);
bool isInterface = list.Count () > 0 && IsInInterface (list.First ());
Output.WriteLine (State.Colorize ? string.Format ("<pre style='color: {0}'>", isInterface ? "red" : "green") : "<pre>");
}
public override void Added (XElement target)
@@ -546,7 +557,7 @@ namespace Xamarin.ApiDiff {
change.Append ("[Obsolete (");
if (tgtObsolete != string.Empty)
change.Append ("\"").Append (tgtObsolete).Append ("\"");
change.Append ("]\n");
change.Append (")]\n");
change.Append (GetDescription (target));
if (State.Colorize)
change.Append ("</font>");
+7 -5
View File
@@ -228,7 +228,7 @@ namespace CorCompare
var typesCollection = ass.MainModule.Types;
if (typesCollection == null || typesCollection.Count == 0)
return;
object [] typesArray = new object [typesCollection.Count];
var typesArray = new TypeDefinition [typesCollection.Count];
for (int i = 0; i < typesCollection.Count; i++) {
typesArray [i] = typesCollection [i];
}
@@ -454,7 +454,7 @@ namespace CorCompare
MethodDefinition [] ctors = GetConstructors (type);
if (ctors.Length > 0) {
Array.Sort (ctors, MemberReferenceComparer.Default);
Array.Sort (ctors, MethodDefinitionComparer.Default);
members.Add (new ConstructorData (document, nclass, ctors));
}
@@ -472,7 +472,7 @@ namespace CorCompare
MethodDefinition [] methods = GetMethods (type);
if (methods.Length > 0) {
Array.Sort (methods, MemberReferenceComparer.Default);
Array.Sort (methods, MethodDefinitionComparer.Default);
members.Add (new MethodData (document, nclass, methods));
}
}
@@ -495,11 +495,13 @@ namespace CorCompare
nested.RemoveAt (i);
}
if (nested.Count > 0) {
var nestedArray = nested.ToArray ();
Array.Sort (nestedArray, TypeReferenceComparer.Default);
XmlNode classes = document.CreateElement ("classes", null);
nclass.AppendChild (classes);
foreach (TypeDefinition t in nested) {
foreach (TypeDefinition t in nestedArray) {
TypeData td = new TypeData (document, classes, t);
td.DoOutput ();
}
+18 -2
View File
@@ -346,9 +346,25 @@ namespace Mono.Linker.Steps {
// even if we (just before saving) will resolve all type references (bug #26752)
void MarkWithResolvedScope (TypeReference type)
{
// we cannot set the Scope of a TypeSpecification so there's no point in resolving it
if ((type == null) || (type is TypeSpecification))
if (type == null)
return;
// a GenericInstanceType can could contains generic arguments with scope that
// needs to be updated out of the PCL facade (bug #28823)
var git = (type as GenericInstanceType);
if ((git != null) && git.HasGenericArguments) {
foreach (var ga in git.GenericArguments)
MarkWithResolvedScope (ga);
return;
}
// we cannot set the Scope of a TypeSpecification but it's element type can be set
// e.g. System.String[] -> System.String
var ts = (type as TypeSpecification);
if (ts != null) {
MarkWithResolvedScope (ts.GetElementType ());
return;
}
var td = type.Resolve ();
if (td != null)
type.Scope = td.Scope;
@@ -179,81 +179,118 @@ namespace Mono.Linker.Steps {
if (!type.HasMethods)
return null;
foreach (MethodDefinition candidate in type.Methods)
if (MethodMatch (candidate, method))
Dictionary<string,string> gp = null;
foreach (MethodDefinition candidate in type.Methods) {
if (MethodMatch (candidate, method, ref gp))
return candidate;
if (gp != null)
gp.Clear ();
}
return null;
}
static bool MethodMatch (MethodDefinition candidate, MethodDefinition method)
static bool MethodMatch (MethodDefinition candidate, MethodDefinition method, ref Dictionary<string,string> genericParameters)
{
if (!candidate.IsVirtual)
return false;
if (candidate.HasParameters != method.HasParameters)
return false;
if (candidate.Name != method.Name)
return false;
if (!TypeMatch (candidate.ReturnType, method.ReturnType))
if (candidate.HasGenericParameters != method.HasGenericParameters)
return false;
if (candidate.Parameters.Count != method.Parameters.Count)
// we need to track what the generic parameter represent - as we cannot allow it to
// differ between the return type or any parameter
if (!TypeMatch (candidate.ReturnType, method.ReturnType, ref genericParameters))
return false;
for (int i = 0; i < candidate.Parameters.Count; i++)
if (!TypeMatch (candidate.Parameters [i].ParameterType, method.Parameters [i].ParameterType))
if (!candidate.HasParameters)
return true;
var cp = candidate.Parameters;
var mp = method.Parameters;
if (cp.Count != mp.Count)
return false;
for (int i = 0; i < cp.Count; i++) {
if (!TypeMatch (cp [i].ParameterType, mp [i].ParameterType, ref genericParameters))
return false;
}
return true;
}
static bool TypeMatch (IModifierType a, IModifierType b)
static bool TypeMatch (IModifierType a, IModifierType b, ref Dictionary<string,string> gp)
{
if (!TypeMatch (a.ModifierType, b.ModifierType))
if (!TypeMatch (a.ModifierType, b.ModifierType, ref gp))
return false;
return TypeMatch (a.ElementType, b.ElementType);
return TypeMatch (a.ElementType, b.ElementType, ref gp);
}
static bool TypeMatch (TypeSpecification a, TypeSpecification b)
static bool TypeMatch (TypeSpecification a, TypeSpecification b, ref Dictionary<string,string> gp)
{
if (a is GenericInstanceType)
return TypeMatch ((GenericInstanceType) a, (GenericInstanceType) b);
var gita = a as GenericInstanceType;
if (gita != null)
return TypeMatch (gita, (GenericInstanceType) b, ref gp);
if (a is IModifierType)
return TypeMatch ((IModifierType) a, (IModifierType) b);
var mta = a as IModifierType;
if (mta != null)
return TypeMatch (mta, (IModifierType) b, ref gp);
return TypeMatch (a.ElementType, b.ElementType);
return TypeMatch (a.ElementType, b.ElementType, ref gp);
}
static bool TypeMatch (GenericInstanceType a, GenericInstanceType b)
static bool TypeMatch (GenericInstanceType a, GenericInstanceType b, ref Dictionary<string,string> gp)
{
if (!TypeMatch (a.ElementType, b.ElementType))
if (!TypeMatch (a.ElementType, b.ElementType, ref gp))
return false;
if (a.GenericArguments.Count != b.GenericArguments.Count)
if (a.HasGenericArguments != b.HasGenericArguments)
return false;
if (a.GenericArguments.Count == 0)
if (!a.HasGenericArguments)
return true;
for (int i = 0; i < a.GenericArguments.Count; i++)
if (!TypeMatch (a.GenericArguments [i], b.GenericArguments [i]))
var gaa = a.GenericArguments;
var gab = b.GenericArguments;
if (gaa.Count != gab.Count)
return false;
for (int i = 0; i < gaa.Count; i++) {
if (!TypeMatch (gaa [i], gab [i], ref gp))
return false;
}
return true;
}
static bool TypeMatch (TypeReference a, TypeReference b)
static bool TypeMatch (TypeReference a, TypeReference b, ref Dictionary<string,string> gp)
{
if (a is GenericParameter)
return true;
var gpa = a as GenericParameter;
if (gpa != null) {
if (gp == null)
gp = new Dictionary<string, string> ();
string match;
if (!gp.TryGetValue (gpa.FullName, out match)) {
// first use, we assume it will always be used this way
gp.Add (gpa.FullName, b.ToString ());
return true;
}
// re-use, it should match the previous usage
return match == b.ToString ();
}
if (a is TypeSpecification || b is TypeSpecification) {
if (a.GetType () != b.GetType ())
return false;
return TypeMatch ((TypeSpecification) a, (TypeSpecification) b);
return TypeMatch ((TypeSpecification) a, (TypeSpecification) b, ref gp);
}
return a.FullName == b.FullName;
+109 -106
View File
@@ -11,130 +11,133 @@ using Mono.Options;
namespace Mono.MdbRebase
{
class Settings
{
public string OutputDirectory { get; set; }
public string InputPattern { get; set; }
public string OutputPattern { get; set; }
public bool InputPatternIsRegex { get; set; }
public bool FileNamesOnly { get; set; }
public bool Verbose { get; set; }
Regex inputPatternRegex;
public bool Validate ()
class Settings
{
return InputPattern != null && OutputPattern != null;
public string OutputDirectory { get; set; }
public string InputPattern { get; set; }
public string OutputPattern { get; set; }
public bool InputPatternIsRegex { get; set; }
public bool FileNamesOnly { get; set; }
public bool Verbose { get; set; }
public bool Quiet { get; set; }
Regex inputPatternRegex;
public bool Validate ()
{
return InputPattern != null && OutputPattern != null;
}
public string Replace (string input)
{
if (InputPatternIsRegex) {
if (inputPatternRegex == null)
inputPatternRegex = new Regex (InputPattern);
return inputPatternRegex.Replace (input, OutputPattern);
} else {
if (input.StartsWith (InputPattern))
return OutputPattern + input.Substring (InputPattern.Length);
}
return input;
}
}
public string Replace (string input)
class MdbRebase
{
if (InputPatternIsRegex) {
if (inputPatternRegex == null)
inputPatternRegex = new Regex (InputPattern);
return inputPatternRegex.Replace (input, OutputPattern);
} else {
if (input.StartsWith (InputPattern))
return OutputPattern + input.Substring (InputPattern.Length);
Settings settings;
public MdbRebase (Settings settings)
{
this.settings = settings;
}
return input;
}
}
public void RewriteMdbFile (string inputFile)
{
if (!settings.Quiet)
Console.WriteLine ("Processing {0}", inputFile);
var input = MonoSymbolFile.ReadSymbolFile (inputFile);
class MdbRebase
{
Settings settings;
var output = new MonoSymbolFile ();
public MdbRebase (Settings settings)
{
this.settings = settings;
}
foreach (var s in input.Sources) {
var newFileName = settings.FileNamesOnly
? Path.Combine (Path.GetDirectoryName (s.FileName), settings.Replace (Path.GetFileName (s.FileName)))
: settings.Replace (s.FileName);
public void RewriteMdbFile (string inputFile)
{
Console.WriteLine ("Processing {0}", inputFile);
var input = MonoSymbolFile.ReadSymbolFile (inputFile);
if (settings.Verbose)
Console.WriteLine ("{0} -> {1}", s.FileName, newFileName);
var output = new MonoSymbolFile ();
s.FileName = newFileName;
output.AddSource (s);
}
foreach (var s in input.Sources) {
var newFileName = settings.FileNamesOnly
? Path.Combine (Path.GetDirectoryName (s.FileName), settings.Replace (Path.GetFileName (s.FileName)))
: settings.Replace (s.FileName);
if (settings.Verbose)
Console.WriteLine ("{0} -> {1}", s.FileName, newFileName);
s.FileName = newFileName;
output.AddSource (s);
}
foreach (var cu in input.CompileUnits) {
cu.ReadAll ();
output.AddCompileUnit (cu);
}
foreach (var m in input.Methods) {
m.ReadAll ();
output.AddMethod (m);
}
var mdbName = new FileInfo (inputFile).Name;
var tmpMdb = Path.Combine (Path.GetTempPath (), mdbName);
var finalMdb = inputFile;
if (settings.OutputDirectory != null)
finalMdb = Path.Combine (settings.OutputDirectory, mdbName);
using (var stream = new FileStream (tmpMdb, FileMode.Create)) {
output.CreateSymbolFile (input.Guid, stream);
}
input.Dispose ();
File.Delete (finalMdb);
File.Move (tmpMdb, finalMdb);
}
}
class Driver {
static void Usage (OptionSet options)
{
Console.WriteLine (@"Usage: mdbrebase [options] <ASSEMBLY_TO_FIX>");
if (options != null) {
Console.WriteLine ();
Console.WriteLine ("Available options:");
options.WriteOptionDescriptions (Console.Out);
}
Console.WriteLine ();
foreach (var cu in input.CompileUnits) {
cu.ReadAll ();
output.AddCompileUnit (cu);
}
Environment.Exit (-1);
foreach (var m in input.Methods) {
m.ReadAll ();
output.AddMethod (m);
}
var mdbName = new FileInfo (inputFile).Name;
var tmpMdb = Path.GetTempFileName ();
var finalMdb = inputFile;
if (settings.OutputDirectory != null)
finalMdb = Path.Combine (settings.OutputDirectory, mdbName);
using (var stream = new FileStream (tmpMdb, FileMode.Create)) {
output.CreateSymbolFile (input.Guid, stream);
}
input.Dispose ();
File.Delete (finalMdb);
File.Move (tmpMdb, finalMdb);
}
}
static int Main (string[] args) {
var s = new Settings ();
bool showHelp = false;
class Driver {
static void Usage (OptionSet options)
{
Console.WriteLine (@"Usage: mdbrebase [options] <ASSEMBLY_TO_FIX>");
if (options != null) {
Console.WriteLine ();
Console.WriteLine ("Available options:");
options.WriteOptionDescriptions (Console.Out);
}
Console.WriteLine ();
Environment.Exit (-1);
}
var p = new OptionSet () {
{ "d=|output=", "Output directory to the mdb file, replace existing one if ommited", v => s.OutputDirectory = v },
{ "v|verbose", "Be verbose with output (show individual path rewrites)", v => s.Verbose = true },
{ "f|filenames", "Only operate on file names, not full absolute paths", v => s.FileNamesOnly = true },
{ "r|regex", "Input pattern is a regular expression", v => s.InputPatternIsRegex = true },
{ "i=|input-pattern=", "Input pattern to replace (must not be a prefix to output-pattern)(required)", v => s.InputPattern = v },
{ "o=|output-pattern=", "Output pattern to replace (required)", v => s.OutputPattern = v },
{ "h|?|help", v => showHelp = true },
};
static int Main (string[] args) {
var s = new Settings ();
bool showHelp = false;
List <string> extra = p.Parse (args);
var p = new OptionSet () {
{ "d=|output=", "Output directory to the mdb file, replace existing one if ommited", v => s.OutputDirectory = v },
{ "v|verbose", "Be verbose with output (show individual path rewrites)", v => s.Verbose = true },
{ "f|filenames", "Only operate on file names, not full absolute paths", v => s.FileNamesOnly = true },
{ "r|regex", "Input pattern is a regular expression", v => s.InputPatternIsRegex = true },
{ "i=|input-pattern=", "Input pattern to replace (must not be a prefix to output-pattern)(required)", v => s.InputPattern = v },
{ "o=|output-pattern=", "Output pattern to replace (required)", v => s.OutputPattern = v },
{ "q|quiet", "Be quiet with output (not show anything but errors)", v => s.Quiet = true },
{ "h|?|help", v => showHelp = true },
};
if (showHelp || extra.Count < 1 || !s.Validate ())
Usage (p);
List <string> extra = p.Parse (args);
var m = new MdbRebase (s);
foreach (var a in extra)
m.RewriteMdbFile (a);
return 0;
if (showHelp || extra.Count < 1 || !s.Validate ())
Usage (p);
var m = new MdbRebase (s);
foreach (var a in extra)
m.RewriteMdbFile (a);
return 0;
}
}
}
}