public DerivedTypesTreeNode(AssemblyList list, TypeDefinition type) { this.list = list; this.type = type; this.LazyLoading = true; this.threading = new ThreadingSupport(); }
public AssemblyListTreeNode(AssemblyList assemblyList) { if (assemblyList == null) throw new ArgumentNullException("assemblyList"); this.assemblyList = assemblyList; BindToObservableCollection(); }
public override bool Execute() { HashSet<string> processedFileNames = new HashSet<string>(); AssemblyList corerun = new AssemblyList("Microsoft.NETCore.Runtime", "Microsoft.NETCore.TestHost", "Microsoft.NETCore.Windows.ApiSets"); AssemblyList xunit = new AssemblyList("xunit"); List<string> unmatched = new List<string>(); bool foundDuplicates = false; Stream inputListLocationStream = File.OpenRead(InputListLocation); Stream outputListLocationStream = File.OpenWrite(OutputListLocation); using (StreamReader listReader = new StreamReader(inputListLocationStream)) { string line; while ((line = listReader.ReadLine()) != null) { var fileName = Path.GetFileName(line); if (!processedFileNames.Add(fileName)) { Log.LogError("Duplicate assembly found: {0}", fileName); foundDuplicates = true; continue; } if (corerun.TryAdd(line)) { continue; } if (xunit.TryAdd(line)) { continue; } unmatched.Add(line); } } if (foundDuplicates) { return false; } Dictionary<string, List<string>> headers = new Dictionary<string, List<string>> { {"corerun", corerun.Dependencies}, {"xunit", xunit.Dependencies}, {"testdependency", unmatched}, }; using (StreamWriter listRewriter = new StreamWriter(outputListLocationStream)) using (JsonWriter jsonWriter = new JsonTextWriter(listRewriter)) { jsonWriter.Formatting = Formatting.Indented; JsonSerializer serializer = new JsonSerializer(); serializer.Serialize(jsonWriter, headers); } return true; }
public void CreateAssemblyList() { XmlDocument doc = new XmlDocument(); doc.LoadXml("<Config/>"); assemblies = new AssemblyList(doc.FirstChild); path1 = CleanPath("/tests/bin/debug/assembly1.dll"); path2 = CleanPath("/tests/bin/debug/assembly2.dll"); path3 = CleanPath("/tests/bin/debug/assembly3.dll"); }
public void CreateAssemblyList() { assemblies = new AssemblyList(); path1 = CleanPath("/tests/bin/debug/assembly1.dll"); path2 = CleanPath("/tests/bin/debug/assembly2.dll"); path3 = CleanPath("/tests/bin/debug/assembly3.dll"); events = 0; assemblies.Changed += new EventHandler( assemblies_Changed ); }
public MemberPickerVM(Language language, ITreeViewNodeFilter filter, IEnumerable<LoadedAssembly> assemblies) { this.Language = language; this.ShowInternalApi = true; this.filter = filter; this.origFilter = filter; assemblyList = new AssemblyList("Member Picker List", false); foreach (var asm in assemblies) assemblyList.ForceAddAssemblyToList(asm, true, false, -1, false); this.assemblyListTreeNode = new AssemblyListTreeNode(assemblyList); this.assemblyListTreeNode.DisableDrop = true; if (assemblyListTreeNode.Children.Count > 0) SelectedItem = assemblyListTreeNode.Children[0]; // Make sure we don't hook this event before the assembly list node because we depend // on the new asm node being present when we restart the search. assemblyList.CollectionChanged += (s, e) => RestartSearch(); CreateNewFilterSettings(); }
static int Main(string[] args) { if (args.Length != 2) { Console.WriteLine("usage: decompiler [dll] [output path]"); return 2; } var assemblies = new AssemblyList("global"); var assembly = assemblies.OpenAssembly(args[0]); assembly.WaitUntilLoaded(); var root = new AssemblyTreeNode(assembly); root.Decompile(new CSharpLanguage(), new PlainTextOutput(), new DecompilationOptions { SaveAsProjectDirectory = args[1], FullDecompilation = true, DecompilerSettings = new DecompilerSettings { YieldReturn = false } }); return 0; }
public DerivedTypesTreeNode(AssemblyList list, TypeDefinition type) { this.list = list; this.type = type; }
public Enumerator(AssemblyList assemblyList) { _assemblyList = assemblyList; _assemblyList._lock.EnterReadLock(); _listEnumerator = _assemblyList._list.GetEnumerator(); }
public DeliverDelta(AssemblyList masterList, AssemblyList clientList) { _MasterList = masterList; _ClientList = clientList; }
protected override void Execute(ThreadPool owner) { bool deliveredAsms = false; bool connectionClosed = false; try { lock (_ListLock) { bool initComplete = true; List <string> listContent = _ClientList.Descriptions.Select(j => STEM.Sys.IO.Path.AdjustPath(j.Filename).ToUpper()).ToList(); List <string> localContent; while (true) { try { localContent = _MasterList.Descriptions.Select(j => STEM.Sys.IO.Path.AdjustPath(j.Filename).ToUpper()).ToList(); break; } catch { } } string platform = ""; if (_ClientList.IsWindows) { platform = "win-x86"; if (_ClientList.IsX64) { platform = "win-x64"; } } else { platform = "linux-x86"; if (_ClientList.IsX64) { platform = "linux-x64"; } } foreach (string name in localContent.ToList()) { STEM.Sys.IO.FileDescription f = null; while (true) { try { f = _MasterList.Descriptions.FirstOrDefault(i => i.Filename.Equals(name, StringComparison.InvariantCultureIgnoreCase)); break; } catch { } } string fullPath = System.IO.Path.Combine(f.Filepath, f.Filename); if (fullPath.IndexOf("win-x86", StringComparison.InvariantCultureIgnoreCase) >= 0 && !platform.Equals("win-x86", StringComparison.InvariantCultureIgnoreCase)) { localContent.Remove(name); } if (fullPath.IndexOf("win-x64", StringComparison.InvariantCultureIgnoreCase) >= 0 && !platform.Equals("win-x64", StringComparison.InvariantCultureIgnoreCase)) { localContent.Remove(name); } if (fullPath.IndexOf("linux-x86", StringComparison.InvariantCultureIgnoreCase) >= 0 && !platform.Equals("linux-x86", StringComparison.InvariantCultureIgnoreCase)) { localContent.Remove(name); } if (fullPath.IndexOf("linux-x64", StringComparison.InvariantCultureIgnoreCase) >= 0 && !platform.Equals("linux-x64", StringComparison.InvariantCultureIgnoreCase)) { localContent.Remove(name); } } initComplete = localContent.Except(listContent).Count() == 0; if (initComplete) { if (!_ClientList.MessageConnection.Send(new AssemblyInitializationComplete())) { STEM.Sys.EventLog.WriteEntry("AssemblySync.DeliverDelta", "SendAssemblyList: Forced disconnect, " + _ClientList.MessageConnection.RemoteAddress, STEM.Sys.EventLog.EventLogEntryType.Information); _ClientList.MessageConnection.Close(); connectionClosed = true; } ExecutionInterval = TimeSpan.FromSeconds(30); return; } AssemblyList send = new AssemblyList(); send.Path = _ClientList.Path; foreach (string name in localContent.Except(listContent).ToList()) { STEM.Sys.IO.FileDescription f = null; while (true) { try { f = _MasterList.Descriptions.FirstOrDefault(i => i.Filename.Equals(name, StringComparison.InvariantCultureIgnoreCase)); break; } catch { } } send.Descriptions.Add(f); _ClientList.Descriptions.Add(new STEM.Sys.IO.FileDescription(f.Filepath, f.Filename, false)); if (!_ClientList.MessageConnection.Send(send)) { try { STEM.Sys.EventLog.WriteEntry("AssemblySync.DeliverDelta", "SendAssemblyList: Forced disconnect, " + _ClientList.MessageConnection.RemoteAddress, STEM.Sys.EventLog.EventLogEntryType.Information); _ClientList.MessageConnection.Close(); connectionClosed = true; } catch { } return; } send.Descriptions.Clear(); deliveredAsms = true; } if (send.Descriptions.Count > 0) { if (!_ClientList.MessageConnection.Send(send)) { try { STEM.Sys.EventLog.WriteEntry("AssemblySync.DeliverDelta", "SendAssemblyList: Forced disconnect, " + _ClientList.MessageConnection.RemoteAddress, STEM.Sys.EventLog.EventLogEntryType.Information); _ClientList.MessageConnection.Close(); connectionClosed = true; } catch { } return; } send.Descriptions.Clear(); deliveredAsms = true; } if (deliveredAsms) { _ClientList.MessageConnection.Send(send); } } } catch { } finally { if (connectionClosed) { owner.EndAsync(this); } } }
private static int FFI_ClearAssemblyList(ILuaState lua) { AssemblyList.Clear(); return(0); }
void DeliverDelta(object o) { MessageConnection connection = o as MessageConnection; AssemblyList list = null; lock (_AssemblyLists) { list = _AssemblyLists.FirstOrDefault(i => i.MessageConnection == connection); if (list == null) { _Pool.EndAsync(new System.Threading.ParameterizedThreadStart(DeliverDelta), o); return; } } bool deliveredAsms = false; bool connectionClosed = false; try { lock (list) { bool initComplete = true; List <string> listContent = list.Descriptions.Select(j => STEM.Sys.IO.Path.AdjustPath(j.Filename).ToUpper()).ToList(); List <string> localContent; while (true) { try { localContent = AssemblyList.Descriptions.Select(j => STEM.Sys.IO.Path.AdjustPath(j.Filename).ToUpper()).ToList(); break; } catch { } } string platform = ""; if (list.IsWindows) { platform = "win-x86"; if (list.IsX64) { platform = "win-x64"; } } else { platform = "linux-x86"; if (list.IsX64) { platform = "linux-x64"; } } foreach (string name in localContent.ToList()) { STEM.Sys.IO.FileDescription f = null; while (true) { try { f = AssemblyList.Descriptions.FirstOrDefault(i => i.Filename.Equals(name, StringComparison.InvariantCultureIgnoreCase)); break; } catch { } } string fullPath = System.IO.Path.Combine(f.Filepath, f.Filename); if (fullPath.IndexOf("win-x86", StringComparison.InvariantCultureIgnoreCase) >= 0 && !platform.Equals("win-x86", StringComparison.InvariantCultureIgnoreCase)) { localContent.Remove(name); } if (fullPath.IndexOf("win-x64", StringComparison.InvariantCultureIgnoreCase) >= 0 && !platform.Equals("win-x64", StringComparison.InvariantCultureIgnoreCase)) { localContent.Remove(name); } if (fullPath.IndexOf("linux-x86", StringComparison.InvariantCultureIgnoreCase) >= 0 && !platform.Equals("linux-x86", StringComparison.InvariantCultureIgnoreCase)) { localContent.Remove(name); } if (fullPath.IndexOf("linux-x64", StringComparison.InvariantCultureIgnoreCase) >= 0 && !platform.Equals("linux-x64", StringComparison.InvariantCultureIgnoreCase)) { localContent.Remove(name); } } initComplete = localContent.Except(listContent).Count() == 0; if (initComplete) { if (!list.MessageConnection.Send(new AssemblyInitializationComplete())) { if (!list.MessageConnection.Send(new AssemblyInitializationComplete())) { list.MessageConnection.Close(); connectionClosed = true; return; } } } AssemblyList send = new AssemblyList(); send.Path = list.Path; foreach (string name in localContent.Except(listContent).ToList()) { STEM.Sys.IO.FileDescription f = AssemblyList.Descriptions.FirstOrDefault(i => i.Filename.Equals(name, StringComparison.InvariantCultureIgnoreCase)); string fullPath = System.IO.Path.Combine(f.Filepath, f.Filename); send.Descriptions.Add(f); list.Descriptions.Add(new STEM.Sys.IO.FileDescription(f.Filepath, f.Filename, false)); if (!list.MessageConnection.Send(send)) { try { STEM.Sys.EventLog.WriteEntry("AssemblySync.DeliverDelta", "SendAssemblyList: Forced disconnect, " + list.MessageConnection.RemoteAddress, STEM.Sys.EventLog.EventLogEntryType.Information); list.MessageConnection.Close(); connectionClosed = true; } catch { } return; } send.Descriptions.Clear(); deliveredAsms = true; } if (send.Descriptions.Count > 0) { if (!list.MessageConnection.Send(send)) { try { list.MessageConnection.Close(); connectionClosed = true; } catch { } return; } send.Descriptions.Clear(); deliveredAsms = true; } if (deliveredAsms) { list.MessageConnection.Send(send); } } } catch { } finally { if (connectionClosed) { Dispose(connection); } } }
public AssemblyListTreeNode(AssemblyList assemblyList) { this.assemblyList = assemblyList ?? throw new ArgumentNullException(nameof(assemblyList)); BindToObservableCollection(assemblyList); }
public ControllerFinder(AssemblyList assemblies) { this.assemblies = assemblies; }
public LoadedAssembly(AssemblyList assemblyList, string fileName, Stream stream = null) { if (assemblyList == null) throw new ArgumentNullException("assemblyList"); if (fileName == null) throw new ArgumentNullException("fileName"); this.assemblyList = assemblyList; this.fileName = fileName; this.assemblyTask = Task.Factory.StartNew<ModuleDefinition>(LoadAssembly, stream); // requires that this.fileName is set this.shortName = Path.GetFileNameWithoutExtension(fileName); }
public IEnumerable <PEFile> GetAllModules() { return(AssemblyList.GetAllAssemblies().GetAwaiter().GetResult() .Select(asm => asm.GetPEFileOrNull())); }