mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-18 03:51:19 -10:00
Compare commits
23
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
751e0fa359 | ||
|
|
07e600d669 | ||
|
|
bcb86f00d6 | ||
|
|
72ebbaf68c | ||
|
|
71a247b91b | ||
|
|
594e8fd07c | ||
|
|
616caad4e2 | ||
|
|
e36b27c948 | ||
|
|
31a1ccaab9 | ||
|
|
08f9819131 | ||
|
|
2bb3416919 | ||
|
|
721a8021ef | ||
|
|
d2d6def464 | ||
|
|
46f86234a8 | ||
|
|
6d2840038b | ||
|
|
6a4a74c828 | ||
|
|
d6946b42e4 | ||
|
|
e4f44c127c | ||
|
|
102a6818db | ||
|
|
67aef17d51 | ||
|
|
dd3c837c44 | ||
|
|
49f82f4fee | ||
|
|
693aa8a48b |
No files matched your search
+1
-1
@@ -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)
|
||||
|
||||
@@ -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>");
|
||||
|
||||
@@ -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 ();
|
||||
}
|
||||
|
||||
@@ -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
@@ -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;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user