Beispiel #1
0
 public static IEnumerable <ChatClient> GetClientsExcept(params ChatClient[] Except)
 {
     foreach (var C in Clients)
     {
         if (!Except.Contains(C))
         {
             yield return(C);
         }
     }
 }
Beispiel #2
0
 public IEnumerator <int> GetEnumerator()
 {
     _enumeratorInitialized = true;
     for (int i = _start; i <= _finish; i += Step)
     {
         if (!Except.Contains(i))
         {
             yield return(i);
         }
     }
 }
        public int GetColumnsWidth(params ColumnSize[] Except)
        {
            int Width = 0;

            var Columns = new[]
            {
                BannerColumnSize, DiscIdColumnSize, TitleColumnSize, FirmwareColumnSize, RegionColumnSize,
                PathColumnSize
            };

            foreach (var Column in Columns)
            {
                if (!Except.Contains(Column))
                {
                    Width += Column.Width;
                }
            }
            return(Width);
        }
Beispiel #4
0
            public override IEnumerable GetData(ParameterInfo parameter)
            {
                if (Include != null)
                {
                    var list = Include.Intersect(
                        ExcludeLinqService == false ?
                        UserProviders.Select(_ => _.Name).Concat(UserProviders.Select(p => p + ".LinqService")) :
                        UserProviders.Select(_ => _.Name)).
                               ToArray();

                    return(list);
                }

                var providers = new List <string>();

                foreach (var info in Providers)
                {
                    if (info.Skip && Include == null)
                    {
                        continue;
                    }

                    if (Except != null && Except.Contains(info.Name))
                    {
                        continue;
                    }

                    if (!UserProviders.Select(_ => _.Name).Contains(info.Name))
                    {
                        continue;
                    }

                    providers.Add(info.Name);

                    if (!ExcludeLinqService)
                    {
                        providers.Add(info.Name + ".LinqService");
                    }
                }

                return(providers.ToArray());
            }
        /// <summary>
        /// Register implementation type to container<br/>
        /// 注册实现类型到容器<br/>
        /// </summary>
        public override void RegisterToContainer(IContainer container, Type type, ReuseType reuseType)
        {
            var serviceTypes = Container.GetImplementedServiceTypes(type, NonPublic);

            // Apply except types
            if (Except != null && Except.Any())
            {
                serviceTypes = serviceTypes.Where(t => !Except.Contains(t));
            }
            var serviceTypesArray = serviceTypes.ToList();

            // Apply clear exist
            if (ClearExists)
            {
                foreach (var serviceType in serviceTypesArray)
                {
                    container.Unregister(serviceType, ContractKey);
                }
            }
            // Register to container
            container.RegisterMany(serviceTypesArray, type, reuseType, ContractKey);
        }
Beispiel #6
0
        public static void ResumeProcess(this Process Proc, params ProcessThread[] Except)
        {
            if (string.IsNullOrEmpty(Proc.ProcessName))
            {
                return;
            }

            foreach (ProcessThread ProcessThread in Proc.Threads)
            {
                if (Except.Contains(ProcessThread))
                {
                    continue;
                }

                IntPtr OpenThread = Kernel32.OpenThread(ThreadAccess.SUSPEND_RESUME, false, (uint)ProcessThread.Id);
                if (OpenThread == IntPtr.Zero)
                {
                    continue;
                }

                Kernel32.ResumeThread(OpenThread);
                Kernel32.CloseHandle(OpenThread);
            }
        }