public void ModelDesignTest()
        {
            Opc.Ua.ModelCompiler.ModelDesign _node = new Opc.Ua.ModelCompiler.ModelDesign()
            {
                AnyAttr                        = null,
                DefaultLocale                  = null,
                Items                          = null,
                Namespaces                     = new Opc.Ua.ModelCompiler.Namespace[] { },
                TargetNamespace                = "TargetNamespace",
                TargetPublicationDate          = DateTime.Today,
                TargetPublicationDateSpecified = false,
                TargetVersion                  = "TargetVersion",
                TargetXmlNamespace             = "TargetXmlNamespace"
            };
            ModelDesign _model = new ModelDesign(_node);

            Assert.IsNull(_model.AnyAttr);
            Assert.IsNull(_model.DefaultLocale);
            Assert.IsNull(_model.Parent);
            Assert.AreEqual <string>("TargetNamespace", _model.TargetNamespace);
            Assert.IsFalse(_model.TargetPublicationDate.HasValue);
            Assert.AreEqual <string>("TargetVersion", _model.TargetVersion);
            Assert.AreEqual <string>("TargetXmlNamespace", _model.TargetXmlNamespace);
            Opc.Ua.ModelCompiler.ModelDesign _nodeExported = _model.Update();
            Assert.IsNotNull(_nodeExported);
            Assert.IsNull(_nodeExported.AnyAttr);
            Assert.IsNull(_nodeExported.DefaultLocale);
            Assert.IsNull(_nodeExported.Items);
            Assert.IsNull(_nodeExported.Namespaces);
            Assert.AreEqual <string>("TargetNamespace", _nodeExported.TargetNamespace);
            Assert.IsFalse(_nodeExported.TargetPublicationDateSpecified);
            Assert.AreEqual <string>("TargetVersion", _nodeExported.TargetVersion);
            Assert.AreEqual <string>("TargetXmlNamespace", _nodeExported.TargetXmlNamespace);
        }
Beispiel #2
0
        //methods
        private ModelDesign ReadConfiguration()
        {
            FileInfo info = new FileInfo(FilePath);

            if (!info.Exists)
            {
                throw new FileNotFoundException(FilePath);
            }
            Opc.Ua.ModelCompiler.ModelDesign _ModelDesign = XmlFile.ReadXmlFile <Opc.Ua.ModelCompiler.ModelDesign>(FilePath);
            return(new ModelDesign(_ModelDesign, false));
        }
Beispiel #3
0
 internal NamespacesFolder(Opc.Ua.ModelCompiler.ModelDesign child) : base("Namespaces", WrapperResources.NamespaceFolderToolTipText)
 {
     TypesAvailableToBePasted.Add(typeof(Opc.Ua.ModelCompiler.Namespace));
     if (child.Namespaces == null || child.Namespaces.Length == 0)
     {
         return;
     }
     foreach (Opc.Ua.ModelCompiler.Namespace ns in child.Namespaces)
     {
         this.Add(new Namespace(ns));
     }
 }
Beispiel #4
0
 private void InitializeTypes()
 {
     try
     {
         AssemblyTraceEvent.Tracer.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 37, "Loading the OPC UA Defined Types.");
         UAModelDesign _modelTypes = UAResources.LoadUADefinedTypes();
         if (Properties.Settings.Default.OnlyItemsInAddressSpace)
         {
             _modelTypes.Items = _modelTypes.Items.Where <UANodeDesign>((x) => { UADataTypeDesign _dt = x as UADataTypeDesign; return(_dt == null ? true : !_dt.NotInAddressSpace); }).ToArray <UANodeDesign>();
             AssemblyTraceEvent.Tracer.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 41, "Removed DataTypeDesign items not belonging to the model.");
         }
         AssemblyTraceEvent.Tracer.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 37, "Creating the LibraryTreeNode containing standard model");
         Add(new LibraryTreeNode(_modelTypes, "UA Defined Types"));
     }
     catch (Exception _ex)
     {
         string _tmp = "Cannot load Defined OPC UA Types in {0} from {1} because of error {2}";
         AssemblyTraceEvent.Tracer.TraceEvent(System.Diagnostics.TraceEventType.Critical, 37, _tmp, typeof(Libraries).FullName, typeof(UAResources), _ex.Message);
     }
 }
Beispiel #5
0
        internal LibraryTreeNode(OPCFModelDesign config, string nodeName)
            : base(nodeName)
        {
            List <Opc.Ua.ModelCompiler.NodeDesign> _nodes = new List <Opc.Ua.ModelCompiler.NodeDesign>();

            if (config.Items != null)
            {
                _nodes.AddRange(config.Items);
                _nodes.Sort((x, y) =>
                {
                    int _ret = x.GetType().Name.CompareTo(y.GetType().Name);
                    if (_ret == 0)
                    {
                        _ret = x.SymbolicName.Name.CompareTo(y.SymbolicName.Name);
                    }
                    return(_ret);
                });
                config.Items = _nodes.ToArray();
            }
            ModelDesign m_ModelDesignTypes = new ModelDesign(config, true);

            Add(m_ModelDesignTypes);
        }
Beispiel #6
0
 private ProjectTreeNode(ISolutionDirectoryPathManagement solutionPath, string filePath, OPCFModelDesign model) : this(solutionPath, Path.GetFileNameWithoutExtension(filePath))
 {
     UAModelDesignerProject = new UAModelDesignerProject()
     {
         BuildOutputDirectoryName = Resources.DefaultOutputBuildDirectory,
         CSVFileName       = Resources.DefaultCSVFileName,
         FileName          = RelativeFilePathsCalculator.TryComputeRelativePath(solutionPath.BaseDirectory, filePath),
         ProjectIdentifier = Guid.NewGuid().ToString(),
         Name = m_GetNextUniqueProjectName
     };
     InitializeComponent(new ModelDesign(model, false));
 }
Beispiel #7
0
 internal ProjectTreeNode(IBaseDirectoryProvider solutionPath, string filePath, OPCFModelDesign model) :
     this(solutionPath, Path.GetFileNameWithoutExtension(filePath))
 {
     UAModelDesignerProject = new UAModelDesignerProject()
     {
         BuildOutputDirectoryName = Resources.DefaultOutputBuildDirectory,
         CSVFileName       = Resources.DefaultCSVFileName,
         FileName          = GetRelativePath(filePath),
         ProjectIdentifier = Guid.NewGuid().ToString(),
         Name = UniqueProjectName
     };
     InitializeComponent(new ModelDesign(model, false));
 }