示例#1
0
        internal static Patch GetLicensesPatch(ISystemOperations so, ISession session, string evfPath)
        {
            var folderLicensesPath = so.PathCombine(session.FolderPath, "LicenseKeys.bin");
            var fileLicensesPath   = so.PathCombine(evfPath, "LicenseKeys.bin");
            var folderHasLicenses  = so.FileExists(folderLicensesPath);
            var fileHasLicenses    = so.FileExists(fileLicensesPath);

            if (folderHasLicenses && fileHasLicenses)
            {
                if (session.Action == ActionType.Extract)
                {
                    return(Patch.MakeLicensesChange(so.FileReadAllBytes(folderLicensesPath), so.FileReadAllBytes(fileLicensesPath)));
                }
                else
                {
                    return(Patch.MakeLicensesChange(so.FileReadAllBytes(fileLicensesPath), so.FileReadAllBytes(folderLicensesPath)));
                }
            }
            else if (!folderHasLicenses && !fileHasLicenses)
            {
                return(null);
            }
            else if (session.Action == ActionType.Extract ? !folderHasLicenses : !fileHasLicenses)
            {
                return(Patch.MakeLicensesChange(new byte[0], so.FileReadAllBytes(session.Action == ActionType.Extract ? fileLicensesPath : folderLicensesPath)));
            }
            else
            {
                return(Patch.MakeLicensesChange(so.FileReadAllBytes(session.Action == ActionType.Extract ? folderLicensesPath : fileLicensesPath), new byte[0]));
            }
        }
示例#2
0
        internal static Patch GetProjectPatch(ISystemOperations so, ISession session, string evfPath)
        {
            var folderIniPath = so.PathCombine(session.FolderPath, "Project.ini");
            var fileIniPath   = so.PathCombine(evfPath, "Project.ini");
            var folderHasIni  = so.FileExists(folderIniPath);
            var fileHasIni    = so.FileExists(fileIniPath);

            if (folderHasIni && fileHasIni)
            {
                if (session.Action == ActionType.Extract)
                {
                    return(Patch.MakeProjectChange(so.FileReadAllText(folderIniPath, Encoding.UTF8), so.FileReadAllText(fileIniPath, Encoding.UTF8)));
                }
                else
                {
                    return(Patch.MakeProjectChange(so.FileReadAllText(fileIniPath, Encoding.UTF8), so.FileReadAllText(folderIniPath, Encoding.UTF8)));
                }
            }
            else if (!folderHasIni && !fileHasIni)
            {
                return(null);
            }
            else if (session.Action == ActionType.Extract ? !folderHasIni : !fileHasIni)
            {
                return(Patch.MakeInsertion("Project", ModuleType.Ini, so.FileReadAllText(session.Action == ActionType.Extract ? fileIniPath : folderIniPath, Encoding.UTF8)));
            }
            else
            {
                return(null); // never suggest deleting Project.INI
            }
        }