private static void AppendVideoSources(this Url url2, StringBuilder sb, string source, string sourceType) { var url = url2.Clone(); if (url2.m_sourceTransforms != null) { Transformation transformation1; if (url2.m_sourceTransforms.TryGetValue(sourceType, out transformation1) && transformation1 != null) { if (url.m_transformation == null) { url.Transform(transformation1.Clone()); } else { url.m_transformation.Chain(); var transformation2 = transformation1.Clone(); transformation2.NestedTransforms.AddRange(url.m_transformation.NestedTransforms); url.Transform(transformation2); } } } var str1 = url.Format(sourceType).BuildUrl(source); var str2 = sourceType; if (sourceType.Equals("ogv", StringComparison.OrdinalIgnoreCase)) { str2 = "ogg"; } var str3 = "video/" + str2; sb.Append("<source src='").Append(str1).Append("' type='").Append(str3).Append("'>"); }
private static string FinalizePosterUrl(this Url url, string source) { if (url.m_posterUrl != null) { return(url.m_posterUrl.BuildUrl()); } if (url.m_posterTransformation != null) { return(url.Clone().Format("jpg").Transform(url.m_posterTransformation.Clone()).BuildUrl(source)); } if (url.m_posterSource != null) { return(url.Clone().Format("jpg").BuildUrl(url.m_posterSource)); } return(url.Clone().Format("jpg").BuildUrl(source)); }
public Url Clone() { var url = (Url)MemberwiseClone(); if (m_transformation != null) { url.m_transformation = m_transformation.Clone(); } if (m_posterTransformation != null) { url.m_posterTransformation = m_posterTransformation.Clone(); } if (m_posterUrl != null) { url.m_posterUrl = m_posterUrl.Clone(); } if (m_sourceTypes != null) { url.m_sourceTypes = new string[m_sourceTypes.Length]; Array.Copy(m_sourceTypes, url.m_sourceTypes, m_sourceTypes.Length); } if (m_sourceTransforms != null) { url.m_sourceTransforms = new Dictionary <string, Transformation>(); foreach (var sourceTransform in m_sourceTransforms) { url.m_sourceTransforms.Add(sourceTransform.Key, sourceTransform.Value.Clone()); } } url.m_customParts = new List <string>(m_customParts); return(url); }
/// <summary> /// Creates a new object that is a deep copy of the current instance. /// </summary> /// <returns> /// A new object that is a deep copy of this instance. /// </returns> public Url Clone() { Url newUrl = (Url)this.MemberwiseClone(); if (m_transformation != null) { newUrl.m_transformation = this.m_transformation.Clone(); } if (m_posterTransformation != null) { newUrl.m_posterTransformation = m_posterTransformation.Clone(); } if (m_posterUrl != null) { newUrl.m_posterUrl = m_posterUrl.Clone(); } if (m_sourceTypes != null) { newUrl.m_sourceTypes = new string[m_sourceTypes.Length]; Array.Copy(m_sourceTypes, newUrl.m_sourceTypes, m_sourceTypes.Length); } if (m_sourceTransforms != null) { newUrl.m_sourceTransforms = new Dictionary <string, Transformation>(); foreach (var item in m_sourceTransforms) { newUrl.m_sourceTransforms.Add(item.Key, item.Value.Clone()); } } newUrl.m_customParts = new List <string>(m_customParts); return(newUrl); }