예제 #1
0
 public void Write(Stream fs, bool comFiles)
 {
     if (comFiles)
     {
         fs.WriteByte(139);
     }
     else
     {
         fs.WriteByte(138);
     }
     WriteFiles.WriteDeprecatedString(fs, 1, Path);
     if (DeleteFile)
     {
         WriteFiles.WriteBool(fs, 2, val: true);
     }
     if (UnNGENFile)
     {
         WriteFiles.WriteBool(fs, 3, val: true);
         WriteFiles.WriteInt(fs, 4, (int)CPUVersion);
         WriteFiles.WriteInt(fs, 5, (int)FrameworkVersion);
     }
     if (RegisterCOMDll != 0)
     {
         WriteFiles.WriteInt(fs, 6, (int)RegisterCOMDll);
     }
     fs.WriteByte(154);
 }
예제 #2
0
 private void Save(string filename)
 {
     using (FileStream fileStream = new FileStream(filename, FileMode.Create, FileAccess.Write))
     {
         WriteFiles.WriteHeader(fileStream, "AUIF");
         UpdateStepOn = UpdateStepOn.Nothing;
         WriteFiles.WriteDateTime(fileStream, 1, LastCheckedForUpdate);
         WriteFiles.WriteInt(fileStream, 2, (int)UpdateStepOn);
         WriteFiles.WriteInt(fileStream, 3, (int)AutoUpdaterStatus);
         if (!string.IsNullOrEmpty(UpdateVersion))
         {
             WriteFiles.WriteString(fileStream, 4, UpdateVersion);
         }
         if (!string.IsNullOrEmpty(ChangesInLatestVersion))
         {
             WriteFiles.WriteString(fileStream, 5, ChangesInLatestVersion);
             WriteFiles.WriteBool(fileStream, 6, ChangesIsRTF);
         }
         if (!string.IsNullOrEmpty(ErrorTitle))
         {
             WriteFiles.WriteString(fileStream, 7, ErrorTitle);
         }
         if (!string.IsNullOrEmpty(ErrorMessage))
         {
             WriteFiles.WriteString(fileStream, 8, ErrorMessage);
         }
         fileStream.WriteByte(byte.MaxValue);
     }
 }
예제 #3
0
        void Save(string filename)
        {
            using (FileStream fs = new FileStream(filename, FileMode.Create, FileAccess.Write))
            {
                // Write any file-identification data you want to here
                WriteFiles.WriteHeader(fs, "AUIF");

#if CLIENT
                UpdateStepOn = UpdateStepOn.Nothing;
#endif

                // Date last checked for update
                WriteFiles.WriteDateTime(fs, 0x01, LastCheckedForUpdate);

                // update step on
                WriteFiles.WriteInt(fs, 0x02, (int)UpdateStepOn);

#if CLIENT
                // only save the AutoUpdaterStatus when wyUpdate writes the file
                WriteFiles.WriteInt(fs, 0x03, (int)AutoUpdaterStatus);
#endif

                if (!string.IsNullOrEmpty(UpdateVersion))
                {
                    WriteFiles.WriteString(fs, 0x04, UpdateVersion);
                }

                if (!string.IsNullOrEmpty(ChangesInLatestVersion))
                {
                    WriteFiles.WriteString(fs, 0x05, ChangesInLatestVersion);

                    WriteFiles.WriteBool(fs, 0x06, ChangesIsRTF);
                }


#if CLIENT
                if (!string.IsNullOrEmpty(ErrorTitle))
                {
                    WriteFiles.WriteString(fs, 0x07, ErrorTitle);
                }

                if (!string.IsNullOrEmpty(ErrorMessage))
                {
                    WriteFiles.WriteString(fs, 0x08, ErrorMessage);
                }
#endif

                fs.WriteByte(0xFF);
            }
        }
