Ejemplo n.º 1
0
        /// <summary>
        /// Loads from contents of embedded resources
        /// </summary>
        /// <param name="embeddedResourceNames">List of embedded resources</param>
        /// <param name="typeOverride">type use to override default assembly with resources</param>
        public void InitializeFromEmbeddedResources(IEnumerable <string> embeddedResourceNames, Type typeOverride = null)
        {
            List <IResource> resources = new List <IResource>();

            foreach (string resourceName in embeddedResourceNames)
            {
                resources.Add(EmbeddedResources.GetEmbeddedResource(resourceName, typeOverride ?? typeof(UnitTestConfigurationDataSet)));
            }

            Initialize(resources);
        }
Ejemplo n.º 2
0
            /// <summary>
            /// Adds an external soundbank to load, loaded from an embedded resource in the assembly
            /// </summary>
            /// <param name="resourceName"></param>
            /// <param name="owningAssembly"></param>
            /// <returns></returns>
            public static uint Add(string resourceName, Assembly owningAssembly)
            {
                var(ptr, size) = EmbeddedResources.GetEmbeddedResource(resourceName, owningAssembly);
                if (ptr == 0 || size == 0)
                {
                    throw new ArgumentException($"{resourceName} did not return a valid resource", nameof(resourceName));
                }

                var bankToAdd = new Bank(ptr, (uint)size);

                if (Loaded)
                {
                    if (bankToAdd.Load())
                    {
                        soundBanks.Add(bankToAdd);
                    }
                }
                else
                {
                    soundBanks.Add(bankToAdd);
                }

                return(bankToAdd.PublicID);
            }