Ejemplo n.º 1
0
        //Backwards compatability with 1.0 RC1
        void LoadSelfUpdateRC1Data(Stream fs)
        {
            selfUpdateFromRC1 = true;

            //RC1 means it's guaranteed to be old-style client data file
            clientFileType = ClientFileType.PreRC2;

            byte bType = (byte)fs.ReadByte();

            while (!ReadFiles.ReachedEndByte(fs, bType, 0xFF))
            {
                switch (bType)
                {
                case 0x01:    //Read Client data file location
                    clientFileLoc = ReadFiles.ReadDeprecatedString(fs);
                    break;

                case 0x02:     //Read Server data file location
                    serverFileLoc = ReadFiles.ReadDeprecatedString(fs);
                    break;

                case 0x03:    //Read Base Directory
                    baseDirectory = ReadFiles.ReadDeprecatedString(fs);
                    break;

                case 0x04:    //Read Temporary directory
                    tempDirectory = ReadFiles.ReadDeprecatedString(fs);
                    break;

                case 0x05:    //Read Old client file location
                    oldSelfLocation = ReadFiles.ReadDeprecatedString(fs);
                    break;

                case 0x06:    //Read New client file location
                    newSelfLocation = ReadFiles.ReadDeprecatedString(fs);
                    break;

                case 0x07:
                    if (ReadFiles.ReadBool(fs))
                    {
                        SelfUpdateState = SelfUpdateState.FullUpdate;
                    }
                    break;

                case 0x08:
                    needElevation = ReadFiles.ReadBool(fs);
                    break;

                default:
                    ReadFiles.SkipField(fs, bType);
                    break;
                }

                bType = (byte)fs.ReadByte();
            }

            fs.Close();
        }
Ejemplo n.º 2
0
        void Load(string filename)
        {
            using (FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read))
            {
                if (!ReadFiles.IsHeaderValid(fs, "AUIF"))
                {
                    //free up the file so it can be deleted
                    fs.Close();
                    throw new Exception("Auto update state file ID is wrong.");
                }

                byte bType = (byte)fs.ReadByte();
                while (!ReadFiles.ReachedEndByte(fs, bType, 0xFF))
                {
                    switch (bType)
                    {
                    case 0x01:     // Date last checked for update
                        LastCheckedForUpdate = ReadFiles.ReadDateTime(fs);
                        break;

                    case 0x02:     // update step on
                        UpdateStepOn = (UpdateStepOn)ReadFiles.ReadInt(fs);
                        break;

                    case 0x03:
                        AutoUpdaterStatus = (AutoUpdaterStatus)ReadFiles.ReadInt(fs);
                        break;

                    case 0x04:     // update succeeded
                        UpdateVersion = ReadFiles.ReadString(fs);
                        break;

                    case 0x05:
                        ChangesInLatestVersion = ReadFiles.ReadString(fs);
                        break;

                    case 0x06:
                        ChangesIsRTF = ReadFiles.ReadBool(fs);
                        break;

                    case 0x07:     // update failed
                        ErrorTitle = ReadFiles.ReadString(fs);
                        break;

                    case 0x08:
                        ErrorMessage = ReadFiles.ReadString(fs);
                        break;

                    default:
                        ReadFiles.SkipField(fs, bType);
                        break;
                    }

                    bType = (byte)fs.ReadByte();
                }
            }
        }
Ejemplo n.º 3
0
        private void Load(string filename)
        {
            using (FileStream fileStream = new FileStream(filename, FileMode.Open, FileAccess.Read))
            {
                if (!ReadFiles.IsHeaderValid(fileStream, "AUIF"))
                {
                    fileStream.Close();
                    throw new Exception("Auto update state file ID is wrong.");
                }
                byte b = (byte)fileStream.ReadByte();
                while (!ReadFiles.ReachedEndByte(fileStream, b, byte.MaxValue))
                {
                    switch (b)
                    {
                    case 1:
                        LastCheckedForUpdate = ReadFiles.ReadDateTime(fileStream);
                        break;

                    case 2:
                        UpdateStepOn = (UpdateStepOn)ReadFiles.ReadInt(fileStream);
                        break;

                    case 3:
                        AutoUpdaterStatus = (AutoUpdaterStatus)ReadFiles.ReadInt(fileStream);
                        break;

                    case 4:
                        UpdateVersion = ReadFiles.ReadString(fileStream);
                        break;

                    case 5:
                        ChangesInLatestVersion = ReadFiles.ReadString(fileStream);
                        break;

                    case 6:
                        ChangesIsRTF = ReadFiles.ReadBool(fileStream);
                        break;

                    case 7:
                        ErrorTitle = ReadFiles.ReadString(fileStream);
                        break;

                    case 8:
                        ErrorMessage = ReadFiles.ReadString(fileStream);
                        break;

                    default:
                        ReadFiles.SkipField(fileStream, b);
                        break;
                    }
                    b = (byte)fileStream.ReadByte();
                }
            }
        }
