コード例 #1
0
        static void ProcessDictionary(string name, string input, string output, Files files, string specificationVersion)
        {
            var resourcePath = "ModelCompiler.Design";

            if (!String.IsNullOrEmpty(specificationVersion))
            {
                resourcePath = $"ModelCompiler.Design.{specificationVersion}";
            }

            TypeDictionaryValidator validator = new TypeDictionaryValidator(resourcePath);

            validator.Validate(input);

            string basePath = String.Format(@"{0}\{1}", output, name);
            string fileName = String.Format("Opc.Ua{0}", name);

            XmlSchemaGenerator generator1 = new XmlSchemaGenerator(input, output, files.TypeDictionaries, resourcePath);

            generator1.TypesNamespace     = "http://opcfoundation.org/UA/2008/02/Types.xsd";
            generator1.ServicesNamespace  = "http://opcfoundation.org/UA/2008/02/Services.wsdl";
            generator1.EndpointsNamespace = "http://opcfoundation.org/UA/2008/02/Endpoints.wsdl";

            generator1.Generate(fileName, "Opc.Ua", name, true);
            string filePath = String.Format(@"{0}\Opc.Ua.Types.xsd", output);

            XmlSchemaValidator2 validator1 = new XmlSchemaValidator2(files.XmlSchemas);

            validator1.Validate(filePath);
            files.XmlSchemas[validator1.TargetSchema.TargetNamespace] = filePath;
            System.IO.File.Delete(filePath);

            fileName = "Opc.Ua.Types";
            BinarySchemaGenerator generator2 = new BinarySchemaGenerator(input, output, files.TypeDictionaries, resourcePath);

            generator2.Generate(fileName, true, "http://opcfoundation.org/UA/");
            filePath = String.Format(@"{0}\{1}.bsd", output, fileName);

            BinarySchemaValidator validator2 = new BinarySchemaValidator(files.BinarySchemas);

            validator2.Validate(filePath);
            files.BinarySchemas[validator2.Dictionary.TargetNamespace] = filePath;
            System.IO.File.Delete(filePath);
        }
コード例 #2
0
ファイル: StackGenerator.cs プロジェクト: martycav/UANodeSet
        static void ProcessDictionary(string name, string input, string output, Files files)
        {
            TypeDictionaryValidator validator = new TypeDictionaryValidator();

            validator.Validate(input);

            string basePath = String.Format(@"{0}\{1}", output, name);
            string fileName = String.Format("Opc.Ua{0}", name);

            XmlSchemaGenerator generator1 = new XmlSchemaGenerator(input, output, files.TypeDictionaries);

            generator1.TypesNamespace     = "http://opcfoundation.org/UA/2008/02/Types.xsd";
            generator1.ServicesNamespace  = "http://opcfoundation.org/UA/2008/02/Services.wsdl";
            generator1.EndpointsNamespace = "http://opcfoundation.org/UA/2008/02/Endpoints.wsdl";

            generator1.Generate(fileName, "Opc.Ua", name, true);
            string filePath = String.Format(@"{0}\Opc.Ua.Types.xsd", output);

            XmlSchemaValidator validator1 = new XmlSchemaValidator(files.XmlSchemas);

            validator1.Validate(filePath);
            files.XmlSchemas[validator1.TargetSchema.TargetNamespace] = filePath;
            System.IO.File.Delete(filePath);

            fileName = "Opc.Ua.Types";
            BinarySchemaGenerator generator2 = new BinarySchemaGenerator(input, output, files.TypeDictionaries);

            generator2.Generate(fileName, true, "http://opcfoundation.org/UA/");
            filePath = String.Format(@"{0}\{1}.bsd", output, fileName);

            BinarySchemaValidator validator2 = new BinarySchemaValidator(files.BinarySchemas);

            validator2.Validate(filePath);
            files.BinarySchemas[validator2.Dictionary.TargetNamespace] = filePath;
            System.IO.File.Delete(filePath);
        }