Exemplo n.º 1
0
        public APngProvider(Uri path, MetaProvider meta) : base(path, meta)
        {
            if (!IsAnimatedPng(path.LocalPath))
            {
                _nativeImageProvider = new NativeProvider(path, meta);
                Animator             = _nativeImageProvider.Animator;
                return;
            }

            var decoder = new APNGBitmap(path.LocalPath);

            _baseFrame      = decoder.DefaultImage;
            _frames         = new List <FrameInfo>(decoder.Frames.Length);
            _renderedFrames = new List <BitmapSource>(decoder.Frames.Length);
            Enumerable.Repeat(0, decoder.Frames.Length).ForEach(_ => _renderedFrames.Add(null));

            Animator = new Int32AnimationUsingKeyFrames {
                RepeatBehavior = RepeatBehavior.Forever
            };

            var wallclock = TimeSpan.Zero;

            for (var i = 0; i < decoder.Frames.Length; i++)
            {
                var frame = decoder.Frames[i];

                _frames.Add(new FrameInfo(decoder.IHDRChunk, frame));

                Animator.KeyFrames.Add(new DiscreteInt32KeyFrame(i, KeyTime.FromTimeSpan(wallclock)));
                wallclock += _frames[i].Delay;
            }
        }
Exemplo n.º 2
0
        public void CreateEntity()
        {
            var rtrn = MetaProvider.CreateEntity("User");

            MetaProvider.CreateAttribute(rtrn, "LoginID", "rbforee");

            Trace.WriteLine(rtrn);
        }
Exemplo n.º 3
0
        public void TC_1_1_SaveUserObject()
        {
            var u = new  Burgoo.MetaBase.Test.Objects.User()
            {
                LoginID = "rbforee", Age = 43, DOB = new DateTime(1974, 10, 24)
            };

            MetaProvider.SaveObject(u);
        }
Exemplo n.º 4
0
        public void FindAttributes()
        {
            var ml = MetaProvider.FindAttributes("LoginID", "rbforee");

            foreach (Guid k in ml.Keys)
            {
                Trace.WriteLine(string.Format("{0} {1} {2} {3}", ml[k].ID, ml[k].EntityID, ml[k].Name, ml[k].Value));
            }
        }
Exemplo n.º 5
0
        public static void ClassCleanup( )
        {
            var ds     = MetaProvider.Export();
            var writer = new System.IO.StringWriter();

            ds.WriteXml(writer);
            Trace.WriteLine(writer.ToString());
            MetaProvider.Close();
        }
Exemplo n.º 6
0
        private static AnimationProvider InitAnimationProvider(Uri path, MetaProvider meta)
        {
            var ext  = Path.GetExtension(path.LocalPath).ToLower();
            var type = Providers.First(p => p.Key.Contains(ext) || p.Key.Contains("*")).Value;

            var provider = type.CreateInstance <AnimationProvider>(path.LocalPath, meta);

            return(provider);
        }
Exemplo n.º 7
0
            Assembly ICachedXmlDoc.GetAssembly(HttpContext context, string o)
            {
                MetaProvider p = GetMetaByURL(context, o);

                if (p == null)
                {
                    return(null);
                }
                return(p.Assembly);
            }
Exemplo n.º 8
0
            string ICachedXmlDoc.GetAssemblyResourceName(HttpContext context, string o)
            {
                MetaProvider p = GetMetaByURL(context, o);

                if (p == null)
                {
                    return(null);
                }
                return(p.Resource);
            }
Exemplo n.º 9
0
            Type ICachedXmlDoc.GetType(HttpContext context, string o)
            {
                MetaProvider p = GetMetaByURL(context, o);

                if (p == null)
                {
                    return(null);
                }
                return(p.Type);
            }
Exemplo n.º 10
0
        public void GetEntity()
        {
            var rtrn = MetaProvider.GetEntities("User");

            var ml = MetaProvider.GetAttributes(rtrn);

            foreach (Guid k in ml.Keys)
            {
                Trace.WriteLine(string.Format("{0} {1} {2} {3}", ml[k].ID, ml[k].EntityID, ml[k].Name, ml[k].Value));
            }
        }
Exemplo n.º 11
0
        public NewLiveInternalProvider(ICommentOptions options, INicoSiteOptions siteOptions, IUserStoreManager userStoreManager, ILogger logger, IDataSource server)
            : base(options, siteOptions, userStoreManager, server, logger)
        {
            _server       = server;
            _metaProvider = new MetaProvider();
            _metaProvider.MessageReceived += MetaProvider_MessageReceived;

            _messageProvider = new MessageProvider();
            _messageProvider.ChatReceived   += MessageProvider_ChatReceived;
            _messageProvider.ThreadReceived += MessageProvider_ThreadReceived;
        }
Exemplo n.º 12
0
        internal ImagePanel(ContextObject context, MetaProvider meta) : this()
        {
            ContextObject = context;
            Meta          = meta;

            var s = meta.GetSize();

            //_minZoomFactor = Math.Min(200d / s.Height, 400d / s.Width);
            //_maxZoomFactor = Math.Min(9000d / s.Height, 9000d / s.Width);

            ShowMeta();
            Theme = ContextObject.Theme;
        }
Exemplo n.º 13
0
        public void TC_1_2_GetUserObject()
        {
            var rtrn = MetaProvider.FindAttributes("LoginID", "rbforee");

            foreach (Guid i in rtrn.Keys)
            {
                var user = MetaProvider.GetObject <Burgoo.MetaBase.Test.Objects.User>(i);

                Assert.IsNotNull(user);

                Trace.WriteLine(string.Format("{0} = {1}", "LoginID", user.LoginID));
            }
        }
