コード例 #1
0
ファイル: Program.cs プロジェクト: zyj0021/reactive
            public override T TryGetNext(out bool success)
            {
                switch (_state)
                {
                case 1:
                    _enumerator = _source.GetEnumerator();
                    _state      = 2;
                    goto case 2;

                case 2:
                    while (true)
                    {
                        var item = _enumerator.TryGetNext(out success);
                        if (!success)
                        {
                            break;
                        }

                        if (_predicate(item))
                        {
                            return(item);
                        }
                    }
                    break;
                }

                success = false;
                return(default(T));
            }
コード例 #2
0
ファイル: FormWebCam.cs プロジェクト: freelancerAmer/webCam
        private void p_Disposed(object sender, EventArgs e)
        {
            FormMain.fActiveWebCams.Remove(new KeyValuePair <string, string>(fUser, MonikerName));

            var distributor = Distributor;

            if (distributor != null)
            {
                Distributor = null;
                ActiveWebCams.Stop(MonikerName);
                distributor.Dispose();
            }

            var enumerator = fEnumerator;

            if (enumerator != null)
            {
                fEnumerator = null;

                try
                {
                    enumerator.Dispose();
                }
                catch
                {
                }
            }

            base.OnClosed(e);
        }
コード例 #3
0
ファイル: Sum.cs プロジェクト: tppApe/UfcppSample
        public static int SumFastEnumeratorInterface(IFastEnumerator <int> e)
        {
            var sum = 0;
            var x   = e.TryMoveNext(out var success);

            while (success)
            {
                sum += x;
                x    = e.TryMoveNext(out success);
            }
            return(sum);
        }
コード例 #4
0
        static int VirtualSum(IFastEnumerator <int> e)
        {
            var sum = 0;

            while (true)
            {
                var x = e.TryMoveNext(out var success);
                if (!success)
                {
                    break;
                }
                sum += x;
            }
            return(sum);
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: zyj0021/reactive
            public override bool MoveNext()
            {
                switch (_state)
                {
                case 1:
                    _enumerator = _source.GetEnumerator();
                    _state      = 2;
                    goto case 2;

                case 2:
                    _current = _enumerator.TryGetNext(out var success);
                    return(success);
                }

                return(false);
            }
コード例 #6
0
ファイル: FormWebCam.cs プロジェクト: freelancerAmer/webCam
        private void p_Initialize(string user, string displayName, string monikerName, IFastEnumerator <byte[]> enumerator)
        {
            ClientSize = new Size(160, 120);

            DisplayName = displayName;
            MonikerName = monikerName;

            fUser       = user;
            fEnumerator = enumerator;
            Text        = user;

            FormMain.fActiveWebCams.Add(new KeyValuePair <string, string>(fUser, MonikerName), this);

            Disposed += p_Disposed;

            UnlimitedThreadPool.Run(p_Receive);
        }
コード例 #7
0
        public long IFastEnumerator()
        {
            IFastEnumerator <int> ife = _array.GetFastEnumerator();
            long total     = 0;
            bool remaining = true;

            ife.Reset();
loop:
            var i = ife.TryGetNext(out remaining);

            if (remaining)
            {
                total += i;
                goto loop;
            }
            return(total);
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: zyj0021/reactive
            public override R TryGetNext(out bool success)
            {
                switch (_state)
                {
                case 1:
                    _enumerator = _source.GetEnumerator();
                    _state      = 2;
                    goto case 2;

                case 2:
                    var item = _enumerator.TryGetNext(out success);
                    if (success)
                    {
                        return(_selector(item));
                    }
                    break;
                }

                success = false;
                return(default(R));
            }
コード例 #9
0
ファイル: FormWebCam.cs プロジェクト: freelancerAmer/webCam
        public FormWebCam(string user, string displayName, string monikerName, IFastEnumerator <byte[]> enumerator)
        {
            InitializeComponent();

            p_Initialize(user, displayName, monikerName, enumerator);
        }
コード例 #10
0
ファイル: Adapter.cs プロジェクト: nbz16/UfcppSample
 public Adapter(IFastEnumerator <T> enumerator)
 {
     _enumerator = enumerator;
     Current     = default;
 }