예제 #1
0
        public static AssemblyDefinition Load(string path, bool loadSymbols)
        {
            Contract.Requires(!string.IsNullOrEmpty(path), "path is null or empty");

            AssemblyDefinition assembly = null;

            AcquireLock();
            try
            {
                Entry entry;
                if (ms_entries.TryGetValue(path, out entry))
                    assembly = entry.Assembly;

                DateTime time = File.GetLastWriteTime(path);
                if (assembly == null || time > entry.Time)
                {
                    assembly = AssemblyDefinition.ReadAssembly(path);
                    entry = new Entry(assembly, time);
                    ms_entries[path] = entry;
                }

                if (entry != null && loadSymbols)
                    entry.LoadSymbols(assembly);
            }
            finally
            {
                ReleaseLock();
            }

            return assembly;
        }
예제 #2
0
        private int DoCompareEntry(Entry lhs, Entry rhs)
        {
            int result = lhs.Command.SortOrder.CompareTo(rhs.Command.SortOrder);

            if (result == 0)
                result = lhs.Group.CompareTo(rhs.Group);

            if (result == 0)
            {
                if (lhs.Command.Name == null)
                    result = rhs.Command.Name == null ? 0 : -1;

                else if (rhs.Command.Name == null)
                    result = +1;

                else if (lhs.Command.Name == Constants.Ellipsis)
                    result = rhs.Command.Name == Constants.Ellipsis ? 0 : +1;

                else if (rhs.Command.Name == Constants.Ellipsis)
                    result = -1;

                else
                    result = lhs.Command.Name.CompareTo(rhs.Command.Name);
            }

            return result;
        }