示例#1
0
        private static void Main(string[] args)
        {
            if (args.Length != 1 || args[0] != "generate")
            {
                return;
            }

            string outputPath = args.Length == 2 ? args[1] : CrossFrameworkInitializer.DefaultOutputPath;

            if (!Directory.Exists(outputPath))
            {
                Directory.CreateDirectory(outputPath);
            }

            CrossFrameworkClass crossFrameworkClass = CrossFrameworkInitializer.Init();
            var crossFrameworkMixedClass            = CrossFrameworkInitializer.InitMixed();

            string fileName = $"test_file_{FrameworkName.ToLowerInvariant()}.tf";
            string fullPath = Path.Combine(outputPath, fileName);

            using (var fileStream = new FileStream(fullPath, FileMode.Create))
            {
                Serializer.Serialize(crossFrameworkClass, fileStream);
            }

            fileName = $"mixed_test_file_{FrameworkName.ToLowerInvariant()}.tf";
            fullPath = Path.Combine(outputPath, fileName);
            using (var fileStream = new FileStream(fullPath, FileMode.Create))
            {
                Serializer.Serialize(crossFrameworkMixedClass, fileStream);
            }
        }
示例#2
0
 private bool Equals(CrossFrameworkClass other)
 {
     return(Sbyte == other.Sbyte &&
            Short == other.Short &&
            Int == other.Int &&
            Long == other.Long &&
            Byte == other.Byte &&
            UShort == other.UShort &&
            UInt == other.UInt &&
            ULong == other.ULong &&
            Char == other.Char &&
            Math.Abs(Float - other.Float) < float.Epsilon &&
            Math.Abs(Double - other.Double) < double.Epsilon &&
            Decimal == other.Decimal &&
            Boolean == other.Boolean &&
            string.Equals(String, other.String) &&
            DateTime.Equals(other.DateTime)
            // && Equals(Exception, other.Exception)
            && Exception.Message == other.Exception.Message &&
            Enum == other.Enum &&
            Struct.Equals(other.Struct));
 }