Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
        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();
            }
        }
Ejemplo n.º 4
0
        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();
            }
        }