示例#1
0
        public static ImageFile ReadImageFile(this CacheReader f)
        {
            var flags   = (UxlImageFileFlags)f.ReadByte();
            var srcName = f.ReadGlobalValue();

            SourceValue?dstName = null
            , cond = null;

            if (flags.HasFlag(UxlImageFileFlags.HasCondition))
            {
                cond = f.ReadGlobalValue();
            }
            if (flags.HasFlag(UxlImageFileFlags.HasTargetName))
            {
                dstName = f.ReadGlobalValue();
            }

            int?w = null, h = null;

            if (flags.HasFlag(UxlImageFileFlags.HasTargetWidth))
            {
                w = f.ReadCompressedInt();
            }
            if (flags.HasFlag(UxlImageFileFlags.HasTargetHeight))
            {
                h = f.ReadCompressedInt();
            }

            return(new ImageFile(srcName, cond, dstName, w, h));
        }
示例#2
0
        public static UxlDocument Read(CacheReader f, SourcePackage upk)
        {
            var backend = (UxlBackendType)f.ReadByte();
            var flags   = (UxlDocumentFlags)f.ReadByte();

            SourceValue?cond = null;

            if (flags.HasFlag(UxlDocumentFlags.HasCondition))
            {
                cond = f.ReadGlobalValue();
            }

            var doc = new UxlDocument(upk, backend, cond);

            if (flags.HasFlag(UxlDocumentFlags.Defines))
            {
                f.ReadList(doc.Defines, UxlDefine.Read);
            }
            if (flags.HasFlag(UxlDocumentFlags.Usings))
            {
                f.ReadList(doc.Usings, r => r.ReadGlobalValue());
            }
            if (flags.HasFlag(UxlDocumentFlags.Declarations))
            {
                f.ReadList(doc.Declarations, UxlDeclare.Read);
            }
            if (flags.HasFlag(UxlDocumentFlags.Deprecations))
            {
                f.ReadList(doc.Deprecations, UxlDeprecate.Read);
            }
            if (flags.HasFlag(UxlDocumentFlags.Templates))
            {
                f.ReadList(doc.Templates, UxlTemplate.Read);
            }
            if (flags.HasFlag(UxlDocumentFlags.Types))
            {
                f.ReadList(doc.Types, UxlType.Read);
            }

            var entityFlags = (UxlEntityFlags)f.ReadByte();

            doc.ReadEntity(f, entityFlags);
            return(doc);
        }
示例#3
0
        public static UxlImplementation Read(CacheReader r)
        {
            var         flags = (UxlImplementationFlags)r.ReadByte();
            var         src   = r.ReadSource();
            var         body  = r.ReadGlobalValue();
            SourceValue?cond  = null;

            if (flags.HasFlag(UxlImplementationFlags.HasCondition))
            {
                cond = r.ReadGlobalValue();
            }

            return(new UxlImplementation(src, (ImplementationType)(flags & UxlImplementationFlags.TypeMask), body, cond, flags.HasFlag(UxlImplementationFlags.IsDefault)));
        }
示例#4
0
        public static UxlElement Read(CacheReader f)
        {
            var         flags = (UxlElementFlags)f.ReadByte();
            var         key   = f.ReadGlobalValue();
            var         value = f.ReadGlobalValue();
            SourceValue?cond  = null;

            if (flags.HasFlag(UxlElementFlags.HasCondition))
            {
                cond = f.ReadGlobalValue();
            }

            return(new UxlElement((UxlElementType)(flags & UxlElementFlags.TypeMask), key, value, cond, flags.HasFlag(UxlElementFlags.IsDefault)));
        }
示例#5
0
文件: UxlDeclare.cs 项目: mortend/uno
        public static UxlDeclare Read(CacheReader f)
        {
            var flags = (UxlDeclareFlags)f.ReadByte();
            var src   = f.ReadSource();
            var key   = f.ReadGlobalValue();

            SourceValue?cond = null;

            if (flags.HasFlag(UxlDeclareFlags.HasCondition))
            {
                cond = f.ReadGlobalValue();
            }

            return(new UxlDeclare(src, (UxlDeclareType)(flags & UxlDeclareFlags.TypeMask), key, cond));
        }
示例#6
0
        public static UxlTemplate Read(CacheReader f)
        {
            var flags = (UxlTemplateFlags)f.ReadByte();

            SourceValue?cond = null;

            if (flags.HasFlag(UxlTemplateFlags.HasCondition))
            {
                cond = f.ReadGlobalValue();
            }

            var result = new UxlTemplate(f.ReadGlobalValue(), cond, flags.HasFlag(UxlTemplateFlags.IsDefault));

            result.ReadEntity(f, (UxlEntityFlags)flags);
            return(result);
        }
示例#7
0
        public static UxlMethod Read(CacheReader f)
        {
            var flags = (UxlMethodFlags)f.ReadByte();
            var sig   = f.ReadGlobalValue();

            SourceValue?cond = null;

            if (flags.HasFlag(UxlMethodFlags.HasCondition))
            {
                cond = f.ReadGlobalValue();
            }

            var result = new UxlMethod(sig, cond, flags.HasFlag(UxlMethodFlags.IsDefault));

            if (flags.HasFlag(UxlMethodFlags.Implementations))
            {
                f.ReadList(result.Implementations, UxlImplementation.Read);
            }

            result.ReadEntity(f, (UxlEntityFlags)flags);
            return(result);
        }
示例#8
0
文件: UxlType.cs 项目: mortend/uno
        public static UxlType Read(CacheReader f)
        {
            var flags = (UxlTypeFlags)f.ReadByte();
            var name  = f.ReadGlobalValue();

            SourceValue?cond = null;

            if (flags.HasFlag(UxlTypeFlags.HasCondition))
            {
                cond = f.ReadGlobalValue();
            }

            var result = new UxlType(name, cond, flags.HasFlag(UxlTypeFlags.IsDefault));

            if (flags.HasFlag(UxlTypeFlags.Methods))
            {
                f.ReadList(result.Methods, UxlMethod.Read);
            }

            result.ReadEntity(f, (UxlEntityFlags)flags);
            return(result);
        }
示例#9
0
        public static CopyFile ReadCopyFile(this CacheReader f)
        {
            var flags   = (UxlCopyFileFlags)f.ReadByte();
            var srcName = f.ReadGlobalValue();

            SourceValue?dstName = null
            , cond = null
            , type = null;

            if (flags.HasFlag(UxlCopyFileFlags.HasTargetName))
            {
                dstName = f.ReadGlobalValue();
            }
            if (flags.HasFlag(UxlCopyFileFlags.HasCondition))
            {
                cond = f.ReadGlobalValue();
            }
            if (flags.HasFlag(UxlCopyFileFlags.HasType))
            {
                type = f.ReadGlobalValue();
            }

            return(new CopyFile(srcName, (CopyFileFlags)(flags & UxlCopyFileFlags.FlagsMask), dstName, cond, type));
        }