CloudinaryDotNet.Transformation.Clone C# (CSharp) Метод

Clone() публичный Метод

public Clone ( ) : Transformation
Результат Transformation
        public Transformation Clone()
        {
            Transformation t = (Transformation)this.MemberwiseClone();

            t.m_transformParams = new Dictionary<string, object>();

            foreach (var key in m_transformParams.Keys)
            {
                var value = m_transformParams[key];

                if (value is Array)
                {
                    t.Add(key, ((Array)value).Clone());
                }
                else if (value is String || value is ValueType)
                {
                    t.Add(key, value);
                }
                else if (value is Dictionary<string, string>)
                {
                    t.Add(key, new Dictionary<string, string>((Dictionary<string, string>)value));
                }
                else
                {
                    throw new ApplicationException(String.Format("Couldn't clone parameter '{0}'!", key));
                }
            }

            if (m_nestedTransforms != null)
            {
                t.m_nestedTransforms = new List<Transformation>();
                foreach (var nestedTransform in m_nestedTransforms)
                {
                    t.m_nestedTransforms.Add(nestedTransform.Clone());
                }
            }

            return t;
        }

Usage Example

Пример #1
0
        private string FinalizePosterUrl(string source)
        {
            string posterUrl = null;

            if (m_posterUrl != null)
            {
                posterUrl = m_posterUrl.BuildUrl();
            }
            else if (m_posterTransformation != null)
            {
                posterUrl = Clone().Format("jpg").Transform(m_posterTransformation.Clone()).BuildUrl(source);
            }
            else if (m_posterSource != null)
            {
                if (!String.IsNullOrEmpty(m_posterSource))
                {
                    posterUrl = Clone().Format("jpg").BuildUrl(m_posterSource);
                }
            }
            else
            {
                posterUrl = Clone().Format("jpg").BuildUrl(source);
            }

            return(posterUrl);
        }
All Usage Examples Of CloudinaryDotNet.Transformation::Clone