public override bool TryResolveType(Type dataContractType, Type declaredType, DataContractResolver knownTypeResolver, out XmlDictionaryString typeName, out XmlDictionaryString typeNamespace)
    {
        if (!knownTypeResolver.TryResolveType(dataContractType, declaredType, null, out typeName, out typeNamespace))
        {

            XmlDictionary dictionary = new XmlDictionary();

            typeName = dictionary.Add(dataContractType.FullName);

            typeNamespace = dictionary.Add(dataContractType.Assembly.FullName);

        }

        return true;
    }
Example #2
0
 internal XmlDataContractCriticalHelper(Type type) : base(type)
 {
     if (type.GetTypeInfo().IsDefined(Globals.TypeOfDataContractAttribute, false))
         throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.Format(SR.IXmlSerializableCannotHaveDataContract, DataContract.GetClrTypeFullName(type))));
     if (type.GetTypeInfo().IsDefined(Globals.TypeOfCollectionDataContractAttribute, false))
         throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.Format(SR.IXmlSerializableCannotHaveCollectionDataContract, DataContract.GetClrTypeFullName(type))));
     XmlSchemaType xsdType;
     bool hasRoot;
     XmlQualifiedName stableName;
     SchemaExporter.GetXmlTypeInfo(type, out stableName, out xsdType, out hasRoot);
     this.StableName = stableName;
     this.HasRoot = hasRoot;
     XmlDictionary dictionary = new XmlDictionary();
     this.Name = dictionary.Add(StableName.Name);
     this.Namespace = dictionary.Add(StableName.Namespace);
     object[] xmlRootAttributes = (UnderlyingType == null) ? null : UnderlyingType.GetTypeInfo().GetCustomAttributes(Globals.TypeOfXmlRootAttribute, false).ToArray();
     if (xmlRootAttributes == null || xmlRootAttributes.Length == 0)
     {
         if (hasRoot)
         {
             _topLevelElementName = Name;
             _topLevelElementNamespace = (this.StableName.Namespace == Globals.SchemaNamespace) ? DictionaryGlobals.EmptyString : Namespace;
         }
     }
     else
     {
         if (hasRoot)
         {
             XmlRootAttribute xmlRootAttribute = (XmlRootAttribute)xmlRootAttributes[0];
             string elementName = xmlRootAttribute.ElementName;
             _topLevelElementName = (elementName == null || elementName.Length == 0) ? Name : dictionary.Add(DataContract.EncodeLocalName(elementName));
             string elementNs = xmlRootAttribute.Namespace;
             _topLevelElementNamespace = (elementNs == null || elementNs.Length == 0) ? DictionaryGlobals.EmptyString : dictionary.Add(elementNs);
         }
         else
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.Format(SR.IsAnyCannotHaveXmlRoot, DataContract.GetClrTypeFullName(UnderlyingType))));
         }
     }
 }
        public DataContractSerializer(Type type, string rootName, string rootNamespace, IEnumerable <Type> knownTypes)
        {
            XmlDictionary dictionary = new XmlDictionary(2);

            Initialize(type, dictionary.Add(rootName), dictionary.Add(DataContract.GetNamespace(rootNamespace)), knownTypes, int.MaxValue, false, false, null, false);
        }
Example #4
0
        public void ShouldRejectDuplicateKeys()
        {
            var dictionary = new XmlDictionary
            {
                {"key1", "value1"},
                {"key2", "value2"}
            };

            // Check for duplicate keys when adding new entries
            dictionary.Invoking(x => x.Add("key1", "newValue1")).ShouldThrow<ArgumentException>();

            // Check for duplicate keys when modifying existing entries
            var entry = new XmlDictionaryEntry("key3", "value3");
            dictionary.Add(entry);
            entry.Invoking(x => x.Key = "key1").ShouldThrow<InvalidOperationException>();
        }
Example #5
0
        public override bool TryResolveType(Type type,
                                            Type declaredType,
                                            DataContractResolver knownTypeResolver,
                                            out XmlDictionaryString typeName,
                                            out XmlDictionaryString typeNamespace)
        {
            if (type == typeof(SdkMessages))
            {
                var dictionary = new XmlDictionary();
                typeName      = dictionary.Add(Names.SdkMessages);
                typeNamespace = dictionary.Add(CrmSvcUtilNamespace);
                return(true); // indicating that this resolver knows how to handle "SdkMessages"
            }
            if (type == typeof(SdkMessage))
            {
                var dictionary = new XmlDictionary();
                typeName      = dictionary.Add(Names.SdkMessage);
                typeNamespace = dictionary.Add(CrmSvcUtilNamespace);
                return(true); // indicating that this resolver knows how to handle "SdkMessages"
            }
            if (type == typeof(SdkMessagePair))
            {
                var dictionary = new XmlDictionary();
                typeName      = dictionary.Add(Names.SdkMessagePair);
                typeNamespace = dictionary.Add(CrmSvcUtilNamespace);
                return(true); // indicating that this resolver knows how to handle "SdkMessages"
            }
            if (type == typeof(SdkMessageRequest))
            {
                var dictionary = new XmlDictionary();
                typeName      = dictionary.Add(Names.SdkMessageRequest);
                typeNamespace = dictionary.Add(CrmSvcUtilNamespace);
                return(true); // indicating that this resolver knows how to handle "SdkMessages"
            }
            if (type == typeof(SdkMessageRequestField))
            {
                var dictionary = new XmlDictionary();
                typeName      = dictionary.Add(Names.SdkMessageRequestField);
                typeNamespace = dictionary.Add(CrmSvcUtilNamespace);
                return(true); // indicating that this resolver knows how to handle "SdkMessages"
            }
            if (type == typeof(SdkMessageResponse))
            {
                var dictionary = new XmlDictionary();
                typeName      = dictionary.Add(Names.SdkMessageResponse);
                typeNamespace = dictionary.Add(CrmSvcUtilNamespace);
                return(true); // indicating that this resolver knows how to handle "SdkMessages"
            }
            if (type == typeof(SdkMessageResponseField))
            {
                var dictionary = new XmlDictionary();
                typeName      = dictionary.Add(Names.SdkMessageResponseField);
                typeNamespace = dictionary.Add(CrmSvcUtilNamespace);
                return(true); // indicating that this resolver knows how to handle "SdkMessages"
            }

            // Defer to the known type resolver
            var value = knownTypeResolver.TryResolveType(type, declaredType, knownTypeResolver, out typeName, out typeNamespace);

            if (!value)
            {
                value = true;
            }
            return(value);
        }
