private static CustomAssemblyResolver GetAssemblyResolver(string path) { var mdr = new CustomAssemblyResolver(); var paths = mdr.GetSearchDirectories(); foreach (var p in paths) { mdr.RemoveSearchDirectory(p); } mdr.AddSearchDirectory(path); return(mdr); }
private static CustomAssemblyResolver GetAssemblyResolver(string path) { var mdr = new CustomAssemblyResolver(); var paths = mdr.GetSearchDirectories(); foreach(var p in paths) mdr.RemoveSearchDirectory(p); mdr.AddSearchDirectory(path); return mdr; }
private IEnumerable<Change<MethodReference>> GetChangesForAssembly(string filename, CustomAssemblyResolver resolver) { var detector = new ChangeDetector(); var assmName = Path.GetFileNameWithoutExtension(filename); var path = Path.GetDirectoryName(filename); resolver.SetNewSearchDirectoryTo(path); //foreach (var module in newAssembly.Modules) // module.ReadSymbols(); var historyFilename = GetHistoryFilename(filename); IEnumerable<Change<MethodReference>> changes = new List<Change<MethodReference>>(); if (IsSameFile(filename, historyFilename)) { InvokeMinimizerMessage(MessageType.Info, filename + " and " + GetHistoryFilename(filename) + " appear to be the same. skipping."); return changes; } var newAssembly = resolver.Resolve(assmName); if (File.Exists(historyFilename)) { var oldAssembly = resolver.Resolve(assmName + ".mm"); InvokeMinimizerMessage(MessageType.Info, "between " + oldAssembly.FullName + " and " + newAssembly.FullName); InvokeMinimizerMessage(MessageType.Info, "detecting changes between " + historyFilename + " and " + filename); changes = detector.GetChangesBetween(oldAssembly, newAssembly); oldAssembly.Dispose(); } else { //TODO this should mark everything as being an additive change! InvokeMinimizerMessage(MessageType.Info, "history file " + historyFilename + " does not exist."); } return changes; }
private IEnumerable <Change <MethodReference> > GetChangesForAssembly(string filename, CustomAssemblyResolver resolver) { var detector = new ChangeDetector(); var assmName = Path.GetFileNameWithoutExtension(filename); var path = Path.GetDirectoryName(filename); resolver.SetNewSearchDirectoryTo(path); //foreach (var module in newAssembly.Modules) // module.ReadSymbols(); var historyFilename = GetHistoryFilename(filename); IEnumerable <Change <MethodReference> > changes = new List <Change <MethodReference> >(); if (IsSameFile(filename, historyFilename)) { InvokeMinimizerMessage(MessageType.Info, filename + " and " + GetHistoryFilename(filename) + " appear to be the same. skipping."); return(changes); } var newAssembly = resolver.Resolve(assmName); if (File.Exists(historyFilename)) { var oldAssembly = resolver.Resolve(assmName + ".mm"); InvokeMinimizerMessage(MessageType.Info, "between " + oldAssembly.FullName + " and " + newAssembly.FullName); InvokeMinimizerMessage(MessageType.Info, "detecting changes between " + historyFilename + " and " + filename); changes = detector.GetChangesBetween(oldAssembly, newAssembly); oldAssembly.Dispose(); } else { //TODO this should mark everything as being an additive change! InvokeMinimizerMessage(MessageType.Info, "history file " + historyFilename + " does not exist."); } return(changes); }