Пример #1
0
        private static byte[] composeBinary(object obj)
        {
            string str = obj.GetType().ToString();

            if (str == "System.Collections.Generic.Dictionary`2[System.String,System.Object]")
            {
                return(Plist.writeBinaryDictionary((Dictionary <string, object>)obj));
            }
            if (str == "System.Collections.Generic.List`1[System.Object]")
            {
                return(Plist.composeBinaryArray((List <object>)obj));
            }
            if (str == "System.Byte[]")
            {
                return(Plist.writeBinaryByteArray((byte[])obj));
            }
            if (str == "System.Double")
            {
                return(Plist.writeBinaryDouble((double)obj));
            }
            if (str == "System.Int32")
            {
                return(Plist.writeBinaryInteger((int)obj, true));
            }
            if (str == "System.String")
            {
                return(Plist.writeBinaryString((string)obj, true));
            }
            if (str == "System.DateTime")
            {
                return(Plist.writeBinaryDate((DateTime)obj));
            }
            if (str != "System.Boolean")
            {
                return(new byte[0]);
            }
            return(Plist.writeBinaryBool((bool)obj));
        }