Ejemplo n.º 4
0
        public static UninstallFileInfo Read(Stream fs)
        {
            UninstallFileInfo tempUFI = new UninstallFileInfo();

            //read in the fileinfo

            byte bType = (byte)fs.ReadByte();

            while (!ReadFiles.ReachedEndByte(fs, bType, 0x9A)) //if end byte is detected, bail out
            {
                switch (bType)
                {
                case 0x01:     //file path
                    tempUFI.Path = ReadFiles.ReadDeprecatedString(fs);
                    break;

                case 0x02:     //delete the file?
                    tempUFI.DeleteFile = ReadFiles.ReadBool(fs);
                    break;

                case 0x03:     //un-NGEN the file?
                    tempUFI.UnNGENFile = ReadFiles.ReadBool(fs);
                    break;

                case 0x04:
                    tempUFI.CPUVersion = (CPUVersion)ReadFiles.ReadInt(fs);
                    break;

                case 0x05:
                    tempUFI.FrameworkVersion = (FrameworkVersion)ReadFiles.ReadInt(fs);
                    break;

                case 0x06:
                    tempUFI.RegisterCOMDll = (COMRegistration)ReadFiles.ReadInt(fs);
                    break;

                default:
                    ReadFiles.SkipField(fs, bType);
                    break;
                }

                bType = (byte)fs.ReadByte();
            }

            return(tempUFI);
        }
Ejemplo n.º 5
0
        public static UninstallFileInfo Read(Stream fs)
        {
            UninstallFileInfo uninstallFileInfo = new UninstallFileInfo();
            byte b = (byte)fs.ReadByte();

            while (!ReadFiles.ReachedEndByte(fs, b, 154))
            {
                switch (b)
                {
                case 1:
                    uninstallFileInfo.Path = ReadFiles.ReadDeprecatedString(fs);
                    break;

                case 2:
                    uninstallFileInfo.DeleteFile = ReadFiles.ReadBool(fs);
                    break;

                case 3:
                    uninstallFileInfo.UnNGENFile = ReadFiles.ReadBool(fs);
                    break;

                case 4:
                    uninstallFileInfo.CPUVersion = (CPUVersion)ReadFiles.ReadInt(fs);
                    break;

                case 5:
                    uninstallFileInfo.FrameworkVersion = (FrameworkVersion)ReadFiles.ReadInt(fs);
                    break;

                case 6:
                    uninstallFileInfo.RegisterCOMDll = (COMRegistration)ReadFiles.ReadInt(fs);
                    break;

                default:
                    ReadFiles.SkipField(fs, b);
                    break;
                }
                b = (byte)fs.ReadByte();
            }
            return(uninstallFileInfo);
        }
Ejemplo n.º 6
0
        void Load(string filename)
        {
#if !CLIENT
            // Disable filesystem redirection on x64 (mostly for Windows Services)
            if (Is32BitProcessOn64BitProcessor())
            {
                EnableWow64FSRedirection(false);
            }

            try
            {
#endif
            using (FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read))
            {
                if (!ReadFiles.IsHeaderValid(fs, "AUIF"))
                {
                    //free up the file so it can be deleted
                    fs.Close();
                    throw new Exception("Auto update state file ID is wrong.");
                }

                byte bType = (byte)fs.ReadByte();
                while (!ReadFiles.ReachedEndByte(fs, bType, 0xFF))
                {
                    switch (bType)
                    {
                    case 0x01:         // Date last checked for update
                        LastCheckedForUpdate = ReadFiles.ReadDateTime(fs);
                        break;

                    case 0x02:         // update step on
                        UpdateStepOn = (UpdateStepOn)ReadFiles.ReadInt(fs);
                        break;

                    case 0x03:
                        AutoUpdaterStatus = (AutoUpdaterStatus)ReadFiles.ReadInt(fs);
                        break;

                    case 0x04:         // update succeeded
                        UpdateVersion = ReadFiles.ReadString(fs);
                        break;

                    case 0x05:
                        ChangesInLatestVersion = ReadFiles.ReadString(fs);
                        break;

                    case 0x06:
                        ChangesIsRTF = ReadFiles.ReadBool(fs);
                        break;

                    case 0x07:         // update failed
                        ErrorTitle = ReadFiles.ReadString(fs);
                        break;

                    case 0x08:
                        ErrorMessage = ReadFiles.ReadString(fs);
                        break;

                    default:
                        ReadFiles.SkipField(fs, bType);
                        break;
                    }

                    bType = (byte)fs.ReadByte();
                }
            }
#if !CLIENT
        }

        finally
        {
            // Re-enable filesystem redirection on x64
            if (Is32BitProcessOn64BitProcessor())
            {
                EnableWow64FSRedirection(true);
            }
        }
