Esempio n. 1
0
        static void Main(string[] args)
        {
            if (args.Length == 0 || args[0].IndexOfAny(Path.GetInvalidPathChars()) >= 0)
            {
                throw new ArgumentException("Invalid argument. First argument should be a valid file path.");
            }

            var fileName       = args[0];
            var typesMetadata  = MetadataHelper.GetDtoTypesMetadata(typeof(Todo).Assembly.ExportedTypes);
            var typesGenerator = new TypesGenerator {
                DtoTypes = typesMetadata
            };

            File.WriteAllText(fileName, typesGenerator.TransformText().Trim());
        }
Esempio n. 2
0
    public static void Generate(TypeMap typeMap, string fname, string name)
    {
        StreamReader  sr  = new StreamReader(fname);
        XmlSerializer sz  = new XmlSerializer(typeof(xcb));
        xcb           xcb = (xcb)sz.Deserialize(sr);

        string extName = xcb.extensionxname ?? "";

        TypesGenerator tg = new TypesGenerator(typeMap);

        tg.Generate(xcb, name, extName);

        InterfaceGenerator ig = new InterfaceGenerator(typeMap);

        ig.Generate(xcb, name);

        ClassGenerator cg = new ClassGenerator(typeMap);

        cg.Generate(xcb, name, extName);
    }