Esempio n. 1
0
        public void DefineVersionInfoResource()
        {
            if (native_resource != NativeResourceType.None)
            {
                throw new ArgumentException("Native resource has already been defined.");
            }

            // avoid definition of more than one unmanaged resource
            native_resource = NativeResourceType.Assembly;

            version_res = new Win32VersionResource(1, 0, false);
        }
Esempio n. 2
0
        public void DefineVersionInfoResource(string product, string productVersion,
                                              string company, string copyright, string trademark)
        {
            if (version_res != null)
            {
                throw new ArgumentException("Native resource has already been defined.");
            }

            /*
             * We can only create the resource later, when the file name and
             * the binary version is known.
             */

            version_res                 = new Win32VersionResource(1, 0);
            version_res.ProductName     = product;
            version_res.ProductVersion  = productVersion;
            version_res.CompanyName     = company;
            version_res.LegalCopyright  = copyright;
            version_res.LegalTrademarks = trademark;
        }
Esempio n. 3
0
        public void DefineVersionInfoResource(string product, string productVersion,
                                              string company, string copyright, string trademark)
        {
            if (native_resource != NativeResourceType.None)
            {
                throw new ArgumentException("Native resource has already been defined.");
            }

            // avoid definition of more than one unmanaged resource
            native_resource = NativeResourceType.Explicit;

            /*
             * We can only create the resource later, when the file name and
             * the binary version is known.
             */

            version_res                 = new Win32VersionResource(1, 0, false);
            version_res.ProductName     = product != null ? product : " ";
            version_res.ProductVersion  = productVersion != null ? productVersion : " ";
            version_res.CompanyName     = company != null ? company : " ";
            version_res.LegalCopyright  = copyright != null ? copyright : " ";
            version_res.LegalTrademarks = trademark != null ? trademark : " ";
        }
Esempio n. 4
0
        public void DefineVersionInfoResource()
        {
            if (version_res != null)
            {
                throw new ArgumentException("Native resource has already been defined.");
            }

            version_res = new Win32VersionResource(1, 0);

            if (cattrs != null)
            {
                foreach (CustomAttributeBuilder cb in cattrs)
                {
                    string attrname = cb.Ctor.ReflectedType.FullName;

                    if (attrname == "System.Reflection.AssemblyProductAttribute")
                    {
                        version_res.ProductName = cb.string_arg();
                    }
                    else if (attrname == "System.Reflection.AssemblyCompanyAttribute")
                    {
                        version_res.CompanyName = cb.string_arg();
                    }
                    else if (attrname == "System.Reflection.AssemblyCopyrightAttribute")
                    {
                        version_res.LegalCopyright = cb.string_arg();
                    }
                    else if (attrname == "System.Reflection.AssemblyTrademarkAttribute")
                    {
                        version_res.LegalTrademarks = cb.string_arg();
                    }
                    else if (attrname == "System.Reflection.AssemblyCultureAttribute")
                    {
                        int lcid;

                        try {
                            lcid = new CultureInfo(GetCultureString(cb.string_arg())).LCID;
                        } catch (ArgumentException) {
                            //
                            // This means that the resource is set to the invariant, but
                            // the locale encoded will come from the AssemblyName anyways.
                            //
                            // In fact, my exploration of MS.NEt shows that this is always
                            // set to zero, so I wonder if we should completely drop this
                            // code from here.
                            //
                            lcid = CultureInfo.InvariantCulture.LCID;
                        }
                        version_res.FileLanguage = lcid;
                    }
                    else if (attrname == "System.Reflection.AssemblyFileVersionAttribute")
                    {
                        version_res.FileVersion = cb.string_arg();
                    }
                    else if (attrname == "System.Reflection.AssemblyInformationalVersionAttribute")
                    {
                        version_res.ProductVersion = cb.string_arg();
                    }
                    else if (attrname == "System.Reflection.AssemblyTitleAttribute")
                    {
                        version_res.FileDescription = cb.string_arg();
                    }
                    else if (attrname == "System.Reflection.AssemblyDescriptionAttribute")
                    {
                        version_res.Comments = cb.string_arg();
                    }
                }
            }
        }