#endif
        }
Ejemplo n.º 7
0
        void LoadSelfUpdateData(string fileName)
        {
            byte[] fileIDBytes = new byte[7];

            using (FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read))
            {
                // Read back the file identification data, if any
                fs.Read(fileIDBytes, 0, 7);
                string fileID = System.Text.Encoding.UTF8.GetString(fileIDBytes);
                if (fileID != "IUSUFV2")
                {
                    //handle self update from RC1 client
                    if (fileID == "IUSUFV1")
                    {
                        LoadSelfUpdateRC1Data(fs);
                        return;
                    }

                    //free up the file so it can be deleted
                    fs.Close();
                    throw new Exception("Self update fileID is wrong: " + fileID);
                }

                byte bType = (byte)fs.ReadByte();
                while (!ReadFiles.ReachedEndByte(fs, bType, 0xFF))
                {
                    switch (bType)
                    {
                    case 0x01:    //Read Client data file location
                        clientFileLoc = ReadFiles.ReadDeprecatedString(fs);

                        //TODO: wyUp 3.0: Remove this hackish behavior to cope with pre-RC2 client data files
                        if (clientFileLoc.EndsWith("iuc", StringComparison.OrdinalIgnoreCase))
                        {
                            clientFileType = ClientFileType.PreRC2;
                        }
                        else if (clientFileLoc.EndsWith("iucz", StringComparison.OrdinalIgnoreCase))
                        {
                            clientFileType = ClientFileType.RC2;
                        }
                        else
                        {
                            clientFileType = ClientFileType.Final;
                        }

                        break;

                    case 0x02:     //Read Server data file location
                        serverFileLoc = ReadFiles.ReadDeprecatedString(fs);
                        break;

                    case 0x03:     //Client server file location
                        clientSFLoc = ReadFiles.ReadDeprecatedString(fs);
                        break;

                    case 0x04:    //Read Base Directory
                        baseDirectory = ReadFiles.ReadDeprecatedString(fs);
                        break;

                    case 0x05:    //Read Temporary directory
                        tempDirectory = ReadFiles.ReadDeprecatedString(fs);
                        break;

                    case 0x06:    //Read Old client file location
                        oldSelfLocation = ReadFiles.ReadDeprecatedString(fs);
                        break;

                    case 0x07:     //true=Self Update, false=Continue update

                        SelfUpdateState = ReadFiles.ReadBool(fs)
                                                  ? SelfUpdateState.FullUpdate
                                                  : SelfUpdateState.ContinuingRegularUpdate;

                        break;

                    case 0x08:     //is elevation required
                        needElevation = ReadFiles.ReadBool(fs);
                        break;

                    case 0x09:
                        serverOverwrite = ReadFiles.ReadDeprecatedString(fs);
                        break;

                    case 0x0C:
                        updatePathVar = ReadFiles.ReadString(fs);
                        break;

                    case 0x0D:
                        customUrlArgs = ReadFiles.ReadString(fs);
                        break;

                    case 0x0E:
                        forcedLanguageCulture = ReadFiles.ReadString(fs);
                        break;

                    case 0x80:     // is autoupdate mode
                        beginAutoUpdateInstallation = true;

                        // the actual pipe will be created when OnHandleCreated is called
                        isAutoUpdateMode = true;
                        break;

                    case 0x82:
                        UpdatingFromService = true;
                        break;

                    case 0x0F:
                        customProxyUrl = ReadFiles.ReadString(fs);
                        break;

                    case 0x10:
                        customProxyUser = ReadFiles.ReadString(fs);
                        break;

                    case 0x11:
                        customProxyPassword = ReadFiles.ReadString(fs);
                        break;

                    case 0x12:
                        customProxyDomain = ReadFiles.ReadString(fs);
                        break;

                    case 0x13:
                        StartOnErr = ReadFiles.ReadString(fs);
                        break;

                    case 0x14:
                        StartOnErrArgs = ReadFiles.ReadString(fs);
                        break;

                    case 0x15:
                        PasswordUpdateCmd = ReadFiles.ReadString(fs);
                        break;

                    default:
                        ReadFiles.SkipField(fs, bType);
                        break;
                    }

                    bType = (byte)fs.ReadByte();
                }
            }
        }