Example #1
0
        protected static bool serializeObject(Hashtable anObject, StringBuilder builder)
        {
            builder.Append("{");
            IDictionaryEnumerator enumerator = anObject.GetEnumerator();
            bool flag = true;

            while (enumerator.MoveNext())
            {
                string aString = enumerator.get_Key().ToString();
                object value   = enumerator.get_Value();
                if (!flag)
                {
                    builder.Append(", ");
                }
                MiniJSON.serializeString(aString, builder);
                builder.Append(":");
                if (!MiniJSON.serializeValue(value, builder))
                {
                    return(false);
                }
                flag = false;
            }
            builder.Append("}");
            return(true);
        }
        private static void Write(BinaryWriter InWriterRef, SecurityElement InElement, byte InType)
        {
            InWriterRef.Write(InType);
            InWriterRef.WriteString(InElement.get_Tag());
            InWriterRef.WriteString(InElement.get_Text());
            Hashtable attributes = InElement.get_Attributes();
            int       num        = (attributes != null) ? attributes.get_Count() : 0;

            InWriterRef.Write(num);
            if (attributes != null)
            {
                IDictionaryEnumerator enumerator = attributes.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    string text  = enumerator.get_Key() as string;
                    string text2 = enumerator.get_Value() as string;
                    DebugHelper.Assert(text != null && text2 != null, "Invalid Attributes");
                    InWriterRef.WriteString(text);
                    InWriterRef.WriteString(text2);
                }
            }
            ArrayList children = InElement.get_Children();
            int       num2     = (children != null) ? children.get_Count() : 0;

            InWriterRef.Write(num2);
            if (children != null)
            {
                IEnumerator enumerator2 = children.GetEnumerator();
                while (enumerator2.MoveNext())
                {
                    SecurityElement securityElement = enumerator2.get_Current() as SecurityElement;
                    DebugHelper.Assert(securityElement != null, "Invalid Security Element.");
                    SecurityTools.Write(InWriterRef, securityElement, 1);
                }
            }
        }