169. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 7/10/2017 1:01:48 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

169.1 Files compared

# Location File Last Modified
1 C:\AraxisMergeCompare\Pri_un\IV-ehmp_cif\VixInstallerSolution2013.root\VixInstallerSolution2013\VixInstallerBusiness BusinessFacade.cs Thu Jun 29 17:22:29 2017 UTC
2 C:\AraxisMergeCompare\Pri_re\IV-ehmp_cif\VixInstallerSolution2013.root\VixInstallerSolution2013\VixInstallerBusiness BusinessFacade.cs Thu Jul 6 15:07:14 2017 UTC

169.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 1266
Changed 1 2
Inserted 0 0
Removed 0 0

169.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

169.4 Active regular expressions

No regular expressions were active.

169.5 Comparison detail

  1   using Syst em;
  2   using Syst em.Collect ions.Gener ic;
  3   using Syst em.Text;
  4   using Syst em.IO;
  5   using Syst em.Securit y;
  6   using Syst em.Securit y.Principa l;
  7   using Syst em.Diagnos tics;
  8   using log4 net;
  9   using Syst em.Xml;
  10   using Micr osoft.Win3 2;
  11   using Syst em.Threadi ng;
  12   using Syst em.Runtime .InteropSe rvices;
  13  
  14   namespace  gov.va.med .imaging.e xchange.Vi xInstaller .business
  15   {
  16  
  17       public  static cl ass Busine ssFacade
  18       {
  19           pr ivate stat ic readonl y String P RODUCTION_ BIA_USERNA ME = "vavi x660prod";
  20           pr ivate stat ic readonl y String P RODUCTION_ BIA_PASSWO RD = "rewR at7ekU";
  21             private st atic reado nly String  SMTP_SERV ER_URI = " DNS          ";
  22           pr ivate stat ic readonl y String V ISTA_DOD_U SERNAME =  "bhieuser1 ";
  23  
  24           // / <summary >
  25           // / Retrieve  a logger  for this c lass.
  26           // / </summar y>
  27           // / <returns >A logger  as a ILog  interface. </returns>
  28           pr ivate stat ic ILog Lo gger()
  29           {
  30                return L ogManager. GetLogger( typeof(Bus inessFacad e).Name);
  31           }
  32  
  33           pr ivate stat ic InfoDel egate info Delegate =  null; //  used to di splay a li ne of text  to any Wi zardPage t hat has re gistered
  34           pu blic stati c InfoDele gate InfoD elegate
  35           {
  36                get { re turn Busin essFacade. infoDelega te; }
  37                set { Bu sinessFaca de.infoDel egate = va lue; }
  38           }
  39  
  40           pr ivate stat ic VixMani fest manif est = null ; // the i nstallatio n manifest
  41           pu blic stati c VixManif est Manife st
  42           {
  43                get { re turn Busin essFacade. manifest;  }
  44                set { Bu sinessFaca de.manifes t = value;  }
  45           }
  46  
  47           pu blic stati c String G etSmtpServ erUri() {  return SMT P_SERVER_U RI; }
  48  
  49           pu blic stati c String G etVistaDod Username()  { return  VISTA_DOD_ USERNAME;  }
  50  
  51           pu blic stati c String G etProducti onBiaUsern ame() { re turn PRODU CTION_BIA_ USERNAME;  }
  52  
  53           pu blic stati c String G etProducti onBiaPassw ord() { re turn PRODU CTION_BIA_ PASSWORD;  }
  54  
  55           pu blic stati c String G etPayloadZ ipPath(Str ing startu pPath)
  56           {
  57                // this  may get mo re complic ated, so i ts worth e ncapsulati ng
  58                return P ath.Combin e(startupP ath, @"VIX \" + "VixD istributio n.zip");
  59           }
  60           
  61           pu blic stati c String G etPayloadP ath(String  applicati onVersion,  String st artupPath)
  62           {
  63                // this  may get mo re complic ated, so i ts worth e ncapsulati ng
  64                return P ath.Combin e(startupP ath, @"VIX \" + appli cationVers ion);
  65           }
  66  
  67           // / <summary >
  68           // / Checks t o see if t he current  user has  the Admini strator ro le.
  69           // / </summar y>
  70           // / <returns >true if t he current  user is a n administ rator, fal se otherwi se</return s>
  71           // / <excepti on cref="A rgumentNul lException "></except ion>
  72           pu blic stati c bool IsL oggedInUse rAnAdminis trator()
  73           {
  74                bool isA dmin = fal se;
  75                try
  76                {
  77                    Wind owsIdentit y wi = Win dowsIdenti ty.GetCurr ent(); //  SecurityEx ception ma y be throw n
  78                    Wind owsPrincip al princip al = new W indowsPrin cipal(wi);  // Argume ntNullExce ption may  be thrown
  79                    if ( principal. IsInRole(W indowsBuil tInRole.Ad ministrato r))
  80                    {
  81                         isAdmin =  true;
  82                    }
  83                }
  84                catch (S ecurityExc eption ex)
  85                {
  86                    // u ser does n ot have pe rmissions  to check s o they are  probably  not a admi nistrator
  87                    Logg er().Error ("Windows  Identity c ould not b e retrieve d : " + En vironment. NewLine +  ex.InnerEx ception.Me ssage);
  88                }
  89                catch (A rgumentNul lException  ex)
  90                {
  91                    // w indows ide ntity came  back null
  92                    Logg er().Error ("Windows  Identity i s null : "  + Environ ment.NewLi ne + ex.In nerExcepti on.Message );
  93                }
  94                return i sAdmin;
  95          }
  96  
  97           pu blic stati c String G etLoggedIn UserName()
  98           {
  99                String u serName =  "Current u ser";
  100                try
  101                {
  102                    Wind owsIdentit y wi = Win dowsIdenti ty.GetCurr ent(); //  SecurityEx ception ma y be throw n
  103                    Wind owsPrincip al princip al = new W indowsPrin cipal(wi);  // Argume ntNullExce ption may  be thrown
  104                    user Name = wi. Name;
  105                }
  106                catch (S ecurityExc eption ex)
  107                {
  108                    // u ser does n ot have pe rmissions  to check s o they are  probably  not a admi nistrator
  109                    Logg er().Error ("Windows  Identity c ould not b e retrieve d : " + En vironment. NewLine +  ex.InnerEx ception.Me ssage);
  110                }
  111                catch (A rgumentNul lException  ex)
  112                {
  113                    // w indows ide ntity came  back null
  114                    Logg er().Error ("Windows  Identity i s null : "  + Environ ment.NewLi ne + ex.In nerExcepti on.Message );
  115                }
  116                return u serName;
  117           }
  118           
  119           pu blic stati c bool IsW indowsXP()
  120           {
  121                bool isX P = false;
  122                if (Envi ronment.OS Version.Pl atform ==  PlatformID .Win32NT)
  123                {
  124                    if ( Environmen t.OSVersio n.Version. Major == 5  && Enviro nment.OSVe rsion.Vers ion.Minor  == 1)
  125                    {
  126                         isXP = tru e;
  127                    }
  128                }
  129                return i sXP;
  130           }
  131  
  132           pu blic stati c bool IsW indowsServ er2003()
  133           {
  134                bool is2 003 = fals e;
  135                if (Envi ronment.OS Version.Pl atform ==  PlatformID .Win32NT)
  136                {
  137                    if ( Environmen t.OSVersio n.Version. Major == 5  && Enviro nment.OSVe rsion.Vers ion.Minor  == 2)
  138                    {
  139                         is2003 = t rue;
  140                    }
  141                }
  142                return i s2003;
  143           }
  144  
  145           pu blic stati c bool IsW indowsServ er2008()
  146           {
  147                bool is2 008 = fals e;
  148                if (Envi ronment.OS Version.Pl atform ==  PlatformID .Win32NT)
  149                {
  150                    if ( Environmen t.OSVersio n.Version. Major == 6  && Enviro nment.OSVe rsion.Vers ion.Minor  == 1)
  151                    {
  152                         is2008 = t rue;
  153                    }
  154                }
  155                return i s2008;
  156           }
  157  
  158           pu blic stati c bool IsW indowsServ er2012()
  159           {
  160                bool is2 012 = fals e;
  161                if (Envi ronment.OS Version.Pl atform ==  PlatformID .Win32NT)
  162                {
  163                    if ( Environmen t.OSVersio n.Version. Major == 6  && Enviro nment.OSVe rsion.Vers ion.Minor  == 2)
  164                    {
  165                         is2012 = t rue;
  166                    }
  167                }
  168                return i s2012;
  169           }
  170  
  171           pu blic stati c bool IsW indowsServ er2012R2()
  172           {
  173                bool is2 012R2 = fa lse;
  174                if (Envi ronment.OS Version.Pl atform ==  PlatformID .Win32NT)
  175                {
  176                    if ( Environmen t.OSVersio n.Version. Major == 6  && Enviro nment.OSVe rsion.Vers ion.Minor  == 3)
  177                    {
  178                         is2012R2 =  true;
  179                    }
  180                }
  181                return i s2012R2;
  182           }
  183  
  184           pu blic stati c bool IsW indows7()
  185           {
  186                bool is7  = false;
  187                if (Envi ronment.OS Version.Pl atform ==  PlatformID .Win32NT)
  188                {
  189                    if ( Environmen t.OSVersio n.Version. Major == 6  && Enviro nment.OSVe rsion.Vers ion.Minor  == 2)
  190                    {
  191                         is7 = true ;
  192                    }
  193                }
  194                return i s7;
  195           }
  196  
  197  
  198           pu blic stati c bool IsV ista()
  199           {
  200                bool isV ista = fal se;
  201                if (Envi ronment.OS Version.Pl atform ==  PlatformID .Win32NT)
  202                {
  203                    if ( Environmen t.OSVersio n.Version. Major == 6  && Enviro nment.OSVe rsion.Vers ion.Minor  == 0)
  204                    {
  205                         isVista =  true;
  206                    }
  207                }
  208                return i sVista;
  209           }
  210  
  211           pu blic stati c bool IsO peratingSy stemApprov ed(IVixCon figuration Parameters  config, b ool devMod e)
  212           {
  213                String i nfo = null ;
  214                return I sOperating SystemAppr oved(ref i nfo, confi g, devMode );
  215           }
  216  
  217           pu blic stati c bool IsO peratingSy stemApprov ed(ref Str ing info,  IVixConfig urationPar ameters co nfig, bool  devMode)
  218           {
  219                info = " Current op erating sy stem is no t approved  for the V IX service .";
  220                bool isA pproved =  false;
  221  
  222                //TODO:  need to dr ive this f rom the ma nifest dep loyment co nfiguratio n
  223                if (Busi nessFacade .IsWindows Server2003 ())
  224                {
  225                    info  = "Curren t operatin g system i s Windows  2003.";
  226                    isAp proved = t rue;
  227                }
  228                else if  (BusinessF acade.IsWi ndowsServe r2008())
  229                {
  230                    info  = "Curren t operatin g system i s Windows  2008.";
  231                    isAp proved = t rue;
  232                }
  233                else if  (BusinessF acade.IsWi ndowsServe r2012())
  234                {
  235                    info  = "Curren t operatin g system i s Windows  2012.";
  236                    isAp proved = t rue;
  237                }
  238                else if  (BusinessF acade.IsWi ndowsServe r2012R2())
  239                {
  240                    info  = "Curren t operatin g system i s Windows  2012 R2.";
  241                    isAp proved = t rue;
  242                }
  243                else if  ((config.V ixRole ==  VixRoleTyp e.MiniVix  || config. VixRole ==  VixRoleTy pe.DicomGa teway) &&  BusinessFa cade.IsWin dowsXP())
  244                {
  245                    info  = "Curren t operatin g system i s Windows  XP.";
  246                    isAp proved = t rue;
  247                }
  248                else if  (config.Vi xRole == V ixRoleType .MiniVix & & Business Facade.IsW indows7())
  249                {
  250                    info  = "Curren t operatin g system i s Windows  7.";
  251                    isAp proved = t rue;
  252                }
  253                else if  (devMode & & Business Facade.IsW indowsXP() )
  254                {
  255                    info  = "Curren t operatin g system i s Windows  XP. (Dev m ode)";
  256                    isAp proved = t rue;
  257                }
  258                else if  (devMode & & Business Facade.IsW indows7())
  259                {
  260                    info  = "Curren t operatin g system i s Windows  7. (Dev mo de)";
  261                    isAp proved = t rue;
  262                }
  263                else if  (devMode & & Business Facade.IsV ista())
  264                {
  265                    info  = "Curren t operatin g system i s Windows  Vista. (De v mode)";
  266                    isAp proved = t rue;
  267                }
  268  
  269                return i sApproved;
  270           }
  271  
  272           [D llImport(" kernel32.d ll", CharS et = CharS et.Auto, S etLastErro r = true)]
  273           [r eturn: Mar shalAs(Unm anagedType .Bool)]
  274           st atic exter n bool IsW ow64Proces s(IntPtr h Process, o ut bool wo w64Process );
  275  
  276           [D llImport(" kernel32.d ll", CharS et = CharS et.Auto)]
  277           st atic exter n IntPtr G etModuleHa ndle(strin g moduleNa me);
  278  
  279           [D llImport(" kernel32.d ll")]
  280           st atic exter n IntPtr G etCurrentP rocess();
  281  
  282           [D llImport(" kernel32",  CharSet =  CharSet.A uto, SetLa stError =  true)]
  283           st atic exter n IntPtr G etProcAddr ess(IntPtr  hModule,
  284                [Marshal As(Unmanag edType.LPS tr)]string  procName) ;
  285  
  286           // / <summary >
  287           //
  288           // / </summar y>
  289           // / <returns ></returns >
  290           pu blic stati c bool Is6 4BitOperat ingSystem( )
  291           {
  292                if (IntP tr.Size ==  8)  // 64 -bit progr ams run on ly on Win6 4
  293                {
  294                    retu rn true;
  295                }
  296                else  //  32-bit pr ograms run  on both 3 2-bit and  64-bit Win dows
  297                {
  298                    // D etect whet her the cu rrent proc ess is a 3 2-bit proc ess 
  299                    // r unning on  a 64-bit s ystem.
  300                    bool  flag = fa lse;
  301                    if ( DoesWin32M ethodExist ("kernel32 .dll", "Is Wow64Proce ss"))
  302                    {
  303                         if (IsWow6 4Process(G etCurrentP rocess(),  out flag))
  304                         {
  305                             if (fl ag)
  306                             {
  307                                 re turn true;
  308                             }
  309                         }
  310                    }
  311                    retu rn false;
  312                }
  313           }
  314  
  315           // public sta tic bool I s64BitOper atingSyste m(out bool  isWow64)
  316           // {
  317           //     Logger ().Info("I s64BitOper atingSyste m:");
  318           //     isWow6 4 = false;
  319           //     if (In tPtr.Size  == 8)  //  64-bit pro grams run  only on Wi n64
  320           //     {
  321           //         Lo gger().Inf o("IntPtr. Size == 8" );
  322           //         re turn true;
  323           //     }
  324           //     else   // 32-bit  programs r un on both  32-bit an d 64-bit W indows
  325           //     {
  326           //         //  Detect wh ether the  current pr ocess is a  32-bit pr ocess 
  327           //         //  running o n a 64-bit  system.
  328           //         bo ol flag =  false;
  329           //         if  (DoesWin3 2MethodExi st("kernel 32.dll", " IsWow64Pro cess"))
  330           //         {
  331           //              Logger() .Info("Doe sWin32Meth odExist =  true");
  332           //              if (IsWo w64Process (GetCurren tProcess() , out flag ))
  333           //              {
  334           //                  Logg er().Info( "IsWow64Pr ocess = tr ue");
  335           //                  if ( flag)
  336           //                  {
  337           //                       Logger().I nfo("isWow 64 = true" );
  338           //                       isWow64 =  true;
  339           //                       return tru e;
  340           //                  }
  341           //              }
  342           //         }
  343           //         re turn false ;
  344           //     }
  345           // }
  346           
  347           // / <summary >
  348           // / The func tion deter mins wheth er a metho d exists i n the expo rt 
  349           // / table of  a certain  module.
  350           // / </summar y>
  351           // / <param n ame="modul eName">The  name of t he module< /param>
  352           // / <param n ame="metho dName">The  name of t he method< /param>
  353           // / <returns >
  354           // / The func tion retur ns true if  the metho d specifie d by metho dName 
  355           // / exists i n the expo rt table o f the modu le specifi ed by modu leName.
  356           // / </return s>
  357           st atic bool  DoesWin32M ethodExist (string mo duleName,  string met hodName)
  358           {
  359                IntPtr m oduleHandl e = GetMod uleHandle( moduleName );
  360                if (modu leHandle = = IntPtr.Z ero)
  361                {
  362                    retu rn false;
  363                }
  364                return ( GetProcAdd ress(modul eHandle, m ethodName)  != IntPtr .Zero);
  365           }
  366  
  367  
  368           // / <summary >
  369           // / Check to  see if an y flavor o f Visual V C++ 2008 R edistribut able is in stalled.
  370           // / </summar y>
  371           // / <returns >true if t he runtime  is instal led, false  otherwise </returns>
  372           // WFP-Do som e checking  on this.
  373           pu blic stati c bool IsV CPlusPlus2 008Redistr ibutableIn stalled()
  374           {
  375                bool isI nstalled =  false;
  376                string b asekey = n ull;
  377                Registry View regVi ew = Regis tryView.Re gistry32;
  378                if (Busi nessFacade .Is64BitOp eratingSys tem() && M anifest.En able64BitI nstallatio n == false )
  379                {
  380                    base key = @"SO FTWARE\Wow 6432Node\M icrosoft\W indows\Cur rentVersio n\Uninstal l\";
  381                }
  382                else //  native ins tallation  - either x 86 or x64
  383                {
  384                    base key = @"SO FTWARE\Mic rosoft\Win dows\Curre ntVersion\ Uninstall\ ";
  385                }
  386  
  387                string[]  subkeys =  Registry. LocalMachi ne.OpenSub Key(baseke y).GetSubK eyNames();
  388                
  389                foreach  (string su bkey in su bkeys)
  390                {
  391                    Regi stryKey re gKey = Reg istryKey.O penBaseKey (RegistryH ive.LocalM achine, re gView);
  392                    Regi stryKey ke y = regKey .OpenSubKe y(basekey  + @"\" + s ubkey);
  393                    stri ng display name = key .GetValue( "DisplayNa me") as st ring;
  394                    if ( displaynam e != null  && display name.Conta ins("Micro soft Visua l C++ 2008  Redistrib utable"))
  395                    {
  396                         isInstalle d = true;
  397                    }
  398                }
  399  
  400                return i sInstalled ;
  401           }
  402  
  403  
  404           // / <summary >
  405           // / Check to  see if an y flavor o f Visual V C++ 2008 R edistribut able is in stalled.
  406           // / </summar y>
  407           // / <returns >true if t he runtime  is instal led, false  otherwise </returns>
  408           // WFP-Do som e checking  on this.
  409           pu blic stati c bool IsV CPlusPlus2 013Redistr ibutableIn stalled()
  410           {
  411                bool isI nstalled =  false;
  412                string b asekey = n ull;
  413                Registry View regVi ew = Regis tryView.Re gistry32;
  414                if (Busi nessFacade .Is64BitOp eratingSys tem() && M anifest.En able64BitI nstallatio n == false )
  415                {
  416                    base key = @"SO FTWARE\Wow 6432Node\M icrosoft\W indows\Cur rentVersio n\Uninstal l\";
  417                }
  418                else //  native ins tallation  - either x 86 or x64
  419                {
  420                    base key = @"SO FTWARE\Mic rosoft\Win dows\Curre ntVersion\ Uninstall\ ";
  421                }
  422  
  423                string[]  subkeys =  Registry. LocalMachi ne.OpenSub Key(baseke y).GetSubK eyNames();
  424                Logger() .Info("sub keys array : " + subk eys.Length );
  425  
  426                foreach  (string su bkey in su bkeys)
  427                {
  428                    if ( subkey !=  null)
  429                    {
  430                         //Logger() .Info("bas ekey: " +  basekey);
  431                         RegistryKe y regKey =  RegistryK ey.OpenBas eKey(Regis tryHive.Lo calMachine , regView) ;
  432                         //Logger() .Info("reg Key: " + r egKey.ToSt ring());
  433                         RegistryKe y key = re gKey.OpenS ubKey(base key + subk ey);
  434                         //Logger() .Info("key : " + key. ToString() );
  435                         if (key !=  null)
  436                         {
  437                             string  displayna me = key.G etValue("D isplayName ") as stri ng;
  438                             Logger ().Info("d isplayname : " + disp layname);
  439                             if (di splayname  != null &&  displayna me.Contain s("Microso ft Visual  C++ 2013") )
  440                             {
  441                                 is Installed  = true;
  442                             }
  443                         }
  444                    }
  445                }
  446                return i sInstalled ;
  447           }
  448  
  449  
  450           // / <summary >
  451           // / Install  the Visual  Studio 20 05 VC++ ru ntime bund led with t he Laurel  Bridge too lkit
  452           // / </summar y>
  453           // / <returns ></returns >
  454           pu blic stati c bool Ins tallVCPlus PlusRedist ributableF orLaurelBr idge(strin g installe rDirectory )
  455           {
  456                //if (Is VCPlusPlus 2005x86Red istributab leInstalle d() == fal se) // saf ety net
  457                  if (La urelBridge Facade.Can RunDcfInfo () == fals e) // safe ty net
  458                    {
  459                    Proc ess extern alProcess  = new Syst em.Diagnos tics.Proce ss();
  460                    try
  461                    {
  462                         string ins tallerFile spec = nul l;
  463                         if (manife st.Enable6 4BitInstal lation)
  464                         {
  465                             if (Bu sinessFaca de.Is64Bit OperatingS ystem())
  466                             {
  467                                 in stallerFil espec = Pa th.Combine (installer Directory,  @"vcredis t_x64.exe" ); // DKB  - this is  VC++ 2008  for DCF 3. 3.26c
  468                             }
  469                             else
  470                             {
  471                                 in stallerFil espec = Pa th.Combine (installer Directory,  @"vcredis t_x86.exe" );
  472                             }
  473                         }
  474                         else
  475                         {
  476                             instal lerFilespe c = Path.C ombine(ins tallerDire ctory, @"v credist_x8 6.exe");
  477                         }
  478  
  479                         externalPr ocess.Star tInfo.File Name = ins tallerFile spec;
  480                         externalPr ocess.Star tInfo.Argu ments = "  /Q";
  481                         externalPr ocess.Star tInfo.Work ingDirecto ry = insta llerDirect ory;
  482                         externalPr ocess.Star tInfo.UseS hellExecut e = false;
  483                         //external Process.St artInfo.Re directStan dardError  = true;
  484                         //external Process.St artInfo.Re directStan dardOutput  = true;
  485                         externalPr ocess.Star tInfo.Crea teNoWindow  = true;
  486                         externalPr ocess.Star t();
  487                         do
  488                         {
  489                             Thread .Sleep(500 );
  490                             extern alProcess. Refresh();
  491                         } while (! externalPr ocess.HasE xited);
  492                    }
  493                    fina lly
  494                    {
  495                         externalPr ocess.Clos e();
  496                         externalPr ocess = nu ll;
  497                    }
  498                }
  499                //return  IsVCPlusP lus2005x86 Redistribu tableInsta lled();
  500                  return  LaurelBri dgeFacade. CanRunDcfI nfo();
  501           }
  502  
  503           // / <summary >
  504           // / Install  the Visual  Studio 20 08 VC++ ru ntime requ ired by th e CVIX Ope nSSL FIPS  140-2 comp liant runt ime
  505           // / </summar y>
  506           // / <returns ></returns >
  507           pu blic stati c bool Ins tallVCPlus Plus2008Re distributa ble()
  508           {
  509                if (IsVC PlusPlus20 08Redistri butableIns talled() = = false) / / safety n et
  510                {
  511                    Proc ess extern alProcess  = new Syst em.Diagnos tics.Proce ss();
  512                    try
  513                    {
  514                         string wor kingDir =  Path.Combi ne(manifes t.PayloadP ath, @"ser ver");
  515                         string ins tallerFile spec = nul l;
  516                         if (manife st.Enable6 4BitInstal lation)
  517                         {
  518                             if (Bu sinessFaca de.Is64Bit OperatingS ystem())
  519                             {
  520                                 in stallerFil espec = Pa th.Combine (workingDi r, @"vcred ist_x64.ex e");
  521                             }
  522                             else
  523                             {
  524                                 in stallerFil espec = Pa th.Combine (workingDi r, @"vcred ist_x86.ex e");
  525                             }
  526                         }
  527                         else
  528                         {
  529                             instal lerFilespe c = Path.C ombine(wor kingDir, @ "vcredist_ x86.exe");
  530                         }
  531  
  532                         externalPr ocess.Star tInfo.File Name = ins tallerFile spec;
  533                         externalPr ocess.Star tInfo.Argu ments = "  /Q";
  534                         externalPr ocess.Star tInfo.Work ingDirecto ry = worki ngDir;
  535                         externalPr ocess.Star tInfo.UseS hellExecut e = false;
  536                         //external Process.St artInfo.Re directStan dardError  = true;
  537                         //external Process.St artInfo.Re directStan dardOutput  = true;
  538                         externalPr ocess.Star tInfo.Crea teNoWindow  = true;
  539                         externalPr ocess.Star t();
  540                         do
  541                         {
  542                             Thread .Sleep(500 );
  543                             extern alProcess. Refresh();
  544                         } while (! externalPr ocess.HasE xited);
  545                    }
  546                    fina lly
  547                    {
  548                         externalPr ocess.Clos e();
  549                         externalPr ocess = nu ll;
  550                    }
  551                }
  552                return I sVCPlusPlu s2008Redis tributable Installed( );
  553           }
  554  
  555  
  556           // / <summary >
  557           // / Install  the Visual  Studio 20 13 VC++ ru ntime
  558           // / </summar y>
  559           // / <returns ></returns >
  560           pu blic stati c bool Ins tallVCPlus Plus2013Re distributa ble()
  561           {
  562                if (IsVC PlusPlus20 13Redistri butableIns talled() = = true)
  563                {
  564                    retu rn true;
  565                }
  566                Process  externalPr ocess = ne w System.D iagnostics .Process() ;
  567                try
  568                {
  569                    stri ng working Dir = Path .Combine(m anifest.Pa yloadPath,  @"common\ Misc");
  570                    stri ng install erFilespec  = null;
  571                    if ( manifest.E nable64Bit Installati on)
  572                    {
  573                         if (Busine ssFacade.I s64BitOper atingSyste m())
  574                         {
  575                             instal lerFilespe c = Path.C ombine(wor kingDir, @ "vcredist_ x64.exe");
  576                         }
  577                         else
  578                         {
  579                             return  false;
  580                         }
  581                    }
  582                    else
  583                    {
  584                         return fal se;
  585                    }
  586                    exte rnalProces s.StartInf o.FileName  = install erFilespec ;
  587                    exte rnalProces s.StartInf o.Argument s = " /Q";
  588                    exte rnalProces s.StartInf o.WorkingD irectory =  workingDi r;
  589                    exte rnalProces s.StartInf o.UseShell Execute =  false;
  590                    //ex ternalProc ess.StartI nfo.Redire ctStandard Error = tr ue;
  591                    //ex ternalProc ess.StartI nfo.Redire ctStandard Output = t rue;
  592                    exte rnalProces s.StartInf o.CreateNo Window = t rue;
  593                    exte rnalProces s.Start();
  594                    do
  595                    {
  596                         Thread.Sle ep(500);
  597                         externalPr ocess.Refr esh();
  598                    } wh ile (!exte rnalProces s.HasExite d);
  599                }
  600                finally
  601                {
  602                    exte rnalProces s.Close();
  603                    exte rnalProces s = null;
  604                }
  605                return I sVCPlusPlu s2013Redis tributable Installed( );
  606           }
  607  
  608  
  609  
  610           // / <summary >
  611           // / A helper  method to  wrap the  infoDelega te member,  which if  non null p rovide a w ay to repo rt status  to the 
  612           // / user int erface.
  613           // / </summar y>
  614           // / <param n ame="infoM essage">me ssage to d isplay in  the user i nterface.< /param>
  615           // / <returns >the messa ge string  passed in  the infoMe ssage para meter to s upport cha ining.</re turns>
  616           pr ivate stat ic String  Info(Strin g infoMess age)
  617           {
  618                if (info Delegate ! = null)
  619                {
  620                    info Delegate(i nfoMessage );
  621                }
  622                Logger() .Info(info Message);  // any inf o provided  to the pr esentation  layer wil l be logge d.
  623                return i nfoMessage ;
  624           }
  625  
  626           pu blic stati c bool Doe sEnvironme ntVariable Exist(stri ng envVari ableName)
  627           {
  628                // appen d to the p ath
  629                String e nvVariable  = Environ ment.GetEn vironmentV ariable("e nvVariable Name", Env ironmentVa riableTarg et.Machine );
  630                return e nvVariable  == null ?  false : t rue;
  631           }
  632  
  633       }
  634   }