Exemplo n.º 14
0
        public GifAnimationProvider(string path, MetaProvider meta) : base(path, meta)
        {
            _fileHandle = (Bitmap)Image.FromFile(path);

            _fileHandle.SetResolution(DpiHelper.DefaultDpi * DpiHelper.GetCurrentScaleFactor().Horizontal,
                                      DpiHelper.DefaultDpi * DpiHelper.GetCurrentScaleFactor().Vertical);

            Animator = new Int32AnimationUsingKeyFrames {
                RepeatBehavior = RepeatBehavior.Forever
            };
            Animator.KeyFrames.Add(new DiscreteInt32KeyFrame(0, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(0))));
            Animator.KeyFrames.Add(new DiscreteInt32KeyFrame(1, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(10))));
            Animator.KeyFrames.Add(new DiscreteInt32KeyFrame(2, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(20))));
        }
Exemplo n.º 15
0
            //rewamped for perfomance reasons
            //It looks like issue is not important in development mode,
            //but only will became important in production mode when dynamyc compilation will be enabled
            //Anyway, locking whole table and compiling under lock looks odd
            //spivak.December 07 2006
            //
            //prevent DOS attack. dont cache MetaProvider for not valid resource
            //igorz. May 16 2007
            public MetaProvider GetMetaByURL(HttpContext context, string url)
            {
                string       lwUrl  = url.ToLowerInvariant();
                MetaProvider retVal = (MetaProvider)_table [lwUrl];

                if (retVal == null)
                {
                    retVal = PageCompiler.GetCompiler(context, url);
                    if (retVal.Type == null && retVal.Assembly == null)
                    {
                        return(null);
                    }
                    _table [lwUrl] = retVal;
                }

                return(retVal);
            }
Exemplo n.º 16
0
        public void Prepare(string path, ContextObject context)
        {
            _meta = new MetaProvider(path);

            var size = _meta.GetSize();

            if (!size.IsEmpty)
            {
                context.SetPreferredSizeFit(size, 0.8);
            }
            else
            {
                context.PreferredSize = new Size(800, 600);
            }

            context.Theme = (Themes)SettingHelper.Get("LastTheme", 1);
        }
Exemplo n.º 17
0
        public void Prepare(string path, ContextObject context)
        {
            _meta = new MetaProvider(path);

            var size = _meta.GetSize();

            if (!size.IsEmpty)
            {
                //edit by gh
                //context.SetPreferredSizeFit(size, 0.8);
                context.SetPreferredSizeFit(size, 0.95);
            }
            //--------------------//
            else
            {
                context.PreferredSize = new Size(800, 600);
            }

            context.Theme = (Themes)SettingHelper.Get("LastTheme", 1, "QuickLook.Plugin.ImageViewer");
        }
Exemplo n.º 18
0
        public GifProvider(Uri path, MetaProvider meta, ContextObject contextObject) : base(path, meta, contextObject)
        {
            if (!ImageAnimator.CanAnimate(Image.FromFile(path.LocalPath)))
            {
                _nativeProvider = new NativeProvider(path, meta, contextObject);
                return;
            }

            _fileHandle = (Bitmap)Image.FromFile(path.LocalPath);

            _fileHandle.SetResolution(DisplayDeviceHelper.DefaultDpi * DisplayDeviceHelper.GetCurrentScaleFactor().Horizontal,
                                      DisplayDeviceHelper.DefaultDpi * DisplayDeviceHelper.GetCurrentScaleFactor().Vertical);

            Animator = new Int32AnimationUsingKeyFrames {
                RepeatBehavior = RepeatBehavior.Forever
            };
            Animator.KeyFrames.Add(new DiscreteInt32KeyFrame(0, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(0))));
            Animator.KeyFrames.Add(new DiscreteInt32KeyFrame(1, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(10))));
            Animator.KeyFrames.Add(new DiscreteInt32KeyFrame(2, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(20))));
        }
Exemplo n.º 19
0
 public DcrawProvider(Uri path, MetaProvider meta, ContextObject contextObject) : base(path, meta, contextObject)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 20
0
 protected AnimationProvider(Uri path, MetaProvider meta)
 {
     Path = path;
     Meta = meta;
 }
Exemplo n.º 21
0
 public NativeProvider(Uri path, MetaProvider meta, ContextObject contextObject) : base(path, meta, contextObject)
 {
     Animator = new Int32AnimationUsingKeyFrames();
     Animator.KeyFrames.Add(new DiscreteInt32KeyFrame(0,
                                                      KeyTime.FromTimeSpan(TimeSpan.Zero)));
 }
Exemplo n.º 22
0
 protected AnimationProvider(Uri path, MetaProvider meta, ContextObject contextObject)
 {
     Path          = path;
     Meta          = meta;
     ContextObject = contextObject;
 }
Exemplo n.º 23
0
 public DcrawProvider(Uri path, MetaProvider meta) : base(path, meta)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 24
0
        public CacheItem Retrieve(object instance)
        {
            Meta meta = MetaProvider.GetMeta(instance);

            return(Retrieve(meta.Uuid));
        }
Exemplo n.º 25
0
 public static void ClassInitialize(TestContext tc)
 {
     MetaProvider.Open();
 }
Exemplo n.º 26
0
 public ImageMagickProvider(string path, MetaProvider meta) : base(path, meta)
 {
     Animator = new Int32AnimationUsingKeyFrames();
     Animator.KeyFrames.Add(new DiscreteInt32KeyFrame(0,
                                                      KeyTime.FromTimeSpan(TimeSpan.Zero)));
 }