예제 #1
0
        void EmbedResourceFile(string name, string fileName, ResourceAttributes attribute)
        {
            if (resources != null)
            {
                MonoResource[] new_r = new MonoResource [resources.Length + 1];
                System.Array.Copy(resources, new_r, resources.Length);
                resources = new_r;
            }
            else
            {
                resources = new MonoResource [1];
            }
            int p = resources.Length - 1;

            resources [p].name  = name;
            resources [p].attrs = attribute;
            try {
                FileStream s   = new FileStream(fileName, FileMode.Open, FileAccess.Read);
                long       len = s.Length;
                resources [p].data = new byte [len];
                s.Read(resources [p].data, 0, (int)len);
                s.Close();
            } catch {
            }
        }
예제 #2
0
        private void AddResourceFile(string name, string fileName, ResourceAttributes attribute, bool fileNeedsToExists)
        {
            check_name_and_filename(name, fileName, fileNeedsToExists);

            // Resource files are created/searched under the assembly storage
            // directory
            if (dir != null)
            {
                fileName = Path.Combine(dir, fileName);
            }

            if (resources != null)
            {
                MonoResource[] new_r = new MonoResource [resources.Length + 1];
                System.Array.Copy(resources, new_r, resources.Length);
                resources = new_r;
            }
            else
            {
                resources = new MonoResource [1];
            }
            int p = resources.Length - 1;

            resources [p].name     = name;
            resources [p].filename = fileName;
            resources [p].attrs    = attribute;
        }
예제 #3
0
        internal void EmbedResource(string name, byte[] blob, ResourceAttributes attribute)
        {
            if (resources != null)
            {
                MonoResource[] new_r = new MonoResource [resources.Length + 1];
                System.Array.Copy(resources, new_r, resources.Length);
                resources = new_r;
            }
            else
            {
                resources = new MonoResource [1];
            }
            int p = resources.Length - 1;

            resources [p].name  = name;
            resources [p].attrs = attribute;
            resources [p].data  = blob;
        }
예제 #4
0
        public IResourceWriter DefineResource(string name, string description, ResourceAttributes attribute)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (name == String.Empty)
            {
                throw new ArgumentException("name cannot be empty");
            }
            if (transient)
            {
                throw new InvalidOperationException("The module is transient");
            }
            if (!assemblyb.IsSave)
            {
                throw new InvalidOperationException("The assembly is transient");
            }
            ResourceWriter writer = new ResourceWriter(new MemoryStream());

            if (resource_writers == null)
            {
                resource_writers = new Hashtable();
            }
            resource_writers [name] = writer;

            // The data is filled out later
            if (resources != null)
            {
                MonoResource[] new_r = new MonoResource [resources.Length + 1];
                System.Array.Copy(resources, new_r, resources.Length);
                resources = new_r;
            }
            else
            {
                resources = new MonoResource [1];
            }
            int p = resources.Length - 1;

            resources [p].name  = name;
            resources [p].attrs = attribute;

            return(writer);
        }
예제 #5
0
        public void DefineManifestResource(string name, Stream stream, ResourceAttributes attribute)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (name == String.Empty)
            {
                throw new ArgumentException("name cannot be empty");
            }
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }
            if (transient)
            {
                throw new InvalidOperationException("The module is transient");
            }
            if (!assemblyb.IsSave)
            {
                throw new InvalidOperationException("The assembly is transient");
            }

            if (resources != null)
            {
                MonoResource[] new_r = new MonoResource [resources.Length + 1];
                System.Array.Copy(resources, new_r, resources.Length);
                resources = new_r;
            }
            else
            {
                resources = new MonoResource [1];
            }
            int p = resources.Length - 1;

            resources [p].name   = name;
            resources [p].attrs  = attribute;
            resources [p].stream = stream;
        }
예제 #6
0
		void EmbedResourceFile (string name, string fileName, ResourceAttributes attribute)
		{
			if (resources != null) {
				MonoResource[] new_r = new MonoResource [resources.Length + 1];
				System.Array.Copy(resources, new_r, resources.Length);
				resources = new_r;
			} else {
				resources = new MonoResource [1];
			}
			int p = resources.Length - 1;
			resources [p].name = name;
			resources [p].attrs = attribute;
			try {
				FileStream s = new FileStream (fileName, FileMode.Open, FileAccess.Read);
				long len = s.Length;
				resources [p].data = new byte [len];
				s.Read (resources [p].data, 0, (int)len);
				s.Close ();
			} catch {
			}
		}
예제 #7
0
		private void AddResourceFile (string name, string fileName, ResourceAttributes attribute, bool fileNeedsToExists)
		{
			check_name_and_filename (name, fileName, fileNeedsToExists);

			// Resource files are created/searched under the assembly storage
			// directory
			if (dir != null)
				fileName = Path.Combine (dir, fileName);

			if (resources != null) {
				MonoResource[] new_r = new MonoResource [resources.Length + 1];
				System.Array.Copy(resources, new_r, resources.Length);
				resources = new_r;
			} else {
				resources = new MonoResource [1];
			}
			int p = resources.Length - 1;
			resources [p].name = name;
			resources [p].filename = fileName;
			resources [p].attrs = attribute;
		}
예제 #8
0
		public void DefineManifestResource (string name, Stream stream, ResourceAttributes attribute) {
			if (name == null)
				throw new ArgumentNullException ("name");
			if (name == String.Empty)
				throw new ArgumentException ("name cannot be empty");
			if (stream == null)
				throw new ArgumentNullException ("stream");
			if (transient)
				throw new InvalidOperationException ("The module is transient");
			if (!assemblyb.IsSave)
				throw new InvalidOperationException ("The assembly is transient");

			if (resources != null) {
				MonoResource[] new_r = new MonoResource [resources.Length + 1];
				System.Array.Copy(resources, new_r, resources.Length);
				resources = new_r;
			} else {
				resources = new MonoResource [1];
			}
			int p = resources.Length - 1;
			resources [p].name = name;
			resources [p].attrs = attribute;
			resources [p].stream = stream;
		}
예제 #9
0
		public IResourceWriter DefineResource (string name, string description, ResourceAttributes attribute)
		{
			if (name == null)
				throw new ArgumentNullException ("name");
			if (name == String.Empty)
				throw new ArgumentException ("name cannot be empty");
			if (transient)
				throw new InvalidOperationException ("The module is transient");
			if (!assemblyb.IsSave)
				throw new InvalidOperationException ("The assembly is transient");
			ResourceWriter writer = new ResourceWriter (new MemoryStream ());
			if (resource_writers == null)
				resource_writers = new Hashtable ();
			resource_writers [name] = writer;

			// The data is filled out later
			if (resources != null) {
				MonoResource[] new_r = new MonoResource [resources.Length + 1];
				System.Array.Copy(resources, new_r, resources.Length);
				resources = new_r;
			} else {
				resources = new MonoResource [1];
			}
			int p = resources.Length - 1;
			resources [p].name = name;
			resources [p].attrs = attribute;

			return writer;
		}
예제 #10
0
		internal void EmbedResource (string name, byte[] blob, ResourceAttributes attribute)
		{
			if (resources != null) {
				MonoResource[] new_r = new MonoResource [resources.Length + 1];
				System.Array.Copy(resources, new_r, resources.Length);
				resources = new_r;
			} else {
				resources = new MonoResource [1];
			}
			int p = resources.Length - 1;
			resources [p].name = name;
			resources [p].attrs = attribute;
			resources [p].data = blob;
		}