예제 #1
0
        public void FromTo(ILockLibraryItem locker, int lockCounter)
        {
            FileLibraryItem item = locker as FileLibraryItem;

            this._path = item._path;
            this.Name  = item.Name;
        }
예제 #2
0
        public static FileLibraryItem Create(LibraryType type, string path)
        {
            if (!string.IsNullOrEmpty(path) || File.Exists(path))
            {
                return(null);
            }

            FileLibraryItem item = null;

            if (type == LibraryType.Image)
            {
                item = new ImageInfo();
            }
            else if (type == LibraryType.Video)
            {
                item = new VideoInfo();
            }
            else
            {
                return(null);
            }

            item.Path = path;

            return(item);
        }
예제 #3
0
        private ShapeLayer AddVideoLayer(FileLibraryItem item, SignInfo sign)
        {
            if (item == null || sign == null)
            {
                return(null);
            }

            ShapeVideo shape = new ShapeVideo();

            if (!SetSignInfo(shape, sign))
            {
                return(null);
            }
            shape.VideoUrl        = item.Path;
            shape.IsBackground    = true;
            shape.OldVirtualBound = new System.Drawing.Rectangle(0, 0, sign.Width / 2, sign.Height / 2);
            shape.FileHandle      = item.Id;

            ShapeLayer layer = new ShapeLayer(shape);

            layer.Name = "Layer 1";
            layer.EmphasisEffect.Duration = sign.Template.Message.DisplayTime;

            return(layer);
        }
예제 #4
0
        private ShapeLayer AddVideoLayer(FileLibraryItem item, int length, SignInfo sign)
        {
            if (item == null || sign == null)
            {
                return(null);
            }

            ShapeVideo shape = new ShapeVideo();

            if (!SetSignInfo(shape, sign))
            {
                return(null);
            }
            shape.VideoUrl        = item.Path;
            shape.IsBackground    = true;
            shape.OldVirtualBound = new System.Drawing.Rectangle(0, 0, sign.Width / 2, sign.Height / 2);
            shape.FileHandle      = item.Id;

            ShapeLayer layer = new ShapeLayer(shape);

            layer.Name = "Layer 1";
            //layer.EmphasisEffect.StartTime = 0;
            //layer.EmphasisEffect.EndTime = long.Parse(length.ToString());
            //layer.EmphasisEffect.Duration = length;// sign.Template.Message.DefaultLength;
            layer.EmphasisEffect.Left  = 0;
            layer.EmphasisEffect.Width = sign.Template.Message.DisplayTime * Constance.Effect.UnitWidth;
            return(layer);
        }
예제 #5
0
        private ShapeLayer AddImageLayer(FileLibraryItem item, SignInfo sign)
        {
            if (item == null || sign == null)
            {
                return(null);
            }

            ShapeImage shape = new ShapeImage();

            if (!SetSignInfo(shape, sign))
            {
                return(null);
            }
            shape.ImageUrl = item.Path;

            shape.IsBackground    = true;
            shape.OldVirtualBound = new System.Drawing.Rectangle(0, 0, sign.Width / 2, sign.Height / 2);
            shape.FileHandle      = item.Id;
            //shape.ComputeDestBoundBatchLoad();
            ShapeLayer layer = new ShapeLayer(shape);

            layer.Name = "Layer 1";
            //layer.EmphasisEffect.StartTime = 0;
            //layer.EmphasisEffect.EndTime = long.Parse(sign.Template.Message.DisplayTime.ToString());
            layer.EmphasisEffect.Left  = 0;
            layer.EmphasisEffect.Width = sign.Template.Message.DisplayTime * Constance.Effect.UnitWidth;
            shape.ComputeDestBoundBatchLoad();
            return(layer);
        }
예제 #6
0
        private bool CanDeleteFile(FileLibraryItem item)
        {
            string fileName = null;

            //foreach (Layer layer in _staticLayers)
            foreach (ShapeLayer layer in _layers)
            {
                switch (item.Type)
                {
                case LibraryType.Image:
                    if (layer.Shape.Type == ShapeType.Image)
                    {
                        fileName = (layer.Shape as ShapeImage).ImageUrl;
                    }
                    break;

                case LibraryType.Video:
                    if (layer.Shape.Type == ShapeType.Video)
                    {
                        fileName = (layer.Shape as ShapeVideo).VideoUrl;
                    }
                    break;
                }

                if (string.Equals(fileName, item.Path, StringComparison.OrdinalIgnoreCase))
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #7
0
 public bool CanDeleteFileLibrary(FileLibraryItem lib)
 {
     Check.Assert(lib != null);
     foreach (LibraryGroup item in this)
     {
         if (!item.CanDeleteLibrary(lib))
         {
             return(false);
         }
     }
     return(true);
 }
예제 #8
0
        public LibraryDeleteItem CanDeleteFileLibraryNew(FileLibraryItem lib)
        {
            LibraryDeleteItem deleteItem = new LibraryDeleteItem();

            Check.Assert(lib != null);
            foreach (LibraryGroup item in this)
            {
                deleteItem = item.CanDeleteLibraryNew(lib);

                if (deleteItem.State == LibraryState.Referrence)
                {
                    deleteItem.GroupName = item.Name;
                    return(deleteItem);
                }
            }
            return(deleteItem);
        }
예제 #9
0
        public bool Add(FileLibraryItem item, int length, SignInfo sign)
        {
            ShapeLayer layer = null;

            if (item.Type == LibraryType.Image)
            {
                layer = AddImageLayer(item, length, sign);
            }
            else if (item.Type == LibraryType.Video)
            {
                layer = AddVideoLayer(item, length, sign);
            }
            if (layer != null)
            {
                Add(layer);
                return(true);
            }
            return(false);
        }