示例#1
0
        public static string GetScriptString(ObjectReader reader)
        {
            if (!ModuleLoaded)
            {
                var openFolderDialog = new OpenFolderDialog();
                openFolderDialog.Title = "Select Assembly Folder";
                if (openFolderDialog.ShowDialog() == DialogResult.OK)
                {
                    var files         = Directory.GetFiles(openFolderDialog.Folder, "*.dll");
                    var moduleContext = new ModuleContext();
                    var asmResolver   = new AssemblyResolver(moduleContext, true);
                    var resolver      = new Resolver(asmResolver);
                    moduleContext.AssemblyResolver = asmResolver;
                    moduleContext.Resolver         = resolver;
                    try
                    {
                        foreach (var file in files)
                        {
                            var module = ModuleDefMD.Load(file, moduleContext);
                            LoadedModuleDic.Add(Path.GetFileName(file), module);
                        }
                    }
                    catch
                    {
                        // ignored
                    }
                }

                ModuleLoaded = true;
            }

            return(ScriptHelper.GetScriptString(reader, LoadedModuleDic));
        }
示例#2
0
 public static List <TypeTreeNode> MonoBehaviourToTypeTreeNodes(MonoBehaviour m_MonoBehaviour)
 {
     if (!assemblyLoader.Loaded)
     {
         var openFolderDialog = new OpenFolderDialog();
         openFolderDialog.Title = "Select Assembly Folder";
         if (openFolderDialog.ShowDialog() == DialogResult.OK)
         {
             assemblyLoader.Load(openFolderDialog.Folder);
         }
         else
         {
             assemblyLoader.Loaded = true;
         }
     }
     return(m_MonoBehaviour.ConvertToTypeTreeNodes(assemblyLoader));
 }
示例#3
0
        public static string GetScriptString(ObjectReader reader)
        {
            if (scriptDumper == null)
            {
                var openFolderDialog = new OpenFolderDialog();
                openFolderDialog.Title = "Select Assembly Folder";
                if (openFolderDialog.ShowDialog() == DialogResult.OK)
                {
                    scriptDumper = new ScriptDumper(openFolderDialog.Folder);
                }
                else
                {
                    scriptDumper = new ScriptDumper();
                }
            }

            return(scriptDumper.DumpScript(reader));
        }