AIOI 2019-03 Release candidate ready for testing


RE: AIOI 2019-03 Release candidate ready for testing
#6
(2020-02-04, 7:28)Michael Horvath Wrote: Will the AIOI uninstaller still work properly after I upgrade each component? I don't want leftover files or registry entries if something gets borked.

This is the Pre Uninstaller Script:

Code:
if (System.Is64BitOS()) then

    -- Checks to see if LDViewThumbs.dll and LDViewThumbs64.dll exists.
    sLDViewThumbsPath = SessionVar.Expand ("%AppFolder%\\LDraw\\LDView\\LDViewThumbs.dll");
    sLDViewThumbs64Path = SessionVar.Expand("%AppFolder%\\LDraw\\LDView\\LDViewThumbs64.dll");
    
    local sToggle = "/u /s ";
    
    local sArguments = String.Concat(sToggle, '"' .. sLDViewThumbsPath .. '"');
    local sArguments64 = String.Concat(sToggle, '"' .. sLDViewThumbs64Path .. '"');
    
    bLDViewThumbsExists = File.DoesExist(sLDViewThumbsPath);
    bLDViewThumbs64Exists = File.DoesExist(sLDViewThumbs64Path);
    
    
        -- If LDViewThumbs.dll does exist, unregister it
        if bLDViewThumbsExists then
            Shell.Execute(_WindowsFolder .. "\\SysWOW64\\regsvr32.exe", "open", sArguments, "", SW_SHOWNORMAL, true);
            SetupData.WriteToLogFile("Unregistered LDViewThumbs.dll", true);
            
            -- If an error occurred, display the error message.
            error = Application.GetLastError();
            
            if (error ~= 0) then
                Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
                local sMessage = "####################\r\n" .. "ERROR " .. error .. ": " .. _tblErrorMessages[error] .. "\r\n####################\r\n";
                SetupData.WriteToLogFile(sMessage, false);
            end
        end
        
        
        -- If the file does exist, unregister it
        if bLDViewThumbs64Exists then
            Shell.Execute(_SystemFolder .."\\regsvr32.exe", "open", sArguments64, "", SW_SHOWNORMAL, true);
            SetupData.WriteToLogFile("Unregistered LDViewThumbs64.dll", true);
            
            -- If an error occurred, display the error message.
            error = Application.GetLastError();
            
            if (error ~= 0) then
                Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
                local sMessage = "####################\r\n" .. "ERROR " .. error .. ": " .. _tblErrorMessages[error] .. "\r\n####################\r\n";
                SetupData.WriteToLogFile(sMessage, false);
            end
        end
    else
    -- The user's system is running a 32 bit operating system.
    
        -- If LDViewThumbs.dll does exist, un register it
        if bLDViewThumbsExists then
            Shell.Execute(_SystemFolder .. "\\regsvr32.exe", "open", sArguments, "", SW_SHOWNORMAL, false);
            SetupData.WriteToLogFile("Unregistered LDViewThumbs.dll", true);
            
            -- If an error occurred, display the error message.
            error = Application.GetLastError();
            
            if (error ~= 0) then
                Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
                local sMessage = "####################\r\n" .. "ERROR " .. error .. ": " .. _tblErrorMessages[error] .. "\r\n####################\r\n";
                SetupData.WriteToLogFile(sMessage, false);
            end
        end
end

This is the Post Uninstaller Script

Code:
-- Delete shortcuts in LDraw shortcut folder
sShortcutFolderPath = SetupData.GetAppShortcutFolderPath();
Folder.DeleteTree(sShortcutFolderPath, nil);

-- Check to see if any error occurred.
local error = Application.GetLastError();

    -- If an error occurred, display the error message.
    if (error ~= 0) then
        Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
        sMessage = "####################\r\n" .. "ERROR " .. error .. ": " .. _tblErrorMessages[error] .. "\r\n####################\r\n";
        SetupData.WriteToLogFile(sMessage, false);
    else
        SetupData.WriteToLogFile("Deleted LDraw shortcuts tree\r\n", false);
    end

