示例#1
0
        public static void Test_TypeValues_02(string file, params string[] values)
        {
            bool onlyNextValue = true;
            //bool onlyNextValue = false;

            TypeValues<Test_Company> typeValues = new TypeValues<Test_Company>();

            foreach (string value in values)
                typeValues.AddValue(value);

            int index = 1;
            foreach (Test_Company company in Test_Data.GetCompanies(file))
            {
                typeValues.SetData(company);
                Trace.WriteLine("row {0}", index++);

                foreach (string value in values)
                    Trace.Write("  {0,-20}", value);
                Trace.WriteLine();

                foreach (string value in values)
                    Trace.Write("  {0,-20}", typeValues.GetValue(value));
                Trace.WriteLine();

                while (typeValues.NextValues())
                {
                    foreach (string value in values)
                        Trace.Write("  {0,-20}", typeValues.GetValue(value, onlyNextValue: onlyNextValue));
                    Trace.WriteLine();
                }

                Trace.WriteLine();
            }
        }
示例#2
0
文件: XmlExport.cs 项目: 24/source_04
        private void CreateXmlValuesExport()
        {
            _typeValues = new TypeValues <T>();
            List <XmlValueExport> valueList = new List <XmlValueExport>();

            if (_xmlDefinition.ValuesDefinition != null)
            {
                foreach (XmlValueDefinition valueDefinition in _xmlDefinition.ValuesDefinition)
                {
                    XmlValueExport xmlValueExport = new XmlValueExport();
                    xmlValueExport.ElementName   = valueDefinition.ElementName;
                    xmlValueExport.TypeValueNode = _typeValues.AddValue(valueDefinition.ValueName, MemberType.Instance | MemberType.Public | MemberType.Field | MemberType.Property,
                                                                        valueDefinition.NotEnumerable);
                    xmlValueExport.TransformValue = valueDefinition.TransformValue;
                    valueList.Add(xmlValueExport);
                }
            }
            else
            {
                _typeValues.AddAllValues(MemberType.Instance | MemberType.Public | MemberType.Field | MemberType.Property);
                foreach (TypeValueNode typeValueNode in _typeValues.TypeValueNodes.Values)
                {
                    if (typeValueNode.TypeValueAccess.IsValueType)
                    {
                        XmlValueExport xmlValueExport = new XmlValueExport();
                        xmlValueExport.ElementName   = typeValueNode.TypeValueAccess.TreeName;
                        xmlValueExport.TypeValueNode = typeValueNode;
                        valueList.Add(xmlValueExport);
                    }
                }
            }
            _valuesExport = valueList.ToArray();
        }
示例#3
0
        public static void Test_TypeValues_02(string file, params string[] values)
        {
            bool onlyNextValue = true;
            //bool onlyNextValue = false;

            TypeValues <Test_Company> typeValues = new TypeValues <Test_Company>();

            foreach (string value in values)
            {
                typeValues.AddValue(value);
            }

            int index = 1;

            foreach (Test_Company company in Test_Data.GetCompanies(file))
            {
                typeValues.SetData(company);
                Trace.WriteLine("row {0}", index++);

                foreach (string value in values)
                {
                    Trace.Write("  {0,-20}", value);
                }
                Trace.WriteLine();

                foreach (string value in values)
                {
                    Trace.Write("  {0,-20}", typeValues.GetValue(value));
                }
                Trace.WriteLine();

                while (typeValues.NextValues())
                {
                    foreach (string value in values)
                    {
                        Trace.Write("  {0,-20}", typeValues.GetValue(value, onlyNextValue: onlyNextValue));
                    }
                    Trace.WriteLine();
                }

                Trace.WriteLine();
            }
        }