예제 #1
0
        public static string GetResourceBundleName(this AbcMetaEntry e)
        {
            if (e.Items.Count <= 0)
            {
                return(null);
            }
            var val = e.Items[0].Value;

            if (val == null)
            {
                return(null);
            }
            string s = val.Value;

            return(string.IsNullOrEmpty(s) ? null : s);
        }
예제 #2
0
        public static void Resolve(AbcTrait trait, AbcMetaEntry e, SwfMovie lib)
        {
            if (trait.Embed != null)
            {
                return;
            }

            var klass = trait.Class;

            if (klass == null)
            {
                throw new InvalidOperationException("Embed can be applied to class trait only");
            }

            string symbol       = e[Attrs.Symbol];
            string exportSymbol = e[Attrs.ExportSymbol];
            string source       = e[Attrs.Source];

            var asset = lib.FindAsset(symbol);

            if (asset == null)
            {
                asset = lib.FindAsset(exportSymbol);
                if (asset == null)
                {
                    throw Errors.Linker.UnableToFindSymbol.CreateException(symbol);
                }
                asset.IsExported = true;
            }

            var instance = klass.Instance;

            var embed = new Embed
            {
                Symbol       = symbol,
                Asset        = asset,
                Movie        = lib,
                Source       = source,
                ExportSymbol = exportSymbol,
                Instance     = instance
            };

            trait.Embed         = embed;
            trait.AssetInstance = instance;
        }
예제 #3
0
        private void ProcessMeta(SwfMovie lib, AbcTrait trait, AbcMetaEntry e)
        {
            string name = e.NameString;

            if (name == MetadataTags.Embed)
            {
                Embed.Resolve(trait, e, lib);
                return;
            }

            if (name == MetadataTags.Mixin)
            {
                var klass = trait.Class;
                if (klass == null)
                {
                    throw new InvalidOperationException("Mixin can be applied to class trait only");
                }

                var instance = klass.Instance;
                RegisterMixin(instance);
            }
        }