internal int ExtractToTemp()
        {
            this.filesAffected = 0;
            this.helpUpdater.EnsureDirectory(this.helpUpdater.LocalCabinetExtractionTargetPath);
            this.helpUpdater.CleanDirectory(this.helpUpdater.LocalCabinetExtractionTargetPath);
            bool   flag   = false;
            string text   = "";
            int    result = EmbeddedCabWrapper.ExtractCabFiles(this.helpUpdater.LocalCabinetPath, this.helpUpdater.LocalCabinetExtractionTargetPath, text, flag);

            this.cabinetFiles = new Dictionary <string, List <string> >();
            this.helpUpdater.RecursiveDescent(0, this.helpUpdater.LocalCabinetExtractionTargetPath, string.Empty, this.affectedCultures, false, this.cabinetFiles);
            this.filesAffected = result;
            return(result);
        }
        protected override void InternalProcessRecord()
        {
            LongPath packagePath      = null;
            LongPath telePackagePath  = null;
            LongPath transPackagePath = null;
            LongPath ttsPackagePath   = null;

            try
            {
                DirectoryInfo directoryInfo = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()));
                this.extractionDirectory = directoryInfo.FullName;
                EmbeddedCabWrapper.ExtractFiles(this.LanguagePackExecutablePath.PathName, this.extractionDirectory, null);
                string[] directories = Directory.GetDirectories(this.extractionDirectory);
                if (directories.Length != 1)
                {
                    base.WriteError(new TaskException(Strings.UmLanguagePackInvalidExtraction), ErrorCategory.NotSpecified, 0);
                }
                string extractionPathWithLanguageFolder = directories[0];
                this.SetPackagePath(extractionPathWithLanguageFolder, "UMLanguagePack", ref packagePath);
                this.SetPackagePath(extractionPathWithLanguageFolder, "MSSpeech_SR_TELE", ref telePackagePath);
                this.SetPackagePath(extractionPathWithLanguageFolder, "MSSpeech_SR_TRANS", ref transPackagePath);
                this.SetPackagePath(extractionPathWithLanguageFolder, "MSSpeech_TTS", ref ttsPackagePath);
            }
            catch (Exception ex)
            {
                base.WriteError(new TaskException(Strings.UmLanguagePackException(ex.Message)), ErrorCategory.NotSpecified, 0);
            }
            this.PackagePath      = packagePath;
            this.TelePackagePath  = telePackagePath;
            this.TransPackagePath = transPackagePath;
            this.TtsPackagePath   = ttsPackagePath;
            if (!File.Exists(this.PackagePath.PathName))
            {
                base.WriteError(new TaskException(Strings.UmLanguagePackMsiFileNotFound(this.PackagePath.PathName)), ErrorCategory.InvalidArgument, 0);
            }
            if (!File.Exists(this.TelePackagePath.PathName))
            {
                base.WriteError(new TaskException(Strings.UmLanguagePackMsiFileNotFound(this.TelePackagePath.PathName)), ErrorCategory.InvalidArgument, 0);
            }
            if (!File.Exists(this.TransPackagePath.PathName))
            {
                this.TransPackagePath = null;
            }
            if (!File.Exists(this.TtsPackagePath.PathName))
            {
                base.WriteError(new TaskException(Strings.UmLanguagePackMsiFileNotFound(this.TtsPackagePath.PathName)), ErrorCategory.InvalidArgument, 0);
            }
            base.InternalProcessRecord();
        }
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            DirectoryInfo directoryInfo = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), Path.GetFileNameWithoutExtension(this.BundlePath.PathName)));

            try
            {
                EmbeddedCabWrapper.ExtractFiles(this.BundlePath.PathName, directoryInfo.FullName, this.DirToExtract);
            }
            catch (CabUtilityWrapperException e)
            {
                TaskLogger.LogError(e);
                TaskLogger.LogExit();
            }
            string sendToPipeline = directoryInfo.FullName + '\\' + this.DirToExtract;

            base.WriteObject(sendToPipeline);
            TaskLogger.LogExit();
        }
