Beispiel #1
0
        /// <summary>
        /// Try loading DLLs first using file path, then using it's simple name.
        /// </summary>
        /// <param name="filePath"></param>
        /// <param name="simpleName"></param>
        /// <returns>Null in case of success, error info in case of failure.</returns>
        private static string LoadDll(string filePath, string simpleName)
        {
            string res = null;

            if (filePath != null)
            {
                res = DllLoader.Load(filePath);

                if (res == null)
                {
                    return(null);  // Success.
                }
            }

            // Failed to load using file path, fallback to simple name.
            var res2 = DllLoader.Load(simpleName);

            if (res2 == null)
            {
                return(null);  // Success.
            }

            return(res);
        }