public void General()
        {
            MappingTable mt = new MappingTable();

            mt.Add("1", "v1");
            mt.Add("2", "v2");

            var json = mt.ToJson();


            json = @"{
  ""valueUnique"": false,


  ""items"": [
    {
      ""s"": ""1"",
      ""m"": ""v1""
    },
    {
      ""s"": ""2"",
      ""m"": ""v2""
    }
  ],
 ""caseSensitive"": false

}";
            var mt2 = json.TryConvertJsonToObject <MappingTable <string> >();

            Assert.IsNotNull(mt2);
        }
예제 #2
0
        public Matrix(Switch switchElement, Configuration.NetworkElement networkElement)
        {
            this.switchElement = switchElement;

            mappingTable = new MappingTable();

            foreach (Configuration.RoutingEntry entry in networkElement.RoutingTable)
            {
                mappingTable.Add(new HalfEntryMapping(entry.PortIn, entry.VpiIN, entry.VciIN), new HalfEntryMapping(entry.PortOut, entry.VpiOUT, entry.VciOUT));
            }
        }
예제 #3
0
 internal AdapterTableEntry(Type type, IDictionary <ADServerType, MappingTable <AttributeConverterEntry> > attributeTable)
 {
     this._methodNames = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
     this._properties  = new Dictionary <string, PropertyInfo>(StringComparer.OrdinalIgnoreCase);
     if (attributeTable != null)
     {
         this._attributeTable = new Dictionary <ADServerType, MappingTable <AttributeConverterEntry> >();
         foreach (KeyValuePair <ADServerType, MappingTable <AttributeConverterEntry> > key in _attributeTable)
         {
             MappingTable <AttributeConverterEntry> mappingTable = new MappingTable <AttributeConverterEntry>();
             Dictionary <string, AttributeConverterEntry> .KeyCollection.Enumerator enumerator = key.Value.Keys.GetEnumerator();
             try
             {
                 while (enumerator.MoveNext())
                 {
                     string str = enumerator.Current;
                     mappingTable.Add(str, key.Value[str]);
                 }
             }
             finally
             {
                 enumerator.Dispose();
             }
             this._attributeTable.Add(key.Key, mappingTable);
         }
     }
     else
     {
         this._attributeTable = null;
     }
     PropertyInfo[] properties = type.GetProperties();
     for (int i = 0; i < (int)properties.Length; i++)
     {
         PropertyInfo propertyInfo = properties[i];
         this._properties.Add(propertyInfo.Name, propertyInfo);
     }
     MethodInfo[] methods = type.GetMethods();
     for (int j = 0; j < (int)methods.Length; j++)
     {
         MethodInfo methodInfo = methods[j];
         this._methodNames.Add(methodInfo.Name);
     }
 }
예제 #4
0
		internal AdapterTableEntry(Type type, IDictionary<ADServerType, MappingTable<AttributeConverterEntry>> attributeTable)
		{
			this._methodNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
			this._properties = new Dictionary<string, PropertyInfo>(StringComparer.OrdinalIgnoreCase);
			if (attributeTable != null)
			{
				this._attributeTable = new Dictionary<ADServerType, MappingTable<AttributeConverterEntry>>();
				foreach (KeyValuePair<ADServerType, MappingTable<AttributeConverterEntry>> key in _attributeTable)
				{
					MappingTable<AttributeConverterEntry> mappingTable = new MappingTable<AttributeConverterEntry>();
					Dictionary<string, AttributeConverterEntry>.KeyCollection.Enumerator enumerator = key.Value.Keys.GetEnumerator();
					try
					{
						while (enumerator.MoveNext())
						{
							string str = enumerator.Current;
							mappingTable.Add(str, key.Value[str]);
						}
					}
					finally
					{
						enumerator.Dispose();
					}
					this._attributeTable.Add(key.Key, mappingTable);
				}
			}
			else
			{
				this._attributeTable = null;
			}
			PropertyInfo[] properties = type.GetProperties();
			for (int i = 0; i < (int)properties.Length; i++)
			{
				PropertyInfo propertyInfo = properties[i];
				this._properties.Add(propertyInfo.Name, propertyInfo);
			}
			MethodInfo[] methods = type.GetMethods();
			for (int j = 0; j < (int)methods.Length; j++)
			{
				MethodInfo methodInfo = methods[j];
				this._methodNames.Add(methodInfo.Name);
			}
		}