예제 #1
0
        /// <summary>
        /// Convert the text file to a binary module.
        /// </summary>
        /// <param name="filename">File to convert.</param>
        public static void ConvertFromText <T>(string filename) where T : NdapiModule
        {
            var type   = NdapiMetadata.GetObjectTypeFrom <T>();
            var status = NativeMethods.d2fctxcf_ConvertFile(NdapiContext.GetContext(), filename, type, NdapiConstants.TEXTTOBIN);

            Ensure.Success(status);
        }
예제 #2
0
        /// <summary>
        /// Finds an object by name.
        /// </summary>
        /// <param name="name">Name of the object.</param>
        /// <returns>The object that was found. Returns null if the object doesn't exist.</returns>
        public T Single(string name)
        {
            var type = NdapiMetadata.GetObjectTypeFrom <T>();
            ObjectSafeHandle handle;

            var status = NativeMethods.d2fobfo_FindObj(NdapiContext.GetContext(), _ndapiObject._handle, name, type, out handle);

            if (status == D2fErrorCode.D2FS_OBJNOTFOUND)
            {
                return(null);
            }
            Ensure.Success(status);

            return(NdapiObject.Create <T>(handle));
        }