예제 #4
0
        public void Write(Stream fs, bool comFiles)
        {
            //beginning of the uninstall file info
            if (comFiles)
            {
                fs.WriteByte(0x8B);
            }
            else
            {
                fs.WriteByte(0x8A);
            }

            //path to the file
            WriteFiles.WriteDeprecatedString(fs, 0x01, Path);

            //delete the file?
            if (DeleteFile)
            {
                WriteFiles.WriteBool(fs, 0x02, true);
            }

            if (UnNGENFile)
            {
                WriteFiles.WriteBool(fs, 0x03, true);

                // the CPU version of the file to un-ngen
                WriteFiles.WriteInt(fs, 0x04, (int)CPUVersion);

                WriteFiles.WriteInt(fs, 0x05, (int)FrameworkVersion);
            }

            if (RegisterCOMDll != COMRegistration.None)
            {
                WriteFiles.WriteInt(fs, 0x06, (int)RegisterCOMDll);
            }

            //end of uninstall file info
            fs.WriteByte(0x9A);
        }
예제 #5
0
        void SaveSelfUpdateData(string fileName)
        {
            using (FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write))
            {
                // Write any file-identification data you want to here
                fs.Write(System.Text.Encoding.UTF8.GetBytes("IUSUFV2"), 0, 7);

                //Client data file location
                WriteFiles.WriteDeprecatedString(fs, 0x01, clientFileLoc);

                //Server data file location
                WriteFiles.WriteDeprecatedString(fs, 0x02, serverFileLoc);

                //Client server file
                WriteFiles.WriteDeprecatedString(fs, 0x03, clientSFLoc);

                //Base Directory
                WriteFiles.WriteDeprecatedString(fs, 0x04, baseDirectory);

                //Temporary directory
                WriteFiles.WriteDeprecatedString(fs, 0x05, tempDirectory);

                //Old client file location (self)
                WriteFiles.WriteDeprecatedString(fs, 0x06, VersionTools.SelfLocation);

                //self update needed
                WriteFiles.WriteBool(fs, 0x07, SelfUpdateState == SelfUpdateState.WillUpdate);

                //check if the new client really has been elevated
                WriteFiles.WriteBool(fs, 0x08, needElevation);

                if (!string.IsNullOrEmpty(serverOverwrite))
                {
                    WriteFiles.WriteDeprecatedString(fs, 0x09, serverOverwrite);
                }

                if (!string.IsNullOrEmpty(updatePathVar))
                {
                    WriteFiles.WriteString(fs, 0x0C, updatePathVar);
                }

                if (!string.IsNullOrEmpty(customUrlArgs))
                {
                    WriteFiles.WriteString(fs, 0x0D, customUrlArgs);
                }

                if (!string.IsNullOrEmpty(forcedLanguageCulture))
                {
                    WriteFiles.WriteString(fs, 0x0E, forcedLanguageCulture);
                }

                if (isAutoUpdateMode)
                {
                    // is in automatic update mode
                    fs.WriteByte(0x80);
                }

                // we're updating from a service (i.e. skip ui mode)
                if (UpdatingFromService)
                {
                    fs.WriteByte(0x82);
                }

                if (!string.IsNullOrEmpty(customProxyUrl))
                {
                    WriteFiles.WriteString(fs, 0x0F, customProxyUrl);
                }

                if (!string.IsNullOrEmpty(customProxyUser))
                {
                    WriteFiles.WriteString(fs, 0x10, customProxyUser);
                }

                if (!string.IsNullOrEmpty(customProxyPassword))
                {
                    WriteFiles.WriteString(fs, 0x11, customProxyPassword);
                }

                if (!string.IsNullOrEmpty(customProxyDomain))
                {
                    WriteFiles.WriteString(fs, 0x12, customProxyDomain);
                }

                if (!string.IsNullOrEmpty(StartOnErr))
                {
                    WriteFiles.WriteString(fs, 0x13, StartOnErr);
                }

                if (!string.IsNullOrEmpty(StartOnErrArgs))
                {
                    WriteFiles.WriteString(fs, 0x14, StartOnErrArgs);
                }

                if (!string.IsNullOrEmpty(PasswordUpdateCmd))
                {
                    WriteFiles.WriteString(fs, 0x15, PasswordUpdateCmd);
                }

                fs.WriteByte(0xFF);
            }
        }