コード例 #1
0
		public void TestSerializeSchemaPropertyValueCollection()
		{
			System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
			System.IO.MemoryStream ms = new System.IO.MemoryStream();
			SchemaPropertyValueCollection obj1 = new SchemaPropertyValueCollection();

			SCGroup group = SCObjectGenerator.PrepareGroupObject();

			foreach (string key in group.Properties.GetAllKeys())
			{
				obj1.Add(group.Properties[key]);
			}

			bf.Serialize(ms, obj1);
			ms.Seek(0, System.IO.SeekOrigin.Begin);

			var obj2 = (SchemaPropertyValueCollection)bf.Deserialize(ms);

			Assert.AreEqual(obj1.Count, obj2.Count);

			var keys1 = obj1.GetAllKeys();

			foreach (var key in keys1)
			{
				Assert.IsTrue(obj2.ContainsKey(key));
				Assert.AreEqual(obj1[key].StringValue, obj2[key].StringValue);
			}
		}
コード例 #2
0
ファイル: SerializableTest.cs プロジェクト: wooln/AK47Source
        public void TestSerializeSchemaPropertyValueCollection()
        {
            System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
            System.IO.MemoryStream        ms   = new System.IO.MemoryStream();
            SchemaPropertyValueCollection obj1 = new SchemaPropertyValueCollection();

            SCGroup group = SCObjectGenerator.PrepareGroupObject();

            foreach (string key in group.Properties.GetAllKeys())
            {
                obj1.Add(group.Properties[key]);
            }

            bf.Serialize(ms, obj1);
            ms.Seek(0, System.IO.SeekOrigin.Begin);

            var obj2 = (SchemaPropertyValueCollection)bf.Deserialize(ms);

            Assert.AreEqual(obj1.Count, obj2.Count);

            var keys1 = obj1.GetAllKeys();

            foreach (var key in keys1)
            {
                Assert.IsTrue(obj2.ContainsKey(key));
                Assert.AreEqual(obj1[key].StringValue, obj2[key].StringValue);
            }
        }
コード例 #3
0
        /// <summary>
        /// 使用指定的<see cref="DESchemaDefine"/>初始化<see cref="SchemaPropertyValueCollection"/>的新实例
        /// </summary>
        /// <returns></returns>
        public SchemaPropertyValueCollection ToProperties()
        {
            SchemaPropertyValueCollection properties = new SchemaPropertyValueCollection();

            this.Properties.ForEach(pd => properties.Add(new SchemaPropertyValue(pd)));

            return(properties);
        }
コード例 #4
0
		/// <summary>
		/// 使用指定的<see cref="SchemaDefine"/>初始化<see cref="SchemaPropertyValueCollection"/>的新实例
		/// </summary>
		/// <returns></returns>
		public SchemaPropertyValueCollection ToProperties()
		{
			SchemaPropertyValueCollection properties = new SchemaPropertyValueCollection();

			this.Properties.ForEach(pd => properties.Add(new SchemaPropertyValue(pd)));

			return properties;
		}
コード例 #5
0
ファイル: BatchEditor.aspx.cs プロジェクト: wooln/AK47Source
        private SchemaPropertyValueCollection TabGroup(SchemaPropertyValueCollection propertyValues, string groupName)
        {
            SchemaPropertyValueCollection result = new SchemaPropertyValueCollection();

            foreach (var property in propertyValues)
            {
                if (property.Definition.Tab == groupName)
                {
                    result.Add(property);
                }
            }

            return(result);
        }
コード例 #6
0
        public SchemaPropertyValueCollection ToProperties()
        {
            SchemaPropertyValueCollection result = new SchemaPropertyValueCollection();

            this.ForEach(p =>
            {
                SchemaPropertyDefine pd = new SchemaPropertyDefine
                {
                    Name         = p.Name,
                    Description  = p.Description,
                    DefaultValue = p.DefaultValue
                };
                result.Add(new SchemaPropertyValue(pd));
            });

            return(result);
        }
コード例 #7
0
ファイル: BatchEditor.aspx.cs プロジェクト: wooln/AK47Source
        private SchemaPropertyValueCollection GetCommonValues(SchemaObjectCollection objects, List <SchemaPropertyDefineConfigurationElement> propertyDefines)
        {
            SchemaPropertyValueCollection result = new SchemaPropertyValueCollection();

            HashSet <string> pool = new HashSet <string>();

            foreach (var item in propertyDefines)
            {
                pool.Clear();

                SchemaPropertyValue val = null;

                foreach (var obj in objects)
                {
                    val = obj.Properties[item.Name];
                    pool.Add(val.StringValue);
                }

                result.Add(pool.Count == 1 ? val : new SchemaPropertyValue(val.Definition));
            }

            return(result);
        }
コード例 #8
0
		private SchemaPropertyValueCollection GetCommonValues(SchemaObjectCollection objects, List<SchemaPropertyDefineConfigurationElement> propertyDefines)
		{
			SchemaPropertyValueCollection result = new SchemaPropertyValueCollection();

			HashSet<string> pool = new HashSet<string>();

			foreach (var item in propertyDefines)
			{
				pool.Clear();

				SchemaPropertyValue val = null;

				foreach (var obj in objects)
				{
					val = obj.Properties[item.Name];
					pool.Add(val.StringValue);
				}

				result.Add(pool.Count == 1 ? val : new SchemaPropertyValue(val.Definition));
			}

			return result;
		}
コード例 #9
0
		private SchemaPropertyValueCollection TabGroup(SchemaPropertyValueCollection propertyValues, string groupName)
		{
			SchemaPropertyValueCollection result = new SchemaPropertyValueCollection();
			foreach (var property in propertyValues)
			{
				if (property.Definition.Tab == groupName)
				{
					result.Add(property);
				}
			}

			return result;
		}