Exemplo 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);
        }
Exemplo n.º 2
0
        public void DefineUnmanagedResource(byte[] resource)
        {
            if (resource == null)
            {
                throw new ArgumentNullException("resource");
            }
            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.Unmanaged;

            /*
             * The format of the argument byte array is not documented
             * so this method is impossible to implement.
             */

            throw new NotImplementedException();
        }
Exemplo 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 : " ";
        }
Exemplo n.º 4
0
        public void DefineUnmanagedResource(byte[] resource)
        {
            if (resource == null)
            {
                throw new ArgumentNullException("resource");
            }
            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.Unmanaged;

            /*
             * The format of the argument byte array is not documented
             * so this method is impossible to implement.
             *
             * https://connect.microsoft.com/VisualStudio/feedback/details/95784/fatal-assemblybuilder-defineunmanagedresource-byte-and-modulebuilder-defineunmanagedresource-byte-bugs-renders-them-useless
             */

            throw new NotImplementedException();
        }
Exemplo n.º 5
0
        public void DefineUnmanagedResource(string resourceFileName)
        {
            if (resourceFileName == null)
            {
                throw new ArgumentNullException("resourceFileName");
            }
            if (resourceFileName.Length == 0)
            {
                throw new ArgumentException("resourceFileName");
            }
            if (!File.Exists(resourceFileName) || Directory.Exists(resourceFileName))
            {
                throw new FileNotFoundException("File '" + resourceFileName + "' does not exist or is a directory.");
            }
            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.Unmanaged;

            using (FileStream fs = new FileStream(resourceFileName, FileMode.Open, FileAccess.Read)) {
                Win32ResFileReader reader = new Win32ResFileReader(fs);

                foreach (Win32EncodedResource res in reader.ReadResources())
                {
                    if (res.Name.IsName || res.Type.IsName)
                    {
                        throw new InvalidOperationException("resource files with named resources or non-default resource types are not supported.");
                    }

                    AddUnmanagedResource(res);
                }
            }
        }
Exemplo n.º 6
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 : " ";
		}
Exemplo n.º 7
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);
		}
Exemplo n.º 8
0
		public void DefineUnmanagedResource (string resourceFileName)
		{
			if (resourceFileName == null)
				throw new ArgumentNullException ("resourceFileName");
			if (resourceFileName.Length == 0)
				throw new ArgumentException ("resourceFileName");
			if (!File.Exists (resourceFileName) || Directory.Exists (resourceFileName))
				throw new FileNotFoundException ("File '" + resourceFileName + "' does not exists or is a directory.");
			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.Unmanaged;

			using (FileStream fs = new FileStream (resourceFileName, FileMode.Open, FileAccess.Read)) {
				Win32ResFileReader reader = new Win32ResFileReader (fs);

				foreach (Win32EncodedResource res in reader.ReadResources ()) {
					if (res.Name.IsName || res.Type.IsName)
						throw new InvalidOperationException ("resource files with named resources or non-default resource types are not supported.");

					AddUnmanagedResource (res);
				}
			}
		}
Exemplo n.º 9
0
		public void DefineUnmanagedResource (byte[] resource)
		{
			if (resource == null)
				throw new ArgumentNullException ("resource");
			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.Unmanaged;

			/*
			 * The format of the argument byte array is not documented
			 * so this method is impossible to implement.
			 *
			 * https://connect.microsoft.com/VisualStudio/feedback/details/95784/fatal-assemblybuilder-defineunmanagedresource-byte-and-modulebuilder-defineunmanagedresource-byte-bugs-renders-them-useless
			 */

			throw new NotImplementedException ();
		}
Exemplo n.º 10
0
		public void DefineUnmanagedResource (byte[] resource)
		{
			if (resource == null)
				throw new ArgumentNullException ("resource");
			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.Unmanaged;

			/*
			 * The format of the argument byte array is not documented
			 * so this method is impossible to implement.
			 */

			throw new NotImplementedException ();
		}