Example #6
0
        static DictionaryGlobals()
        {
            // Update array size when adding new strings or templates
            XmlDictionary dictionary = new XmlDictionary(61);

            try
            {
                // 0
                SchemaInstanceNamespace = dictionary.Add(Globals.SchemaInstanceNamespace);
                SerializationNamespace  = dictionary.Add(Globals.SerializationNamespace);
                SchemaNamespace         = dictionary.Add(Globals.SchemaNamespace);
                XsiTypeLocalName        = dictionary.Add(Globals.XsiTypeLocalName);
                XsiNilLocalName         = dictionary.Add(Globals.XsiNilLocalName);

                // 5
                IdLocalName        = dictionary.Add(Globals.IdLocalName);
                RefLocalName       = dictionary.Add(Globals.RefLocalName);
                ArraySizeLocalName = dictionary.Add(Globals.ArraySizeLocalName);
                EmptyString        = dictionary.Add(String.Empty);
                // 10
                XmlnsNamespace        = dictionary.Add(Globals.XmlnsNamespace);
                CharLocalName         = dictionary.Add("char");
                BooleanLocalName      = dictionary.Add("boolean");
                SignedByteLocalName   = dictionary.Add("byte");
                UnsignedByteLocalName = dictionary.Add("unsignedByte");

                // 15
                ShortLocalName         = dictionary.Add("short");
                UnsignedShortLocalName = dictionary.Add("unsignedShort");
                IntLocalName           = dictionary.Add("int");
                UnsignedIntLocalName   = dictionary.Add("unsignedInt");
                LongLocalName          = dictionary.Add("long");

                // 20
                UnsignedLongLocalName = dictionary.Add("unsignedLong");
                FloatLocalName        = dictionary.Add("float");
                DoubleLocalName       = dictionary.Add("double");
                DecimalLocalName      = dictionary.Add("decimal");
                DateTimeLocalName     = dictionary.Add("dateTime");

                // 25
                StringLocalName    = dictionary.Add("string");
                ByteArrayLocalName = dictionary.Add("base64Binary");
                ObjectLocalName    = dictionary.Add("anyType");
                TimeSpanLocalName  = dictionary.Add("duration");
                GuidLocalName      = dictionary.Add("guid");

                // 30
                UriLocalName         = dictionary.Add("anyURI");
                QNameLocalName       = dictionary.Add("QName");
                ClrTypeLocalName     = dictionary.Add(Globals.ClrTypeLocalName);
                ClrAssemblyLocalName = dictionary.Add(Globals.ClrAssemblyLocalName);
                Space = dictionary.Add(Globals.Space);

                hexBinaryLocalName = dictionary.Add("hexBinary");
                // Add new templates here
            }
            catch (Exception ex)
            {
                if (DiagnosticUtility.IsFatal(ex))
                {
                    throw;
                }
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperFatal(ex.Message, ex);
            }
        }
 public override void OnInspectorGUI()
 {
     serializedObject.Update();
     //disableMargin = true;
     //UseDefaultMargins();
     flowchart.graph = (VCSUGraph)EditorGUILayout.ObjectField("Graph", flowchart.graph, typeof(VCSUGraph), true);
     if (flowchart.graph)
     {
         if (AssetDatabase.Contains(flowchart.graph))
         {
             flowchart.graph = VCSUObject.Clone(flowchart.graph);
         }
     }
     if (!EditorApplication.isPlaying)
     {
         if (GUILayout.Button("Generate Test Script"))
         {
             var dc = new DynamicClass();
             dc.Import(flowchart.graph);
             dc.Export();
         }
     }
     GUILayout.BeginHorizontal(EditorStyles.inspectorDefaultMargins);
     if (GUILayout.Button("Open Graph"))
     {
         FlowchartEditorWindow.Init(flowchart.graph);
     }
     if (GUILayout.Button("Revert To Original"))
     {
         var oGraph = (VCSUGraph)EditorUtility.InstanceIDToObject(flowchart.graph.OriginalIID);
         if (!oGraph)
         {
             oGraph = AssetDatabase.LoadAssetAtPath <VCSUGraph>(flowchart.graph.OriginalPath);
         }
         if (oGraph)
         {
             flowchart.graph = VCSUObject.Clone(oGraph);
         }
     }
     if (GUILayout.Button("Apply To Original Graph"))
     {
         var oGraph = (VCSUGraph)EditorUtility.InstanceIDToObject(flowchart.graph.OriginalIID);
         if (!oGraph)
         {
             oGraph = AssetDatabase.LoadAssetAtPath <VCSUGraph>(flowchart.graph.OriginalPath);
         }
         if (oGraph)
         {
             VCSUObject.ApplyFromClone(flowchart.graph, oGraph);
         }
     }
     GUILayout.EndHorizontal();
     if (variables != null)
     {
         XmlDictionary <string, VariableTest> renameds = new XmlDictionary <string, VariableTest>();
         foreach (var variable in variables)
         {
             var frect    = EditorGUILayout.BeginVertical(EditorStyles.inspectorFullWidthMargins);
             var fboxRect = new Rect(frect.x, frect.y - 1.5f, frect.width + 1, frect.height + 2.5f);
             GUI.Box(fboxRect, "");
             GUI.Button(new Rect(frect.x + 5, frect.center.y - 7.5f, 20, 20), '\u003D'.ToString(), GUIStyle.none);
             var name = variable.Value.name;
             GUILayout.BeginHorizontal();
             GUILayout.Space(15);
             variable.Value.name = EditorGUILayout.TextField(variable.Value.name);
             GUILayout.EndHorizontal();
             var variableType = variable.Value.variableType;
             GUILayout.BeginHorizontal();
             GUILayout.Space(15);
             variable.Value.variableType = (VariableType)EditorGUILayout.EnumPopup(variable.Value.variableType);
             GUILayout.EndHorizontal();
             if (variableType != variable.Value.variableType)
             {
                 GUIChanged = true;
             }
             Tuple <bool, object> value = null;
             GUILayout.BeginHorizontal();
             GUILayout.Space(15);
             if (variable.Value.variableType != VariableType.Object)
             {
                 value = GUIExtended.DrawGUISwitch(variable.Value.variableType.ToString(), variable.Value.value);
             }
             else
             {
                 value = GUIExtended.DrawGUIUObject(variable.Value.value);
             }
             GUILayout.EndHorizontal();
             if (value != null)
             {
                 if (value.Item1 == true)
                 {
                     GUIChanged = true;
                 }
                 variable.Value.value = value.Item2;
             }
             if (name != variable.Value.name)
             {
                 renameds.Add(variable.Key, variable.Value);
             }
             EditorGUILayout.EndVertical();
         }
         foreach (var renamed in renameds)
         {
             var index = variables.Values.IndexOf(renamed.Value);
             variables.RemoveAt(index);
             if (variables.Count < index)
             {
                 variables.Add(renamed.Key, renamed.Value);
             }
             else
             {
                 variables.Insert(index, new XmlKeyValuePair <string, VariableTest>(renamed.Key, renamed.Value));
             }
         }
         var trect    = EditorGUILayout.BeginHorizontal(EditorStyles.inspectorFullWidthMargins);
         var rect     = GUILayoutUtility.GetRect(trect.width, trect.height + 16);
         var tboxRect = new Rect(trect.x, rect.y, trect.width - 30, rect.height);
         TempVariable = EditorGUI.TextField(tboxRect, TempVariable);
         if (GUI.Button(new Rect(trect.width - 30, rect.y, 30, rect.height), '\u002B'.ToString()) && !string.IsNullOrEmpty(TempVariable))
         {
             var variable = new VariableTest();
             variable.name = TempVariable;
             variables.Add(TempVariable, variable);
             TempVariable = string.Empty;
             GUIChanged   = true;
         }
         if (string.IsNullOrEmpty(TempVariable))
         {
             EditorGUI.LabelField(tboxRect, "(New Variable Name)", TempLable());
         }
         EditorGUILayout.EndHorizontal();
         GUILayout.BeginHorizontal();
         if (GUILayout.Button("REMOVE"))
         {
             if (variables.Count > 0)
             {
                 variables.RemoveAt(variables.IndexOf(variables.Last()));
                 GUIChanged = true;
             }
         }
         GUILayout.EndHorizontal();
     }
     if (variables != null && variables.Count > 0)
     {
         SerializeData();
     }
     serializedObject.ApplyModifiedProperties();
 }
