コード例 #1
0
ファイル: MsiRuntime.cs プロジェクト: zacronan/WixSharp
        /// <summary>
        /// Initializes a new instance of the <see cref="MsiRuntime"/> class.
        /// </summary>
        /// <param name="session">The session.</param>
        public MsiRuntime(Session session)
        {
            this.Session = session;
            try
            {
                var bytes = session.TryReadBinary("WixSharp_UIText");
                UIText.InitFromWxl(bytes);

                ProductName    = session.Property("ProductName");
                ProductCode    = session.Property("ProductCode");
                ProductVersion = session.Property("ProductVersion");

                FetchInstallDir();

                //it is important to preserve some product properties for localization as at the end of setup the session object will no longer be available
                UIText["ProductName"]    = ProductName;
                UIText["ProductCode"]    = ProductCode;
                UIText["ProductVersion"] = ProductVersion;

                //ensure Wix# strings are added if not already present
                if (!UIText.ContainsKey("ViewLog"))
                {
                    UIText["ViewLog"] = "View Log";
                }
            }
            catch { }
        }
コード例 #2
0
ファイル: ManagedUI.cs プロジェクト: pbalassone/wixsharp
 /// <summary>
 /// Validates the UI text file (localization file) for being compatible with ManagedUI.
 /// </summary>
 /// <param name="file">The file.</param>
 /// <param name="throwOnError">if set to <c>true</c> [throw on error].</param>
 /// <returns></returns>
 public static bool ValidateUITextFile(string file, bool throwOnError = true)
 {
     try
     {
         var data = new ResourcesData();
         data.InitFromWxl(System.IO.File.ReadAllBytes(file));
     }
     catch (Exception e)
     {
         //may need to do extra logging; not important for now
         if (throwOnError)
         {
             throw new Exception("Localization file is incompatible with ManagedUI.", e);
         }
         else
         {
             return(false);
         }
     }
     return(true);
 }