示例#1
0
 public CreateFinalResultCommand(IResultFactory resultFactory, IAddResult addResult, IGetMatchById getMatch, IBetController betController)
 {
     this.getMatch      = getMatch;
     this.betController = betController;
     this.resultFactory = resultFactory;
     this.addResult     = addResult;
 }
示例#2
0
        private unsafe void ReadLinesImpl(IAddResult result, int max_lines)
        {
            int line_count = 0;

            line_count += this.PickLinesImpl(result, max_lines);
            if (line_count == max_lines)
            {
                return;
            }

            _lines.Clear();
            while (line_count < max_lines)
            {
                if (_blockPos < _blockNum && _worker.IsEmpty)
                {
                    this.ReadStream();
                    fixed(byte *byte_ptr = _byteBuffer)
                    {
                        var handle = new GCHandle <Decoder>();

                        handle.Create(_decoder);
                        _worker.DecodeTextIntoBuffer(byte_ptr, _byteLength, handle);
                        handle.Dispose();
                        _worker.GetLines(_lines);
                    }
                }

                line_count += this.PickLinesImpl(result, max_lines - line_count);
                if (line_count == max_lines)
                {
                    return;
                }

                if (_blockPos == _blockNum)
                {
                    // if final part do not have LF.
                    if (!_worker.IsEmpty)
                    {
                        var buff = new NativeList <Char16>(Allocator.Temp);
                        _worker.GetInternalBuffer(buff);
                        result.AddResult((char *)buff.GetUnsafePtr(), buff.Length);
                        buff.Dispose();
                    }

                    // reach EOF
                    break;
                }
            }
        }
    public static void IfValid(this IAddResult addResult, Action thenInvokeThis,
                               Action elseInvokeThis)
    {
        // TODO: Validate.
        bool isValid = true ? throw new NotImplementedException()
                : false;

        if (isValid)
        {
            thenInvokeThis();
        }
        else
        {
            elseInvokeThis();
        }
    }
示例#4
0
        private unsafe int PickLinesImpl(IAddResult result, int max_lines)
        {
            int line_count = 0;

            if (_lines.Length > 0)
            {
                int n_lines = Math.Min(_lines.Length, max_lines);
                for (int i = 0; i < n_lines; i++)
                {
                    var se = _lines[i];
                    result.AddResult((char *)se.GetUnsafePtr(), se.Length);
                    line_count++;
                }
                _lines.RemoveRange(0, n_lines);
            }
            return(line_count);
        }
 public static IAddResult Transform(this IAddResult addResult)
 {
     // TODO: Transform add result.
     throw new NotImplementedException();
 }