Exemplo n.º 1
0
 public XDecompile(XNodeOut intRoot, XNodeOut extRoot, XRayedFile item, BuildModel build)
 {
     ExtRoot             = extRoot;
     OriginalPath        = item.FilePath;
     item.RecompiledPath = null; // reset
     XFile = item;
     Build = build;
 }
Exemplo n.º 2
0
 public XDecompile(XNodeOut intRoot, XNodeOut extRoot, XRayedFile item, BuildModel build)
 {
     ExtRoot = extRoot;
     OriginalPath = item.FilePath;
     item.RecompiledPath = null; // reset
     XFile = item;
     Build = build;
 }
Exemplo n.º 3
0
        private bool TryRestoreBackups(XRayedFile[] files)
        {
            var result = MessageBox.Show("Some of these files have already been XRayed. Try to restore originals?", "Problem", MessageBoxButtons.YesNo);

            // dont just ignore error because we dont want to backup an xrayed version over an original version and have the user lose their original file

            if (result == DialogResult.No)
            {
                RunInGui(() => StatusLabel.Text = "Recompile canceled");
                return false;
            }

            // iterate through backup dir, copy overwrite xrayed files
            var backupDir = Path.Combine(OutputDir, "xBackup");
            foreach (var backupFile in Directory.GetFiles(backupDir))
            {
                var originalPath = backupFile.Replace("\\xBackup", "");
                File.Copy(backupFile, originalPath, true);
            }

            // re-check, if still xrayed, say failed to restore backups
            if (XDecompile.CheckIfAlreadyXRayed(files))
            {
                RunInGui(() => StatusLabel.Text = "Failed to restore backup");
                return false;
            }

            RunInGui(() => StatusLabel.Text = "Restored backups");
            return true;
        }
Exemplo n.º 4
0
        public XDecompile(BuildModel build, XNodeOut intRoot, XNodeOut extRoot, XRayedFile item, 
                          Dictionary<int, FunctionCall> callMap, Dictionary<int, FunctionCall> initMap)
        {
            Build = build;
            ExtRoot = extRoot;
            OriginalPath = item.FilePath;
            item.RecompiledPath = null; // reset
            XFile = item;

            CallMap = callMap;
            InitMap = initMap;
        }
Exemplo n.º 5
0
        public XDecompile(XNodeOut intRoot, XNodeOut extRoot, XRayedFile item, string outDir, string datPath, XRayedFile[] files, bool sxs)
        {
            ExtRoot = extRoot;
            OriginalPath = item.FilePath;
            OutputDir = outDir;
            DatPath = datPath;
            SideBySide = sxs;
            item.RecompiledPath = null; // reset
            XFile = item;

            XRayedFiles = files;
        }
Exemplo n.º 6
0
        internal static bool CheckIfAlreadyXRayed(XRayedFile[] files)
        {
            foreach (var file in files)
            {
                var asm = AssemblyDefinition.ReadAssembly(file.FilePath);

                if(asm.MainModule.AssemblyReferences.Any(r => r.Name == "XLibrary"))
                    return true;
            }

            return false;
        }