wyDay.Controls.AutoUpdaterInfo.Load C# (CSharp) Method

Load() private method

private Load ( string filename ) : void
filename string
return void
        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
        }