Example #8
0
 public Wsrm11Dictionary(XmlDictionary dictionary)
 {
     this.AckRequestedAction           = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/AckRequested");
     this.CloseSequence                = dictionary.Add("CloseSequence");
     this.CloseSequenceAction          = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/CloseSequence");
     this.CloseSequenceResponse        = dictionary.Add("CloseSequenceResponse");
     this.CloseSequenceResponseAction  = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/CloseSequenceResponse");
     this.CreateSequenceAction         = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/CreateSequence");
     this.CreateSequenceResponseAction = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/CreateSequenceResponse");
     this.DiscardFollowingFirstGap     = dictionary.Add("DiscardFollowingFirstGap");
     this.Endpoint    = dictionary.Add("Endpoint");
     this.FaultAction = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/fault");
     this.Final       = dictionary.Add("Final");
     this.IncompleteSequenceBehavior = dictionary.Add("IncompleteSequenceBehavior");
     this.LastMsgNumber    = dictionary.Add("LastMsgNumber");
     this.MaxMessageNumber = dictionary.Add("MaxMessageNumber");
     this.Namespace        = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702");
     this.NoDiscard        = dictionary.Add("NoDiscard");
     this.None             = dictionary.Add("None");
     this.SequenceAcknowledgementAction = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/SequenceAcknowledgement");
     this.SequenceClosed                  = dictionary.Add("SequenceClosed");
     this.TerminateSequenceAction         = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/TerminateSequence");
     this.TerminateSequenceResponse       = dictionary.Add("TerminateSequenceResponse");
     this.TerminateSequenceResponseAction = dictionary.Add("http://docs.oasis-open.org/ws-rx/wsrm/200702/TerminateSequenceResponse");
     this.UsesSequenceSSL                 = dictionary.Add("UsesSequenceSSL");
     this.UsesSequenceSTR                 = dictionary.Add("UsesSequenceSTR");
     this.WsrmRequired = dictionary.Add("WsrmRequired");
 }
        private static bool TryParseArgs(string[] args, out string binaryFileName, out IXmlDictionary xmlDictionary, out XmlBinaryReaderSession readerSession)
        {
            binaryFileName = null;
            xmlDictionary  = null;
            readerSession  = null;
            bool   useDictionaries       = true;
            string staticDictionaryFile  = null;
            string dynamicDictionaryFile = null;
            int    offset = 0;

            while (offset < args.Length)
            {
                if (args[offset] == "-static")
                {
                    if (offset + 1 >= args.Length)
                    {
                        return(false);
                    }

                    staticDictionaryFile = args[offset + 1];
                    offset += 2;
                }
                if (args[offset] == "-session")
                {
                    if (offset + 1 >= args.Length)
                    {
                        return(false);
                    }

                    dynamicDictionaryFile = args[offset + 1];
                    offset += 2;
                }
                else if (args[offset] == "-noDict")
                {
                    offset++;
                    useDictionaries = false;
                }
                else
                {
                    binaryFileName = args[offset];
                    offset++;
                    if (offset != args.Length)
                    {
                        return(false);
                    }
                }
            }

            if (useDictionaries)
            {
                if (staticDictionaryFile == null)
                {
                    xmlDictionary = WcfDictionary.GetStaticDictionary();
                }
                else
                {
                    XmlDictionary temp = new XmlDictionary();
                    xmlDictionary = temp;
                    foreach (string entry in File.ReadAllLines(staticDictionaryFile))
                    {
                        temp.Add(entry);
                    }
                }

                readerSession = new XmlBinaryReaderSession();
                if (dynamicDictionaryFile == null)
                {
                    for (int i = 0; i < 200; i++)
                    {
                        readerSession.Add(i, "session_" + i);
                    }
                }
                else
                {
                    string[] lines = File.ReadAllLines(dynamicDictionaryFile);
                    for (int i = 0; i < lines.Length; i++)
                    {
                        readerSession.Add(i, lines[i]);
                    }
                }
            }
            else
            {
                readerSession = null;
                xmlDictionary = null;
            }

            return(true);
        }
