Exemple #1
0
        protected override void VisitClass(CodeTypeDeclaration type)
        {
            if (type.GetSchema().TargetNamespace == Namespaces.Sac)
            {
                var props = type.Members.OfType <CodeMemberProperty>().Where(x => x.Type.BaseType == "IdentifierType");
                foreach (var prop in props)
                {
                    prop.Type = new CodeTypeReference("UnqualifiedDataTypes.IdentifierType");
                }

                var fields = type.Members.OfType <CodeMemberField>().Where(x => x.Type.BaseType == "IdentifierType");
                foreach (var field in fields)
                {
                    field.Type = new CodeTypeReference("UnqualifiedDataTypes.IdentifierType");
                }
            }
            if (type.GetSchema().TargetNamespace == Namespaces.Xades132)
            {
                var props = type.Members.OfType <CodeMemberProperty>().Where(x => x.Type.BaseType == "IdentifierType");
                foreach (var prop in props)
                {
                    prop.Type = new CodeTypeReference("Xades.IdentifierType");
                }

                var fields = type.Members.OfType <CodeMemberField>().Where(x => x.Type.BaseType == "IdentifierType");
                foreach (var field in fields)
                {
                    field.Type = new CodeTypeReference("Xades.IdentifierType");
                }
            }
        }
Exemple #2
0
 protected override void VisitClass(CodeTypeDeclaration type)
 {
     if (IsUblDocument(type) || type.GetSchema().TargetNamespace == "urn:oasis:names:specification:ubl:schema:xsd:BaseDocument-2")
     {
         type.BaseTypes.Add(new CodeTypeReference("IBaseDocument"));
     }
 }
Exemple #3
0
 protected override void VisitClass(CodeTypeDeclaration type)
 {
     if (type.GetSchema().SourceUri.Contains("maindoc")
         // && type.Name != "BaseDocument"
         )
     {
         type.BaseTypes.Add(new CodeTypeReference("IBaseDocument"));
     }
 }
Exemple #4
0
        private bool IsUblDocument(CodeTypeDeclaration type)
        {
            var schema = type.GetSchema();

            if (!schema.IsMaindocSchema())
            {
                return(false);
            }

            var hasSchemaElement = schema.Elements.Values.OfType <XmlSchemaElement>()
                                   .Any(x => x.SchemaTypeName.Name == type.Name);

            return(hasSchemaElement);
        }
Exemple #5
0
        protected override void VisitType(CodeTypeDeclaration type)
        {
            var targetNs = type.GetSchema().TargetNamespace;

            if (targetNs == Namespaces.Xades132 || targetNs == Namespaces.Xades141)
            {
                return;
            }

            if (!type.Name.StartsWith("ItemsChoiceType") && (type.Name.EndsWith("1") || type.Name.EndsWith("2") || type.Name.EndsWith("3")))
            {
                var newName = type.Name.Substring(0, type.Name.Length - 1);
                var visitor = new RenameTypeWithSuffixOfProperties(type.Name, newName);
                type.Name = newName;

                visitor.Visit(_codeNamespace);
            }
        }