Пример #1
0
 internal static int ChooseWCharSet(CodeSetComponentData codeSetComponent)
 {
     if (codeSetComponent.NativeWCharSet == DefaultWCharSet)
     {
         // the same native wchar sets
         return(codeSetComponent.NativeWCharSet);
     }
     if (IsWCharSetCompatible(codeSetComponent.NativeWCharSet))
     {
         // client converts to server's native wchar set
         return(codeSetComponent.NativeWCharSet);
     }
     int[] serverConvSets = codeSetComponent.WCharConvSet;
     foreach (int serverConvSet in serverConvSets)
     {
         if (serverConvSet == DefaultWCharSet)
         {
             // server convert's from client's native wchar set
             return(serverConvSet);
         }
     }
     foreach (int serverConvSet in serverConvSets)
     {
         if (IsWCharSetCompatible(serverConvSet))
         {
             // use a conversion code set which is available for client and server
             return(serverConvSet);
         }
     }
     throw new CODESET_INCOMPATIBLE(9502, CompletionStatus.Completed_No);
 }
Пример #2
0
 public void TestAddTaggedComponent()
 {
     CodeSetComponentData codeSetCompVal =
         new CodeSetComponentData((int)CharSet.LATIN1,
                                  new int[] { (int)CharSet.LATIN1 },
                                  (int)WCharSet.UTF16,
                                  new int[] { (int)WCharSet.UTF16 });
     TaggedComponent codeSetComponent =
         new TaggedComponent(TAG_CODE_SETS.ConstVal,
                             m_codec.encode_value(codeSetCompVal));
     m_profile.AddTaggedComponent(codeSetComponent);
     Assert.AreEqual(1, m_profile.TaggedComponents.Count, "tagged components one entry");
     Assert.IsTrue(m_profile.ContainsTaggedComponent(TAG_CODE_SETS.ConstVal), "not found code set component");
     CodeSetComponentData retrieved =
         (CodeSetComponentData)m_profile.TaggedComponents.GetComponentData(TAG_CODE_SETS.ConstVal,
                                                                m_codec,
                                                                CodeSetComponentData.TypeCode);
     Assert.NotNull(retrieved, "not found code set component");
     Assert.AreEqual(codeSetCompVal.NativeCharSet, retrieved.NativeCharSet, "char set");
     Assert.AreEqual(codeSetCompVal.NativeWCharSet, retrieved.NativeWCharSet, "wchar set");
 }
Пример #3
0
 internal static int ChooseWCharSet(CodeSetComponentData codeSetComponent) {
     if (codeSetComponent.NativeWCharSet == DefaultWCharSet) {
         // the same native wchar sets
         return codeSetComponent.NativeWCharSet;
     }
     if (IsWCharSetCompatible(codeSetComponent.NativeWCharSet)) {
         // client converts to server's native wchar set
         return codeSetComponent.NativeWCharSet;
     }
     int[] serverConvSets = codeSetComponent.WCharConvSet;
     foreach (int serverConvSet in serverConvSets) {
         if (serverConvSet == DefaultWCharSet) {
             // server convert's from client's native wchar set
             return serverConvSet;
         }
     }
     foreach (int serverConvSet in serverConvSets) {
         if (IsWCharSetCompatible(serverConvSet)) {
             // use a conversion code set which is available for client and server
             return serverConvSet;
         }
     }
     throw new CODESET_INCOMPATIBLE(9502, CompletionStatus.Completed_No);
 }