Example #10
0
 static WcfDictionaryBuilder()
 {
     dict = new XmlDictionary();
     dict.Add("mustUnderstand");
     dict.Add("Envelope");
     dict.Add("http://www.w3.org/2003/05/soap-envelope");
     dict.Add("http://www.w3.org/2005/08/addressing");
     dict.Add("Header");
     dict.Add("Action");
     dict.Add("To");
     dict.Add("Body");
     dict.Add("Algorithm");
     dict.Add("RelatesTo");
     dict.Add("http://www.w3.org/2005/08/addressing/anonymous");
     dict.Add("URI");
     dict.Add("Reference");
     dict.Add("MessageID");
     dict.Add("Id");
     dict.Add("Identifier");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/rm");
     dict.Add("Transforms");
     dict.Add("Transform");
     dict.Add("DigestMethod");
     dict.Add("DigestValue");
     dict.Add("Address");
     dict.Add("ReplyTo");
     dict.Add("SequenceAcknowledgement");
     dict.Add("AcknowledgementRange");
     dict.Add("Upper");
     dict.Add("Lower");
     dict.Add("BufferRemaining");
     dict.Add("http://schemas.microsoft.com/ws/2006/05/rm");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/rm/SequenceAcknowledgement");
     dict.Add("SecurityTokenReference");
     dict.Add("Sequence");
     dict.Add("MessageNumber");
     dict.Add("http://www.w3.org/2000/09/xmldsig#");
     dict.Add("http://www.w3.org/2000/09/xmldsig#enveloped-signature");
     dict.Add("KeyInfo");
     dict.Add("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
     dict.Add("http://www.w3.org/2001/04/xmlenc#");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/sc");
     dict.Add("DerivedKeyToken");
     dict.Add("Nonce");
     dict.Add("Signature");
     dict.Add("SignedInfo");
     dict.Add("CanonicalizationMethod");
     dict.Add("SignatureMethod");
     dict.Add("SignatureValue");
     dict.Add("DataReference");
     dict.Add("EncryptedData");
     dict.Add("EncryptionMethod");
     dict.Add("CipherData");
     dict.Add("CipherValue");
     dict.Add("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd");
     dict.Add("Security");
     dict.Add("Timestamp");
     dict.Add("Created");
     dict.Add("Expires");
     dict.Add("Length");
     dict.Add("ReferenceList");
     dict.Add("ValueType");
     dict.Add("Type");
     dict.Add("EncryptedHeader");
     dict.Add("http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd");
     dict.Add("RequestSecurityTokenResponseCollection");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust#BinarySecret");
     dict.Add("http://schemas.microsoft.com/ws/2006/02/transactions");
     dict.Add("s");
     dict.Add("Fault");
     dict.Add("MustUnderstand");
     dict.Add("role");
     dict.Add("relay");
     dict.Add("Code");
     dict.Add("Reason");
     dict.Add("Text");
     dict.Add("Node");
     dict.Add("Role");
     dict.Add("Detail");
     dict.Add("Value");
     dict.Add("Subcode");
     dict.Add("NotUnderstood");
     dict.Add("qname");
     dict.Add("");
     dict.Add("From");
     dict.Add("FaultTo");
     dict.Add("EndpointReference");
     dict.Add("PortType");
     dict.Add("ServiceName");
     dict.Add("PortName");
     dict.Add("ReferenceProperties");
     dict.Add("RelationshipType");
     dict.Add("Reply");
     dict.Add("a");
     dict.Add("http://schemas.xmlsoap.org/ws/2006/02/addressingidentity");
     dict.Add("Identity");
     dict.Add("Spn");
     dict.Add("Upn");
     dict.Add("Rsa");
     dict.Add("Dns");
     dict.Add("X509v3Certificate");
     dict.Add("http://www.w3.org/2005/08/addressing/fault");
     dict.Add("ReferenceParameters");
     dict.Add("IsReferenceParameter");
     dict.Add("http://www.w3.org/2005/08/addressing/reply");
     dict.Add("http://www.w3.org/2005/08/addressing/none");
     dict.Add("Metadata");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/08/addressing");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/08/addressing/fault");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/06/addressingex");
     dict.Add("RedirectTo");
     dict.Add("Via");
     dict.Add("http://www.w3.org/2001/10/xml-exc-c14n#");
     dict.Add("PrefixList");
     dict.Add("InclusiveNamespaces");
     dict.Add("ec");
     dict.Add("SecurityContextToken");
     dict.Add("Generation");
     dict.Add("Label");
     dict.Add("Offset");
     dict.Add("Properties");
     dict.Add("Cookie");
     dict.Add("wsc");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/04/sc");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/04/security/sc/dk");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/04/security/sc/sct");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/04/security/trust/RST/SCT");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/04/security/trust/RSTR/SCT");
     dict.Add("RenewNeeded");
     dict.Add("BadContextToken");
     dict.Add("c");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/sc/dk");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/sc/sct");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/SCT");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT/Renew");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/SCT/Renew");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT/Cancel");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/SCT/Cancel");
     dict.Add("http://www.w3.org/2001/04/xmlenc#aes128-cbc");
     dict.Add("http://www.w3.org/2001/04/xmlenc#kw-aes128");
     dict.Add("http://www.w3.org/2001/04/xmlenc#aes192-cbc");
     dict.Add("http://www.w3.org/2001/04/xmlenc#kw-aes192");
     dict.Add("http://www.w3.org/2001/04/xmlenc#aes256-cbc");
     dict.Add("http://www.w3.org/2001/04/xmlenc#kw-aes256");
     dict.Add("http://www.w3.org/2001/04/xmlenc#des-cbc");
     dict.Add("http://www.w3.org/2000/09/xmldsig#dsa-sha1");
     dict.Add("http://www.w3.org/2001/10/xml-exc-c14n#WithComments");
     dict.Add("http://www.w3.org/2000/09/xmldsig#hmac-sha1");
     dict.Add("http://www.w3.org/2001/04/xmldsig-more#hmac-sha256");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/sc/dk/p_sha1");
     dict.Add("http://www.w3.org/2001/04/xmlenc#ripemd160");
     dict.Add("http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p");
     dict.Add("http://www.w3.org/2000/09/xmldsig#rsa-sha1");
     dict.Add("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256");
     dict.Add("http://www.w3.org/2001/04/xmlenc#rsa-1_5");
     dict.Add("http://www.w3.org/2000/09/xmldsig#sha1");
     dict.Add("http://www.w3.org/2001/04/xmlenc#sha256");
     dict.Add("http://www.w3.org/2001/04/xmlenc#sha512");
     dict.Add("http://www.w3.org/2001/04/xmlenc#tripledes-cbc");
     dict.Add("http://www.w3.org/2001/04/xmlenc#kw-tripledes");
     dict.Add("http://schemas.xmlsoap.org/2005/02/trust/tlsnego#TLS_Wrap");
     dict.Add("http://schemas.xmlsoap.org/2005/02/trust/spnego#GSS_Wrap");
     dict.Add("http://schemas.microsoft.com/ws/2006/05/security");
     dict.Add("dnse");
     dict.Add("o");
     dict.Add("Password");
     dict.Add("PasswordText");
     dict.Add("Username");
     dict.Add("UsernameToken");
     dict.Add("BinarySecurityToken");
     dict.Add("EncodingType");
     dict.Add("KeyIdentifier");
     dict.Add("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary");
     dict.Add("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#HexBinary");
     dict.Add("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Text");
     dict.Add("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509SubjectKeyIdentifier");
     dict.Add("http://docs.oasis-open.org/wss/oasis-wss-kerberos-token-profile-1.1#GSS_Kerberosv5_AP_REQ");
     dict.Add("http://docs.oasis-open.org/wss/oasis-wss-kerberos-token-profile-1.1#GSS_Kerberosv5_AP_REQ1510");
     dict.Add("http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.0#SAMLAssertionID");
     dict.Add("Assertion");
     dict.Add("urn:oasis:names:tc:SAML:1.0:assertion");
     dict.Add("http://docs.oasis-open.org/wss/oasis-wss-rel-token-profile-1.0.pdf#license");
     dict.Add("FailedAuthentication");
     dict.Add("InvalidSecurityToken");
     dict.Add("InvalidSecurity");
     dict.Add("k");
     dict.Add("SignatureConfirmation");
     dict.Add("TokenType");
     dict.Add("http://docs.oasis-open.org/wss/oasis-wss-soap-message-security-1.1#ThumbprintSHA1");
     dict.Add("http://docs.oasis-open.org/wss/oasis-wss-soap-message-security-1.1#EncryptedKey");
     dict.Add("http://docs.oasis-open.org/wss/oasis-wss-soap-message-security-1.1#EncryptedKeySHA1");
     dict.Add("http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1");
     dict.Add("http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0");
     dict.Add("http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLID");
     dict.Add("AUTH-HASH");
     dict.Add("RequestSecurityTokenResponse");
     dict.Add("KeySize");
     dict.Add("RequestedTokenReference");
     dict.Add("AppliesTo");
     dict.Add("Authenticator");
     dict.Add("CombinedHash");
     dict.Add("BinaryExchange");
     dict.Add("Lifetime");
     dict.Add("RequestedSecurityToken");
     dict.Add("Entropy");
     dict.Add("RequestedProofToken");
     dict.Add("ComputedKey");
     dict.Add("RequestSecurityToken");
     dict.Add("RequestType");
     dict.Add("Context");
     dict.Add("BinarySecret");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/spnego");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/tlsnego");
     dict.Add("wst");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/04/trust");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/04/security/trust/RST/Issue");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/04/security/trust/RSTR/Issue");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/04/security/trust/CK/PSHA1");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/04/security/trust/SymmetricKey");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/04/security/trust/Nonce");
     dict.Add("KeyType");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/04/trust/SymmetricKey");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/04/trust/PublicKey");
     dict.Add("Claims");
     dict.Add("InvalidRequest");
     dict.Add("RequestFailed");
     dict.Add("SignWith");
     dict.Add("EncryptWith");
     dict.Add("EncryptionAlgorithm");
     dict.Add("CanonicalizationAlgorithm");
     dict.Add("ComputedKeyAlgorithm");
     dict.Add("UseKey");
     dict.Add("http://schemas.microsoft.com/net/2004/07/secext/WS-SPNego");
     dict.Add("http://schemas.microsoft.com/net/2004/07/secext/TLSNego");
     dict.Add("t");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/Issue");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/Issue");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/SymmetricKey");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/CK/PSHA1");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/Nonce");
     dict.Add("RenewTarget");
     dict.Add("CancelTarget");
     dict.Add("RequestedTokenCancelled");
     dict.Add("RequestedAttachedReference");
     dict.Add("RequestedUnattachedReference");
     dict.Add("IssuedTokens");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/Renew");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/Cancel");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/PublicKey");
     dict.Add("Access");
     dict.Add("AccessDecision");
     dict.Add("Advice");
     dict.Add("AssertionID");
     dict.Add("AssertionIDReference");
     dict.Add("Attribute");
     dict.Add("AttributeName");
     dict.Add("AttributeNamespace");
     dict.Add("AttributeStatement");
     dict.Add("AttributeValue");
     dict.Add("Audience");
     dict.Add("AudienceRestrictionCondition");
     dict.Add("AuthenticationInstant");
     dict.Add("AuthenticationMethod");
     dict.Add("AuthenticationStatement");
     dict.Add("AuthorityBinding");
     dict.Add("AuthorityKind");
     dict.Add("AuthorizationDecisionStatement");
     dict.Add("Binding");
     dict.Add("Condition");
     dict.Add("Conditions");
     dict.Add("Decision");
     dict.Add("DoNotCacheCondition");
     dict.Add("Evidence");
     dict.Add("IssueInstant");
     dict.Add("Issuer");
     dict.Add("Location");
     dict.Add("MajorVersion");
     dict.Add("MinorVersion");
     dict.Add("NameIdentifier");
     dict.Add("Format");
     dict.Add("NameQualifier");
     dict.Add("Namespace");
     dict.Add("NotBefore");
     dict.Add("NotOnOrAfter");
     dict.Add("saml");
     dict.Add("Statement");
     dict.Add("Subject");
     dict.Add("SubjectConfirmation");
     dict.Add("SubjectConfirmationData");
     dict.Add("ConfirmationMethod");
     dict.Add("urn:oasis:names:tc:SAML:1.0:cm:holder-of-key");
     dict.Add("urn:oasis:names:tc:SAML:1.0:cm:sender-vouches");
     dict.Add("SubjectLocality");
     dict.Add("DNSAddress");
     dict.Add("IPAddress");
     dict.Add("SubjectStatement");
     dict.Add("urn:oasis:names:tc:SAML:1.0:am:unspecified");
     dict.Add("xmlns");
     dict.Add("Resource");
     dict.Add("UserName");
     dict.Add("urn:oasis:names:tc:SAML:1.1:nameid-format:WindowsDomainQualifiedName");
     dict.Add("EmailName");
     dict.Add("urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress");
     dict.Add("u");
     dict.Add("ChannelInstance");
     dict.Add("http://schemas.microsoft.com/ws/2005/02/duplex");
     dict.Add("Encoding");
     dict.Add("MimeType");
     dict.Add("CarriedKeyName");
     dict.Add("Recipient");
     dict.Add("EncryptedKey");
     dict.Add("KeyReference");
     dict.Add("e");
     dict.Add("http://www.w3.org/2001/04/xmlenc#Element");
     dict.Add("http://www.w3.org/2001/04/xmlenc#Content");
     dict.Add("KeyName");
     dict.Add("MgmtData");
     dict.Add("KeyValue");
     dict.Add("RSAKeyValue");
     dict.Add("Modulus");
     dict.Add("Exponent");
     dict.Add("X509Data");
     dict.Add("X509IssuerSerial");
     dict.Add("X509IssuerName");
     dict.Add("X509SerialNumber");
     dict.Add("X509Certificate");
     dict.Add("AckRequested");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/rm/AckRequested");
     dict.Add("AcksTo");
     dict.Add("Accept");
     dict.Add("CreateSequence");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence");
     dict.Add("CreateSequenceRefused");
     dict.Add("CreateSequenceResponse");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequenceResponse");
     dict.Add("FaultCode");
     dict.Add("InvalidAcknowledgement");
     dict.Add("LastMessage");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/rm/LastMessage");
     dict.Add("LastMessageNumberExceeded");
     dict.Add("MessageNumberRollover");
     dict.Add("Nack");
     dict.Add("netrm");
     dict.Add("Offer");
     dict.Add("r");
     dict.Add("SequenceFault");
     dict.Add("SequenceTerminated");
     dict.Add("TerminateSequence");
     dict.Add("http://schemas.xmlsoap.org/ws/2005/02/rm/TerminateSequence");
     dict.Add("UnknownSequence");
     dict.Add("http://schemas.microsoft.com/ws/2006/02/tx/oletx");
     dict.Add("oletx");
     dict.Add("OleTxTransaction");
     dict.Add("PropagationToken");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wscoor");
     dict.Add("wscoor");
     dict.Add("CreateCoordinationContext");
     dict.Add("CreateCoordinationContextResponse");
     dict.Add("CoordinationContext");
     dict.Add("CurrentContext");
     dict.Add("CoordinationType");
     dict.Add("RegistrationService");
     dict.Add("Register");
     dict.Add("RegisterResponse");
     dict.Add("ProtocolIdentifier");
     dict.Add("CoordinatorProtocolService");
     dict.Add("ParticipantProtocolService");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wscoor/CreateCoordinationContext");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wscoor/CreateCoordinationContextResponse");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wscoor/Register");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wscoor/RegisterResponse");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wscoor/fault");
     dict.Add("ActivationCoordinatorPortType");
     dict.Add("RegistrationCoordinatorPortType");
     dict.Add("InvalidState");
     dict.Add("InvalidProtocol");
     dict.Add("InvalidParameters");
     dict.Add("NoActivity");
     dict.Add("ContextRefused");
     dict.Add("AlreadyRegistered");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wsat");
     dict.Add("wsat");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wsat/Completion");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wsat/Durable2PC");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wsat/Volatile2PC");
     dict.Add("Prepare");
     dict.Add("Prepared");
     dict.Add("ReadOnly");
     dict.Add("Commit");
     dict.Add("Rollback");
     dict.Add("Committed");
     dict.Add("Aborted");
     dict.Add("Replay");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wsat/Commit");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wsat/Rollback");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wsat/Committed");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wsat/Aborted");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wsat/Prepare");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wsat/Prepared");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wsat/ReadOnly");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wsat/Replay");
     dict.Add("http://schemas.xmlsoap.org/ws/2004/10/wsat/fault");
     dict.Add("CompletionCoordinatorPortType");
     dict.Add("CompletionParticipantPortType");
     dict.Add("CoordinatorPortType");
     dict.Add("ParticipantPortType");
     dict.Add("InconsistentInternalState");
     dict.Add("mstx");
     dict.Add("Enlistment");
     dict.Add("protocol");
     dict.Add("LocalTransactionId");
     dict.Add("IsolationLevel");
     dict.Add("IsolationFlags");
     dict.Add("Description");
     dict.Add("Loopback");
     dict.Add("RegisterInfo");
     dict.Add("ContextId");
     dict.Add("TokenId");
     dict.Add("AccessDenied");
     dict.Add("InvalidPolicy");
     dict.Add("CoordinatorRegistrationFailed");
     dict.Add("TooManyEnlistments");
     dict.Add("Disabled");
     dict.Add("ActivityId");
     dict.Add("http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics");
     dict.Add("http://docs.oasis-open.org/wss/oasis-wss-kerberos-token-profile-1.1#Kerberosv5APREQSHA1");
     dict.Add("http://schemas.xmlsoap.org/ws/2002/12/policy");
     dict.Add("FloodMessage");
     dict.Add("LinkUtility");
     dict.Add("Hops");
     dict.Add("http://schemas.microsoft.com/net/2006/05/peer/HopCount");
     dict.Add("PeerVia");
     dict.Add("http://schemas.microsoft.com/net/2006/05/peer");
     dict.Add("PeerFlooder");
     dict.Add("PeerTo");
     dict.Add("http://schemas.microsoft.com/ws/2005/05/routing");
     dict.Add("PacketRoutable");
     dict.Add("http://schemas.microsoft.com/ws/2005/05/addressing/none");
     dict.Add("http://schemas.microsoft.com/ws/2005/05/envelope/none");
     dict.Add("http://www.w3.org/2001/XMLSchema-instance");
     dict.Add("http://www.w3.org/2001/XMLSchema");
     dict.Add("nil");
     dict.Add("type");
     dict.Add("char");
     dict.Add("boolean");
     dict.Add("byte");
     dict.Add("unsignedByte");
     dict.Add("short");
     dict.Add("unsignedShort");
     dict.Add("int");
     dict.Add("unsignedInt");
     dict.Add("long");
     dict.Add("unsignedLong");
     dict.Add("float");
     dict.Add("double");
     dict.Add("decimal");
     dict.Add("dateTime");
     dict.Add("string");
     dict.Add("base64Binary");
     dict.Add("anyType");
     dict.Add("duration");
     dict.Add("guid");
     dict.Add("anyURI");
     dict.Add("QName");
     dict.Add("time");
     dict.Add("date");
     dict.Add("hexBinary");
     dict.Add("gYearMonth");
     dict.Add("gYear");
     dict.Add("gMonthDay");
     dict.Add("gDay");
     dict.Add("gMonth");
     dict.Add("integer");
     dict.Add("positiveInteger");
     dict.Add("negativeInteger");
     dict.Add("nonPositiveInteger");
     dict.Add("nonNegativeInteger");
     dict.Add("normalizedString");
     dict.Add("ConnectionLimitReached");
     dict.Add("http://schemas.xmlsoap.org/soap/envelope/");
     dict.Add("Actor");
     dict.Add("Faultcode");
     dict.Add("Faultstring");
     dict.Add("Faultactor");
     dict.Add("Detail");
 }
