Ejemplo n.º 1
0
        /// <summary>
        /// Create a resource string and resolve CSS Urls
        /// </summary>
        /// <param name="path"></param>
        /// <param name="contentType"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        private string GetNonCompressedResource(string path, string url, string contentType, HttpContext context)
        {
            ResourceType type = (contentType == "text/javascript") ? ResourceType.JS : ResourceType.CSS;

            ResourceBuilder builder = new ResourceBuilder();

            return(builder.CreateResource(path, url, type, true, false));
        }
 /// <summary>
 /// This is called when GetCurrentConnectionInfo completes.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="ConnectionID"></param>
 /// <param name="RcsID"></param>
 /// <param name="AVTransportID"></param>
 /// <param name="ProtocolInfo"></param>
 /// <param name="PeerConnectionManager"></param>
 /// <param name="PeerConnectionID"></param>
 /// <param name="Direction"></param>
 /// <param name="Status"></param>
 /// <param name="e"></param>
 /// <param name="Tag"></param>
 protected void ConnectionInfoSink(CpConnectionManager sender, System.Int32 ConnectionID, System.Int32 RcsID, System.Int32 AVTransportID, System.String ProtocolInfo, System.String PeerConnectionManager, System.Int32 PeerConnectionID, CpConnectionManager.Enum_A_ARG_TYPE_Direction Direction, CpConnectionManager.Enum_A_ARG_TYPE_ConnectionStatus Status, UPnPInvokeException e, object Tag)
 {
     if (e != null)
     {
         return;
     }
     MediaResource = ResourceBuilder.CreateResource(MediaResource.ContentUri, ProtocolInfo);
     if (OnMediaResourceChanged != null)
     {
         OnMediaResourceChanged(this, MediaResource);
     }
 }
        protected MediaResource[] BuildResources(string Interface, IDictionaryEnumerator en)
        {
            ArrayList a = new ArrayList();

            while (en.MoveNext())
            {
                FileInfo      f = (FileInfo)en.Value;
                MediaResource mr;

                ResourceBuilder.ResourceAttributes resInfo = new ResourceBuilder.ResourceAttributes();
                resInfo.contentUri   = "file://" + f.FullName;
                resInfo.protocolInfo = ProtocolInfoString.CreateHttpGetProtocolInfoString(f);

                mr = ResourceBuilder.CreateResource(resInfo);
                OpenSource.UPnP.AV.Extensions.MetaData.Finder.PopulateMetaData(mr, f);

                a.Add(mr);
            }
            return((MediaResource[])a.ToArray(typeof(MediaResource)));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Gets a compressed javascript file from the cache, if the file doesn't exist it get compressed and added to the cache
        /// </summary>
        /// <param name="path">file path</param>
        /// <param name="contentType">content mime type</param>
        /// <param name="context">current http conext</param>
        /// <returns>compressed script string</returns>
        private string GetAndCompressSingleResource(string path, string url, string contentType, HttpContext context)
        {
            string body = "";

            //check cache first
            if (context.Cache[path] != null)
            {
                body = context.Cache[path].ToString();
            }
            else
            {
                ResourceType type = (contentType == "text/javascript") ? ResourceType.JS : ResourceType.CSS;

                ResourceBuilder builder = new ResourceBuilder();
                body = builder.CreateResource(path, url, type);

                //insert compressed file into cached
                CacheDependency cd = new CacheDependency(path);
                context.Cache.Insert(path, body, cd, System.Web.Caching.Cache.NoAbsoluteExpiration, System.Web.Caching.Cache.NoSlidingExpiration);
            }

            return(body);
        }
 /// <summary>
 /// This is called when AVTransportLastChange receives an event that this has changed
 /// </summary>
 /// <param name="sender"></param>
 protected void AVTransportURISink(AVTransportLastChange sender)
 {
     this.MediaResource = ResourceBuilder.CreateResource(sender.AVTransportURI, "");
     OnCurrentURIChangedEvent.Fire(this);
     ConnectionManager.GetCurrentConnectionInfo(this.ConnectionID, null, new CpConnectionManager.Delegate_OnResult_GetCurrentConnectionInfo(ConnectionInfoSink));
 }