/* ======================================================================== * Copyright (c) 2005-2025 The OPC Foundation, Inc. All rights reserved. * * OPC Foundation MIT License 1.00 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * The complete license agreement can be found here: * http://opcfoundation.org/License/MIT/1.00/ * ======================================================================*/ #nullable disable using System; using System.Collections.Generic; namespace Opc.Ua.Client { /// /// A client side cache of the server's type model. /// public static class NodeCacheObsolete { /// /// Fetches a node from the server and updates the cache. /// [Obsolete("Use FetchNodeAsync instead.")] public static Node FetchNode( this INodeCache nodeCache, ExpandedNodeId nodeId) { return nodeCache.FetchNodeAsync(nodeId) .GetAwaiter() .GetResult(); } /// /// Finds a set of nodes in the nodeset, fetches missing /// nodes from server. /// [Obsolete("Use FindAsync instead.")] public static IList Find( this INodeCache nodeCache, IList nodeIds) { return nodeCache.FindAsync(nodeIds) .GetAwaiter() .GetResult(); } /// /// Fetches a node collection from the server and updates the cache. /// [Obsolete("Use FetchNodesAsync instead.")] public static IList FetchNodes( this INodeCache nodeCache, IList nodeIds) { return nodeCache.FetchNodesAsync(nodeIds) .GetAwaiter() .GetResult(); } /// /// Adds the supertypes of the node to the cache. /// [Obsolete("Use FetchSuperTypesAsync instead.")] public static void FetchSuperTypes( this INodeCache nodeCache, ExpandedNodeId nodeId) { nodeCache.FetchSuperTypesAsync(nodeId) .GetAwaiter() .GetResult(); } /// /// Returns the references of the specified node that /// meet the criteria specified. /// [Obsolete("Use FindReferencesAsync instead.")] public static IList FindReferences( this INodeCache nodeCache, ExpandedNodeId nodeId, NodeId referenceTypeId, bool isInverse, bool includeSubtypes) { return nodeCache.FindReferencesAsync( nodeId, referenceTypeId, isInverse, includeSubtypes) .GetAwaiter() .GetResult(); } /// /// Returns the references of the specified nodes that meet /// the criteria specified. /// [Obsolete("Use FindReferencesAsync instead.")] public static IList FindReferences( this INodeCache nodeCache, IList nodeIds, IList referenceTypeIds, bool isInverse, bool includeSubtypes) { return nodeCache.FindReferencesAsync( nodeIds, referenceTypeIds, isInverse, includeSubtypes) .GetAwaiter() .GetResult(); } /// /// Returns a display name for a node. /// [Obsolete("Use GetDisplayTextAsync instead.")] public static string GetDisplayText( this INodeCache nodeCache, INode node) { return nodeCache.GetDisplayTextAsync(node) .AsTask() .GetAwaiter() .GetResult(); } /// /// Returns a display name for a node. /// [Obsolete("Use GetDisplayTextAsync instead.")] public static string GetDisplayText( this INodeCache nodeCache, ExpandedNodeId nodeId) { return nodeCache.GetDisplayTextAsync(nodeId) .AsTask() .GetAwaiter() .GetResult(); } /// /// Returns a display name for the target of a reference. /// [Obsolete("Use GetDisplayTextAsync instead.")] public static string GetDisplayText( this INodeCache nodeCache, ReferenceDescription reference) { return nodeCache.GetDisplayTextAsync(reference) .AsTask() .GetAwaiter() .GetResult(); } /// /// Determines whether a node id is a known type id. /// [Obsolete("Use IsKknownAsync instead")] public static bool IsKnown( this INodeCache nodeCache, ExpandedNodeId typeId) { return nodeCache.IsKnownAsync(typeId) .AsTask() .GetAwaiter() .GetResult(); } /// /// Determines whether a node id is a known type id. /// [Obsolete("Use IsKknownAsync instead")] public static bool IsKnown( this INodeCache nodeCache, NodeId typeId) { return nodeCache.IsKnownAsync(typeId) .AsTask() .GetAwaiter() .GetResult(); } /// /// Returns the immediate supertype for the type. /// [Obsolete("Use FindSuperTypeAsync instead")] public static NodeId FindSuperType( this INodeCache nodeCache, ExpandedNodeId typeId) { return nodeCache.FindSuperTypeAsync(typeId) .AsTask() .GetAwaiter() .GetResult(); } /// /// Returns the immediate supertype for the type. /// [Obsolete("Use FindSuperTypeAsync instead")] public static NodeId FindSuperType( this INodeCache nodeCache, NodeId typeId) { return nodeCache.FindSuperTypeAsync(typeId) .AsTask() .GetAwaiter() .GetResult(); } /// /// Returns true if the node is in the table. /// [Obsolete("Use ExistsAsync instead")] public static bool Exists( this INodeCache nodeCache, ExpandedNodeId nodeId) { return nodeCache.ExistsAsync(nodeId) .AsTask() .GetAwaiter() .GetResult(); } /// /// Finds a node in the node set. /// [Obsolete("Use FindAsync instead")] public static INode Find( this INodeCache nodeCache, ExpandedNodeId nodeId) { return nodeCache.FindAsync(nodeId) .AsTask() .GetAwaiter() .GetResult(); } /// /// Follows the reference from the source and returns the first target /// with the specified browse name. /// [Obsolete("Use FindAsync instead")] public static INode Find( this INodeCache nodeCache, ExpandedNodeId sourceId, NodeId referenceTypeId, bool isInverse, bool includeSubtypes, QualifiedName browseName) { return nodeCache.FindAsync( sourceId, referenceTypeId, isInverse, includeSubtypes, browseName) .AsTask() .GetAwaiter() .GetResult(); } /// /// Follows the reference from the source and returns all target nodes. /// [Obsolete("Use FindAsync instead")] public static IList Find( this INodeCache nodeCache, ExpandedNodeId sourceId, NodeId referenceTypeId, bool isInverse, bool includeSubtypes) { return nodeCache.FindAsync( sourceId, referenceTypeId, isInverse, includeSubtypes) .AsTask() .GetAwaiter() .GetResult(); } /// /// Returns the immediate subtypes for the type. /// [Obsolete("Use FindSubTypesAsync instead")] public static IList FindSubTypes( this INodeCache nodeCache, ExpandedNodeId typeId) { return nodeCache.FindSubTypesAsync(typeId) .AsTask() .GetAwaiter() .GetResult(); } /// /// Determines whether a type is a subtype of another type. /// [Obsolete("Use IsTypeOfAsync instead")] public static bool IsTypeOf( this INodeCache nodeCache, ExpandedNodeId subTypeId, ExpandedNodeId superTypeId) { return nodeCache.IsTypeOfAsync(subTypeId, superTypeId) .AsTask() .GetAwaiter() .GetResult(); } /// /// Determines whether a type is a subtype of another type. /// [Obsolete("Use IsTypeOfAsync instead")] public static bool IsTypeOf( this INodeCache nodeCache, NodeId subTypeId, NodeId superTypeId) { return nodeCache.IsTypeOfAsync(subTypeId, superTypeId) .AsTask() .GetAwaiter() .GetResult(); } /// /// Returns the qualified name for the reference type id. /// [Obsolete("Use FindReferenceTypeNameAsync instead")] public static QualifiedName FindReferenceTypeName( this INodeCache nodeCache, NodeId referenceTypeId) { return nodeCache.FindReferenceTypeNameAsync(referenceTypeId) .AsTask() .GetAwaiter() .GetResult(); } /// /// Returns the node identifier for the reference type with the /// specified browse name. /// [Obsolete("Use FindReferenceTypeAsync instead")] public static NodeId FindReferenceType( this INodeCache nodeCache, QualifiedName browseName) { return nodeCache.FindReferenceTypeAsync(browseName) .AsTask() .GetAwaiter() .GetResult(); } /// /// Checks if the identifier represents /// a that provides encodings for the . /// [Obsolete("Use IsEncodingForAsync instead")] public static bool IsEncodingOf( this INodeCache nodeCache, ExpandedNodeId encodingId, ExpandedNodeId datatypeId) { return nodeCache.IsEncodingOfAsync(encodingId, datatypeId) .AsTask() .GetAwaiter() .GetResult(); } /// /// Determines if the value contained in an extension object /// matches the expected data type. /// [Obsolete("Use IsEncodingForAsync instead")] public static bool IsEncodingFor( this INodeCache nodeCache, NodeId expectedTypeId, ExtensionObject value) { return nodeCache.IsEncodingForAsync(expectedTypeId, value) .AsTask() .GetAwaiter() .GetResult(); } /// /// Determines if the value is an encoding of the /// [Obsolete("Use IsEncodingForAsync instead")] public static bool IsEncodingFor( this INodeCache nodeCache, NodeId expectedTypeId, object value) { return nodeCache.IsEncodingForAsync(expectedTypeId, value) .AsTask() .GetAwaiter() .GetResult(); } /// /// Returns the data type for the specified encoding. /// [Obsolete("Use FindDataTypeIdAsync instead")] public static NodeId FindDataTypeId( this INodeCache nodeCache, ExpandedNodeId encodingId) { return nodeCache.FindDataTypeIdAsync(encodingId) .AsTask() .GetAwaiter() .GetResult(); } /// /// Returns the data type for the specified encoding. /// [Obsolete("Use FindDataTypeIdAsync instead")] public static NodeId FindDataTypeId( this INodeCache nodeCache, NodeId encodingId) { return nodeCache.FindDataTypeIdAsync(encodingId) .AsTask() .GetAwaiter() .GetResult(); } } }