Example #11
0
        public void GlobalAttributes()
        {
            XmlDictionaryString ds;
            MemoryStream        ms  = new MemoryStream();
            XmlDictionary       dic = new XmlDictionary();
            int idx;
            XmlDictionaryWriter w = XmlDictionaryWriter.CreateBinaryWriter(ms, dic, null);

            dic.Add("n1");
            dic.Add("urn:foo");
            dic.Add("n2");
            dic.Add("n3");
            dic.Add("n4");
            dic.Add("urn:bar");
            dic.Add("n7");
            w.WriteStartElement(dic.Add("n1"), dic.Add("urn:foo"));
            w.WriteAttributeString(dic.Add("n2"), dic.Add("urn:bar"), String.Empty);
            w.WriteAttributeString(dic.Add("n3"), dic.Add("urn:foo"), "v");
            w.WriteAttributeString("aaa", dic.Add("n4"), dic.Add("urn:bar"), String.Empty);
            w.WriteAttributeString("bbb", "n5", "urn:foo", String.Empty);
            w.WriteAttributeString("n6", String.Empty);
            w.WriteAttributeString(dic.Add("n7"), XmlDictionaryString.Empty, String.Empty); // local attribute
            w.WriteAttributeString("bbb", "n8", "urn:foo", String.Empty);                   // xmlns:bbb mapping already exists (from StartElement = 'a'), so prefix "bbb" won't be used.
            w.Close();

            // 0x0C nameidx (value) 0x0D nameidx (value)
            // 0x07 (prefix) nameidx (value)
            // 0x05 (prefix) (name) (value)
            // 0x04...  0x06...  0x05...
            // 0x0A nsidx
            // 0x0B (prefix) nsidx
            // 0x0B...  0x0B...
            // 0x09 (prefix) (ns)
            byte [] bytes = new byte [] {
                // $@$@$$@$  !v$!aaa@
                // $@!bbb!n  5$$@$!a@
                // $!aaa!$!  bbb$urn:foo$
                0x42, 0,
                0x0C, 4, 0xA8,
                0x0D, 6, 0x98, 1, 0x76,
                0x07, 3, 0x61, 0x61, 0x61, 8, 0xA8,        // 16
                0x05, 3, 0x62, 0x62, 0x62, 2, 0x6E, 0x35, 0xA8,
                0x04, 2, 0x6E, 0x36, 0xA8,                 // 30
                0x06, 12, 0xA8,
                0x05, 3, 0x62, 0x62, 0x62, 2, 0x6E, 0x38, 0xA8,
                0x0A, 2,
                0x0B, 1, 0x61, 10,                 // 48
                0x0B, 1, 0x62, 2,
                0x0B, 3, 0x61, 0x61, 0x61, 10,
                0x09, 3, 0x62, 0x62, 0x62,
                0x07, 0x75, 0x72, 0x6E, 0x3A, 0x66, 0x6F, 0x6F,
                1
            };
            Assert.AreEqual(bytes, ms.ToArray(), "result");
        }