Exemplo n.º 1
0
 public UxlMethod(SourceValue sig, SourceValue?cond, bool isDefault, List <UxlElement> elements = null)
     : base(elements)
 {
     Signature = sig;
     Condition = cond;
     IsDefault = isDefault;
 }
Exemplo n.º 2
0
 public UxlDeclare(Source src, UxlDeclareType type, SourceValue key, SourceValue?cond)
 {
     Source    = src;
     Type      = type;
     Key       = key;
     Condition = cond;
 }
Exemplo n.º 3
0
 public UxlType(SourceValue name, SourceValue?cond, bool isDefault, List <UxlElement> elements = null)
     : base(elements)
 {
     Name      = name;
     Condition = cond;
     IsDefault = isDefault;
 }
Exemplo n.º 4
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));
        }
Exemplo n.º 5
0
 public ImageFile(SourceValue sourceName, SourceValue?cond, SourceValue?targetName, int?targetWidth, int?targetHeight)
 {
     SourceName   = sourceName;
     Condition    = cond;
     TargetName   = targetName;
     TargetWidth  = targetWidth;
     TargetHeight = targetHeight;
 }
Exemplo n.º 6
0
 public UxlImplementation(Source src, ImplementationType type, SourceValue body, SourceValue?cond, bool isDefault)
 {
     Source    = src;
     Type      = type;
     Body      = body;
     Condition = cond;
     IsDefault = isDefault;
 }
Exemplo n.º 7
0
 public UxlElement(UxlElementType type, SourceValue key, SourceValue value, SourceValue?cond, bool isDefault)
 {
     Type      = type;
     Key       = key;
     Value     = value;
     Condition = cond;
     IsDefault = isDefault;
 }
Exemplo n.º 8
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)));
        }
Exemplo n.º 9
0
        public CopyFile(SourceValue sourceName, CopyFileFlags flags, SourceValue?targetName = null, SourceValue?cond = null, SourceValue?type = null, Func <string, string> preprocess = null)
        {
            Flags      = flags;
            SourceName = sourceName;
            TargetName = targetName;
            Condition  = cond;
            Type       = type;
            Preprocess = preprocess ?? (x => x);

            if (string.IsNullOrEmpty(SourceName.String))
            {
                throw new ArgumentNullException(nameof(sourceName));
            }
        }
Exemplo n.º 10
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)));
        }
Exemplo n.º 11
0
        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));
        }
Exemplo n.º 12
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);
        }
Exemplo n.º 13
0
        string GetTargetName(SourceValue sourceName, SourceValue?targetName, SourceValue?type = null)
        {
            if (targetName != null && targetName.Value != null)
            {
                return(_env.ExpandSingleLine(targetName.Value.Source, targetName.Value.String).UnixToNative());
            }

            var src = _env.ExpandSingleLine(sourceName.Source, sourceName.String).UnixToNative();

            SourceValue dir;

            if (type != null && _env.TryGetValue(type.Value.String + ".TargetDirectory", out dir))
            {
                return(Path.Combine(dir.String.UnixToNative(), src));
            }

            return(src);
        }
Exemplo n.º 14
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);
        }
Exemplo n.º 15
0
        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);
        }
Exemplo n.º 16
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));
        }