Beispiel #4
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     this.datetime = ((DateTime)ExDateTime.Now).ToString("yyyyMMdd-HHmmss");
     try
     {
         string value = "LOGVERBOSE=1 TARGETDIR=\"" + this.InstallPath + "\"";
         Dictionary <string, bool> dictionary  = new Dictionary <string, bool>();
         Dictionary <string, bool> dictionary2 = new Dictionary <string, bool>();
         int num = 0;
         for (int i = 0; i < this.LanguagePacksToInstall.Length; i++)
         {
             bool flag = Convert.ToBoolean(this.LPServerFlags[i]);
             dictionary.Add(this.LanguagePacksToInstall[i], flag);
             if (flag)
             {
                 num++;
             }
             flag = Convert.ToBoolean(this.LPClientFlags[i]);
             dictionary2.Add(this.LanguagePacksToInstall[i], flag);
             if (flag)
             {
                 num++;
             }
         }
         int num2 = num * 2;
         if (this.SourceIsBundle)
         {
             num2 += this.LanguagePacksToInstall.Length;
         }
         int num3 = 0;
         foreach (string text in this.LanguagePacksToInstall)
         {
             int    lcid  = CultureInfo.GetCultureInfo(text).LCID;
             string text2 = "";
             if (this.SourceIsBundle)
             {
                 TaskLogger.Log(Strings.ExtractingLang(text));
                 base.WriteProgress(this.Description, Strings.ExtractingLang(text), (int)((double)num3 * 100.0 / (double)num2 + 0.5));
                 DirectoryInfo directoryInfo = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), Path.GetFileNameWithoutExtension(this.LangPackPath.PathName)));
                 string        text3         = text + "\\";
                 EmbeddedCabWrapper.ExtractFiles(this.LangPackPath.PathName, directoryInfo.FullName, text3);
                 text2 = directoryInfo.FullName + '\\' + text3;
                 num3++;
             }
             else
             {
                 text2 = Path.Combine(this.LangPackPath.PathName, text);
             }
             string text4 = Path.Combine(text2, "ClientLanguagePack.msi");
             if (dictionary2[text] && File.Exists(text4))
             {
                 TaskLogger.Log(Strings.UninstallOldMSIFor(text, "client"));
                 base.WriteProgress(this.Description, Strings.UninstallOldMSIFor(text, "client"), (int)((double)num3 * 100.0 / (double)num2 + 0.5));
                 using (MonadCommand monadCommand = new MonadCommand("Uninstall-MsiPackage", this.monadConnection))
                 {
                     string value2 = this.CreateMsilogPathname("Uninstall", "Client", text);
                     monadCommand.Parameters.AddWithValue("LogFile", value2);
                     Guid productCode = MsiUtility.GetProductCode(text4);
                     monadCommand.Parameters.AddWithValue("ProductCode", productCode);
                     monadCommand.Execute();
                 }
                 num3++;
                 TaskLogger.Log(Strings.InstallingMSIFor(text, "client"));
                 base.WriteProgress(this.Description, Strings.InstallingMSIFor(text, "client"), (int)((double)num3 * 100.0 / (double)num2 + 0.5));
                 using (MonadCommand monadCommand2 = new MonadCommand("Install-MsiPackage", this.monadConnection))
                 {
                     monadCommand2.Parameters.AddWithValue("PackagePath", text4);
                     string value3 = this.CreateMsilogPathname("Install", "Client", text);
                     monadCommand2.Parameters.AddWithValue("LogFile", value3);
                     monadCommand2.Parameters.AddWithValue("Features", new string[]
                     {
                         "AdminTools",
                         "Mailbox",
                         "ClientAccess",
                         "Gateway",
                         "Bridgehead",
                         "UnifiedMessaging",
                         "ClientLanguagePack"
                     });
                     monadCommand2.Parameters.AddWithValue("PropertyValues", value);
                     monadCommand2.Execute();
                 }
                 num3++;
             }
             text4 = Path.Combine(text2, "ServerLanguagePack.msi");
             if (dictionary[text] && File.Exists(text4))
             {
                 TaskLogger.Log(Strings.UninstallOldMSIFor(text, "server"));
                 base.WriteProgress(this.Description, Strings.UninstallOldMSIFor(text, "server"), (int)((double)num3 * 100.0 / (double)num2 + 0.5));
                 using (MonadCommand monadCommand3 = new MonadCommand("Uninstall-MsiPackage", this.monadConnection))
                 {
                     string value4 = this.CreateMsilogPathname("Uninstall", "Server", text);
                     monadCommand3.Parameters.AddWithValue("LogFile", value4);
                     Guid productCode2 = MsiUtility.GetProductCode(text4);
                     monadCommand3.Parameters.AddWithValue("ProductCode", productCode2);
                     monadCommand3.Execute();
                 }
                 num3++;
                 TaskLogger.Log(Strings.InstallingMSIFor(text, "server"));
                 base.WriteProgress(this.Description, Strings.InstallingMSIFor(text, "server"), (int)((double)num3 * 100.0 / (double)num2 + 0.5));
                 using (MonadCommand monadCommand4 = new MonadCommand("Install-MsiPackage", this.monadConnection))
                 {
                     monadCommand4.Parameters.AddWithValue("PackagePath", text4);
                     string value5 = this.CreateMsilogPathname("Install", "Server", text);
                     monadCommand4.Parameters.AddWithValue("LogFile", value5);
                     monadCommand4.Parameters.AddWithValue("Features", new string[]
                     {
                         "AdminTools",
                         "Mailbox",
                         "ClientAccess",
                         "Gateway",
                         "Bridgehead",
                         "UnifiedMessaging",
                         "ServerLanguagePack"
                     });
                     monadCommand4.Parameters.AddWithValue("PropertyValues", value);
                     monadCommand4.Execute();
                 }
                 num3++;
             }
             if (this.SourceIsBundle)
             {
                 try
                 {
                     Directory.Delete(text2, true);
                 }
                 catch (IOException e)
                 {
                     TaskLogger.LogError(e);
                 }
             }
         }
     }
     finally
     {
         base.WriteProgress(this.Description, Strings.ProgressStatusCompleted, 100);
         TaskLogger.LogExit();
     }
 }