Esempio n. 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 {
            }
        }
Esempio n. 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;
        }
Esempio n. 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;
        }
Esempio n. 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);
        }
Esempio n. 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;
        }
Esempio n. 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 {
			}
		}
Esempio n. 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;
		}
Esempio n. 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;
		}
Esempio n. 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;
		}
Esempio n. 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;
		}