Esempio n. 1
0
        public void WriteData(AmfWriter writer, object obj)
        {
            IDictionary<string, object> dictionary;
            IEnumerable enumerable;

            if ((dictionary = obj as IDictionary<string, object>) != null)
            {
                // method writes type marker
                writer.WriteAmf0AssociativeArray(dictionary);
            }
            else if ((enumerable = obj as IEnumerable) != null)
            {
                writer.WriteMarker(Amf0TypeMarkers.StrictArray);
                writer.WriteAmf0Array(enumerable.Cast<object>().ToArray());
            }
            else
            {
                // method writes type marker
                writer.WriteAmf0TypedObject(obj);
            }
        }
Esempio n. 2
0
        public void WriteData(AmfWriter writer, object obj)
        {
            IDictionary <string, object> dictionary;
            IEnumerable enumerable;

            if ((dictionary = obj as IDictionary <string, object>) != null)
            {
                // method writes type marker
                writer.WriteAmf0AssociativeArray(dictionary);
            }
            else if ((enumerable = obj as IEnumerable) != null)
            {
                writer.WriteMarker(Amf0TypeMarkers.StrictArray);
                writer.WriteAmf0Array(enumerable.Cast <object>().ToArray());
            }
            else
            {
                // method writes type marker
                writer.WriteAmf0TypedObject(obj);
            }
        }
Esempio n. 3
0
        public void WriteData(AmfWriter writer, object obj)
        {
            IDictionary <string, object> dictionary;

            if ((dictionary = obj as IDictionary <string, object>) != null)
            {
                writer.WriteAmf0AssociativeArray(dictionary);
            }
            else
            {
                IEnumerable source;
                if ((source = obj as IEnumerable) != null)
                {
                    writer.WriteMarker(Amf0TypeMarkers.StrictArray);
                    writer.WriteAmf0Array((Array)source.Cast <object>().ToArray <object>());
                }
                else
                {
                    writer.WriteAmf0TypedObject(obj);
                }
            }
        }