-- Delete the registry value for the LDRAWDIR system variable
    Registry.DeleteValue(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment", "LDRAWDIR");

    -- Check to see if any error occurred.
    local error = Application.GetLastError();

    -- If an error occurred, display the error message.
    if (error ~= 0) then
        Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
        sMessage = "####################\r\n" .. "ERROR " .. error .. ": " .. _tblErrorMessages[error] .. "\r\n####################\r\n";
        SetupData.WriteToLogFile(sMessage, false);
    else
        SetupData.WriteToLogFile("Delete the registry value for the LDRAWDIR system variable\r\n", false);
    end



-- Delete all registry keys for MLCad if MLCad keys exist
sMLCadRegistryExists = Registry.DoesKeyExist(HKEY_CURRENT_USER, "Software\\Lachmann");

if (sMLCadRegistryExists == true) then
    Registry.DeleteKey(HKEY_CURRENT_USER, "Software\\Lachmann");

    -- Check to see if any error occurred.
    local error = Application.GetLastError();

    -- If an error occurred, display the error message.
    if (error ~= 0) then
        Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
        sMessage = "####################\r\n" .. "ERROR " .. error .. ": " .. _tblErrorMessages[error] .. "\r\n####################\r\n";
        SetupData.WriteToLogFile(sMessage, false);
    else
        SetupData.WriteToLogFile("Deleted all registry keys for MLCad if MLCad keys existed\r\n", false);
    end
end


-- Delete all registry keys for LeoCAD if LeoCAD keys exist
sLeoCADRegistryExists = Registry.DoesKeyExist(HKEY_CURRENT_USER, "Software\\LeoCAD Software");

if (sLeoCADRegistryExists == true) then
    Registry.DeleteKey(HKEY_CURRENT_USER, "Software\\LeoCAD Software");

    -- Check to see if any error occurred.
    local error = Application.GetLastError();

    -- If an error occurred, display the error message.
    if (error ~= 0) then
        Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
        sMessage = "####################\r\n" .. "ERROR " .. error .. ": " .. _tblErrorMessages[error] .. "\r\n####################\r\n";
        SetupData.WriteToLogFile(sMessage, false);
    else
        SetupData.WriteToLogFile("Deleted all registry keys for LeoCAD if LeoCAD keys existed\r\n", false);
    end
end


-- Delete all registry keys for LDView if LDView keys exist
sLDViewRegistryExists = Registry.DoesKeyExist(HKEY_CURRENT_USER, "Software\\Travis Cobbs");

if (sLDViewRegistryExists == true) then
    
    -- Delete all registry keys for LDView
    Registry.DeleteKey(HKEY_CURRENT_USER, "Software\\Travis Cobbs");
    Registry.DeleteKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\LDView.exe");
    Registry.DeleteKey(HKEY_CLASSES_ROOT, "Applications\\LDView.exe");
    Registry.DeleteKey(HKEY_CLASSES_ROOT, ".ldr");
    Registry.DeleteKey(HKEY_CLASSES_ROOT, "LDView.ldr");
    Registry.DeleteKey(HKEY_CLASSES_ROOT, ".mpd");
    Registry.DeleteKey(HKEY_CLASSES_ROOT, "LDView.mpd");

    -- Check to see if any error occurred.
    local error = Application.GetLastError();

    -- If an error occurred, display the error message.
    if (error ~= 0) then
        Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
        sMessage = "####################\r\n" .. "ERROR " .. error .. ": " .. _tblErrorMessages[error] .. "\r\n####################\r\n";
        SetupData.WriteToLogFile(sMessage, false);
    else
        SetupData.WriteToLogFile("Deleted all registry keys for LDView if LDView keys existed\r\n", false);
    end
end


-- Delete all registry keys for LPub3D if LPub3D keys exist
sLPub3DRegistryExists = Registry.DoesKeyExist(HKEY_CURRENT_USER, "Software\\LPub3D Software");

if (sLPub3DRegistryExists == true) then
    Registry.DeleteKey(HKEY_CURRENT_USER, "Software\\LPub3D Software");

    -- Check to see if any error occurred.
    local error = Application.GetLastError();

    -- If an error occurred, display the error message.
    if (error ~= 0) then
        Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
        sMessage = "####################\r\n" .. "ERROR " .. error .. ": " .. _tblErrorMessages[error] .. "\r\n####################\r\n";
        SetupData.WriteToLogFile(sMessage, false);
    else
        SetupData.WriteToLogFile("Deleted all registry keys for LPub3D if LPub3D keys existed\r\n", false);        
    end
end

This is the Shutdown script

Code:
-- Delete LDraw folder if still present
sRootFolderExists = Folder.DoesExist(SessionVar.Expand("%AppFolder%"));

if (sRootFolderExists == true) then

    -- Delete entire root tree
    Folder.DeleteTree(SessionVar.Expand("%AppFolder%"), nil);

    -- Check to see if any error occurred.
    local error = Application.GetLastError();

    -- If an error occurred, display the error message.
    if (error ~= 0) then
        Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
        sMessage = "####################\r\n" .. "ERROR " .. error .. ": " .. _tblErrorMessages[error] .. "\r\n####################\r\n";
        SetupData.WriteToLogFile(sMessage, false);
    else
        SetupData.WriteToLogFile("Deleted LDraw root folder if still present\r\n", false);    
    end
end

-- Delete LDraw Parts library if still present
sLibraryFolderExists = Folder.DoesExist(SessionVar.Expand("%CommonDocumentsFolder%\\LDraw"));

if (sLibraryFolderExists == true) then

    -- Delete entire root tree
    Folder.DeleteTree(SessionVar.Expand("%CommonDocumentsFolder%\\LDraw"), nil);

    -- Check to see if any error occurred.
    local error = Application.GetLastError();

    -- If an error occurred, display the error message.
    if (error ~= 0) then
        Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
        sMessage = "####################\r\n" .. "ERROR " .. error .. ": " .. _tblErrorMessages[error] .. "\r\n####################\r\n";
        SetupData.WriteToLogFile(sMessage, false);
    else
        SetupData.WriteToLogFile("Deleted LDraw Parts library if still present\r\n", false);
    end
end

-- Delete LDraw folder in Virtualstore if still present
sVirtualstoreFolderExists = Folder.DoesExist(SessionVar.Expand("%AppDataLocal%" .. "\\VirtualStore\\Program Files (x86)\\LDraw"));

if (sVirtualstoreFolderExists == true) then

    -- Delete entire LDraw tree
    Folder.DeleteTree(SessionVar.Expand("%AppDataLocal%" .. "\\VirtualStore\\Program Files (x86)\\LDraw"), nil);
    
    -- Check to see if any error occurred.
    local error = Application.GetLastError();

        -- If an error occurred, display the error message.
        if (error ~= 0) then
            Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
            sMessage = "####################\r\n" .. "ERROR " .. error .. ": " .. _tblErrorMessages[error] .. "\r\n####################\r\n";
            SetupData.WriteToLogFile(sMessage, false);
        else
            SetupData.WriteToLogFile("Deleted LDraw folder in Virtualstore if still present\r\n", false);
        end
end

-- Delete LDCad folder in AppData if still present
sLDCadFolderExists = Folder.DoesExist(SessionVar.Expand("%ApplicationDataFolder%" .. "\\LDCad"));

if (sLDCadFolderExists == true) then

    -- Delete entire LDCad tree
    Folder.DeleteTree(SessionVar.Expand("%ApplicationDataFolder%" .. "\\LDCad"), nil);
    
    -- Check to see if any error occurred.
    local error = Application.GetLastError();

        -- If an error occurred, display the error message.
        if (error ~= 0) then
            Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
            sMessage = "####################\r\n" .. "ERROR " .. error .. ": " .. _tblErrorMessages[error] .. "\r\n####################\r\n";
            SetupData.WriteToLogFile(sMessage, false);
        else
            SetupData.WriteToLogFile("Deleted LDCad folder in AppData if still present\r\n", false);
        end
end

-- Delete MLCad folder in AppData if still present
sMLCadFolderExists = Folder.DoesExist(SessionVar.Expand("%ApplicationDataFolder%" .. "\\Ing. Michael Lachmann"));

if (sMLCadFolderExists == true) then

    -- Delete entire MLCad tree
    Folder.DeleteTree(SessionVar.Expand("%ApplicationDataFolder%" .. "\\Ing. Michael Lachmann"), nil);
    
    -- Check to see if any error occurred.
    local error = Application.GetLastError();

        -- If an error occurred, display the error message.
        if (error ~= 0) then
            Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
            sMessage = "####################\r\n" .. "ERROR " .. error .. ": " .. _tblErrorMessages[error] .. "\r\n####################\r\n";
            SetupData.WriteToLogFile(sMessage, false);
        else
            SetupData.WriteToLogFile("Deleted MLCad folder in AppData if still present\r\n", false);
        end
end
    
    
-- Delete LPub3D folder in AppData if still present
sLPub3DFolderExists = Folder.DoesExist(SessionVar.Expand("%AppDataLocal%" .. "\\LPub3D Software"));

if (sLPub3DFolderExists == true) then

    -- Delete entire LPub3D tree
    Folder.DeleteTree(SessionVar.Expand("%AppDataLocal%" .. "\\LPub3D Software"), nil);
    
    -- Check to see if any error occurred.
    local error = Application.GetLastError();

        -- If an error occurred, display the error message.
        if (error ~= 0) then
            Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
            sMessage = "####################\r\n" .. "ERROR " .. error .. ": " .. _tblErrorMessages[error] .. "\r\n####################\r\n";
            SetupData.WriteToLogFile(sMessage, false);
        else
            SetupData.WriteToLogFile("Deleted LPub3D folder in AppData if still present\r\n", false);
        end
end


-- Delete LICreator folder in AppData if still present
sLICreatorFolderExists = Folder.DoesExist(SessionVar.Expand("%ApplicationDataFolder%" .. "\\licreator"));

if (sLICreatorFolderExists == true) then

    -- Delete entire LICreator tree
    Folder.DeleteTree(SessionVar.Expand("%ApplicationDataFolder%" .. "\\licreator"), nil);
    
    -- Check to see if any error occurred.
    local error = Application.GetLastError();

        -- If an error occurred, display the error message.
        if (error ~= 0) then
            Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
            sMessage = "####################\r\n" .. "ERROR " .. error .. ": " .. _tblErrorMessages[error] .. "\r\n####################\r\n";
            SetupData.WriteToLogFile(sMessage, false);
        else
            SetupData.WriteToLogFile("Deleted LICreator folder in AppData if still present\r\n", false);
        end
end

Hope this helps.

w.
LEGO ergo sum
Reply
« Next Oldest | Next Newest »



Messages In This Thread
RE: AIOI 2019-03 Release candidate ready for testing - by Willy Tschager - 2020-02-04, 13:36

Forum Jump:


Users browsing this thread: 1 Guest(s)