Ejemplo n.º 1
0
 public void UpdateMediaFace(int face, PrimitiveMedia.Entry entry, UUID updaterID)
 {
     if (face >= 32)
     {
         return;
     }
     lock (m_DataLock)
     {
         string mediaURL;
         if (string.IsNullOrEmpty(m_MediaURL))
         {
             mediaURL = "x-mv:00000000/" + updaterID.ToString();
         }
         else
         {
             string rawVersion = m_MediaURL.Substring(5, 10);
             int    version    = int.Parse(rawVersion);
             mediaURL = string.Format("x-mv:{0:D10}/{1}", ++version, updaterID);
         }
         if (m_Media == null)
         {
             m_Media = new PrimitiveMedia();
         }
         while (m_Media.Count <= face)
         {
             m_Media.Add(null);
         }
         m_Media[face] = entry;
         m_MediaURL    = mediaURL;
     }
     UpdateData(UpdateDataFlags.AllObjectUpdate);
     if (m_ParentInfo == null)
     {
         foreach (ObjectPartLocalizedInfo localization in m_Part.NamedLocalizations)
         {
             if (!localization.HasMedia)
             {
                 localization.UpdateData(UpdateDataFlags.AllObjectUpdate);
             }
         }
     }
     m_Part.TriggerOnUpdate(UpdateChangedFlags.Media);
 }
Ejemplo n.º 2
0
        private bool CheckUrlAgainstWhiteList(string rawUrl, PrimitiveMedia.Entry entry)
        {
            var url = new Uri(rawUrl);

            foreach (var origWhitelistUrl in entry.WhiteList)
            {
                var whitelistUrl = origWhitelistUrl;

                /* Deal with a line-ending wildcard */
                if (whitelistUrl.EndsWith("*"))
                {
                    whitelistUrl = whitelistUrl.Remove(whitelistUrl.Length - 1);
                }

                /* A starting wildcard is only meant to match the domain not the rest */
                if (whitelistUrl.StartsWith("*"))
                {
                    whitelistUrl = whitelistUrl.Substring(1);

                    if (url.Host.Contains(whitelistUrl))
                    {
                        return(true);
                    }
                }
                else
                {
                    var urlToMatch = url.Authority + url.AbsolutePath;

                    if (urlToMatch.StartsWith(whitelistUrl))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 3
0
 public void UpdateMediaFace(int face, PrimitiveMedia.Entry entry, UUID updaterID) => m_DefaultLocalization.UpdateMediaFace(face, entry, updaterID);