protected static string?LoadInternalResourceAsString(string?resourceName, Assembly?assembly = null)
        {
            // Getting the calling assembly if it is not passed to this method must be done directly here and not in another method of this assembly, as the calling assembly would then the current one.
            if (assembly == null)
            {
                assembly = Assembly.GetCallingAssembly();
            }

            try
            {
                using var stream = AgLinkPlcEmbeddedRequirementsHelper.LoadInternalResourceAsStream(resourceName, assembly);

                //  Either the file does not exist or it is not marked as embedded resource.
                if (stream == null)
                {
                    return(null);
                }

                //  Get byte array from the file from embedded resource.
                using var reader = new System.IO.StreamReader(stream, System.Text.Encoding.UTF8);
                var content = reader.ReadToEnd();
                return(content);
            }
            catch (Exception ex)
            {
                if (System.Diagnostics.Debugger.IsAttached)
                {
                    System.Diagnostics.Debugger.Break();
                }
                return(null);
            }
        }
        /// <summary>
        /// Loads the embedded unmanaged assembly.
        /// </summary>
        /// <param name="is64BitProcess"> Optional boolean if the 64-bit version of the unmanaged assembly should be loaded. By default this is determined by <see cref="Environment.Is64BitProcess"/>. </param>
        /// <returns> The file name of the unmanaged assembly and its content as a <see cref="Stream"/> reset to <see cref="SeekOrigin.Begin"/>. This stream is not closed and needs to be disposed! </returns>
        internal static (string FileName, Stream?ResourceStream) LoadUnmanagedAssembly(bool?is64BitProcess = null)
        {
            is64BitProcess ??= Environment.Is64BitProcess;
            var currentAssembly           = DemoAgLinkPlcEmbeddedRequirementsHelper.CurrentAssembly;
            var resourceNames             = DemoAgLinkPlcEmbeddedRequirementsHelper.ResourceNames;
            var unmanagedAssemblyFileName = $"AGLink40{(is64BitProcess.Value ? "_x64" : "")}.dll";
            var resourceName   = resourceNames.FirstOrDefault(name => name.ToLower().Contains(unmanagedAssemblyFileName.ToLower()));
            var resourceStream = AgLinkPlcEmbeddedRequirementsHelper.LoadInternalResourceAsStream(resourceName, currentAssembly);

            if (resourceStream?.CanSeek ?? false)
            {
                resourceStream.Seek(0, SeekOrigin.Begin);
            }
            return(unmanagedAssemblyFileName, resourceStream);
        }