示例#1
0
        /// <summary>
        /// Scans a directory for assemblies and populate the results in the typal library.
        /// </summary>
        /// <param name="library"></param>
        /// <param name="directory"></param>
        public void ScanDirectoryForAssemblies(SemanticModel library, DirectoryPath directory)
        {
            var assemblyFiles = XAssemblies.GetAssemblyFiles(directory);

            foreach (var assemblyFile in assemblyFiles)
            {
                System.Reflection.Assembly assembly;



                try
                {
                    assembly = System.Reflection.Assembly.LoadFile(assemblyFile.Value);
                }
                catch (Exception e)
                {
                    assembly = null;

                    XLog.LogException(e);
                }

                if (assembly != null)
                {
                    XAssemblyScanning.Api.ScanAssembly(library, assembly);
                }
            }
        }
示例#2
0
        public Root.Code.Models.E01D.Net.Http.Web.HttpWebResponse Invoke(Root.Code.Models.E01D.Net.Http.Web.HttpWebRequest request)
        {
            var response = new Root.Code.Models.E01D.Net.Http.Web.HttpWebResponse()
            {
                Request = request
            };

            // Create the web request
            request.NetworkClient = (System.Net.HttpWebRequest)WebRequest.Create(request.Definition.FullUrl);

            Copying.CopyToWebRequest(request);

            try
            {
                InvokeInternal(response);
            }
            catch (Exception e)
            {
                XLog.LogException(e);
                // Core.Logging.LogException( // needs to be a domain level context, the system context, that contains log sinks
                //EvoRest.Rest.Logging.LogException(response, e);
            }

            return(response);
        }
示例#3
0
文件: SortingApi.cs 项目: E01D/Base
        public int BinarySearch <T>(T[] array, int index, int length, T value, IComparer <T> comparer)
        {
            try
            {
                if (comparer == null)
                {
                    comparer = Comparer <T> .Default;
                }

                return(InternalBinarySearch <T>(array, index, length, value, comparer));
            }
            catch (System.Exception e)
            {
                XLog.LogException(e);

                throw XExceptions.InvalidOperation.FailedToCompareTwoElementsInArray();
            }
        }
示例#4
0
文件: SortingApi.cs 项目: E01D/Base
        public void Sort <T>(T[] keys, int index, int length, Comparison <T> comparer)
        {
            Debug.Assert(keys != null, "Check the arguments in the caller!");
            Debug.Assert(index >= 0 && length >= 0 && (keys.Length - index >= length), "Check the arguments in the caller!");
            Debug.Assert(comparer != null, "Check the arguments in the caller!");

            // Add a try block here to detect bogus comparisons
            try
            {
                IntrospectiveSort(keys, index, length, comparer);
            }
            catch (IndexOutOfRangeException)
            {
                ThrowOrIgnoreBadComparer(comparer);
            }
            catch (System.Exception e)
            {
                XLog.LogException(e);

                throw XExceptions.InvalidOperation.FailedToCompareTwoElementsInArray();
            }
        }