public void ExplicitIncludeHasPrecedence()
        {
            var s = new SegmentBuilder("test").Version(1).Included("foo").Excluded("foo").Build();
            var u = User.WithKey("foo");

            Assert.True(SegmentMatchesUser(s, u));
        }
Exemplo n.º 2
0
        protected override void OnInitializeTask()
        {
            CloseDocuments();

            _logReport              = new StringBuilder();
            _projectInfo            = Project.GetProjectInfo();
            _segmentBuilder         = new SegmentBuilder();
            _pathInfo               = new PathInfo();
            _customerProvider       = new CustomerProvider();
            _imageService           = new ImageService();
            _reportService          = new ReportService();
            _projectSettingsService = new ProjectSettingsService();
            _exportSettings         = GetSetting <XliffManagerExportSettings>();
            if (_exportSettings.ExportOptions == null)
            {
                CreateDefaultContext();
            }

            _isError = false;
            _xliffManagerController = GetXliffManagerController();

            CreateWizardContext();
            WriteLogReportHeader();
            SubscribeToWindowClosing();

            _logReport.AppendLine();
            _logReport.AppendLine("Phase: Export - Started " + FormatDateTime(DateTime.UtcNow));

            base.OnInitializeTask();
        }
        public void MultipleItemsNoAlignment()
        {
            var segment1 = new DataSegment(new byte[] { 1, 2, 3, 4 });
            var segment2 = new DataSegment(new byte[] { 1, 2, 3 });
            var segment3 = new DataSegment(new byte[] { 1, 2, 3, 4, 5 });

            var collection = new SegmentBuilder {
                segment1, segment2, segment3
            };

            collection.UpdateOffsets(0x400, 0x1000);

            Assert.Equal(0x400u, segment1.FileOffset);
            Assert.Equal(0x1000u, segment1.Rva);
            Assert.Equal(0x404u, segment2.FileOffset);
            Assert.Equal(0x1004u, segment2.Rva);
            Assert.Equal(0x407u, segment3.FileOffset);
            Assert.Equal(0x1007u, segment3.Rva);

            Assert.Equal(12u, collection.GetPhysicalSize());
            Assert.Equal(12u, collection.GetVirtualSize());

            Assert.Equal(new byte[]
            {
                1, 2, 3, 4,
                1, 2, 3,
                1, 2, 3, 4, 5
            }, ToBytes(collection));
        }
Exemplo n.º 4
0
 public SegmentPair(SegmentBuilder segmentBuilder)
 {
     ConfirmationLevel = ConfirmationLevel.Unspecified;
     TranslationOrigin = segmentBuilder.CreateTranslationOrigin();
     Source            = new Source();
     Target            = new Target();
 }
Exemplo n.º 5
0
        protected override void Initialize()
        {
            _editorController     = SdlTradosStudio.Application.GetController <EditorController>();
            _projectsController   = SdlTradosStudio.Application.GetController <ProjectsController>();
            _studioVersionService = new StudioVersionService();

            var commonService         = new ProjectFileService();
            var projectHelper         = new ProjectService(_projectsController, _studioVersionService);
            var analysisBands         = projectHelper.GetAnalysisBands(_projectsController.CurrentProject ?? _projectsController.SelectedProjects.FirstOrDefault());
            var filterItemService     = new FilterItemService(analysisBands);
            var sdlxliffMerger        = new SdlxliffMerger();
            var segmentBuilder        = new SegmentBuilder();
            var segmentVisitor        = new SegmentVisitor();
            var paragraphUnitProvider = new ParagraphUnitProvider(segmentVisitor, filterItemService);
            var sdlxliffExporter      = new SdlxliffExporter(segmentBuilder);
            var sdlXliffReader        = new SdlxliffReader();
            var displayFilter         = new DisplayFilter();

            var model = new StudioViewsEditorViewModel(_editorController, filterItemService,
                                                       commonService, sdlxliffMerger, sdlxliffExporter, sdlXliffReader, paragraphUnitProvider, displayFilter);

            _control = new StudioViewsEditorView {
                DataContext = model
            };
        }
        public async ValueTask OffTree(GroupMessageEventArgs eventArgs)
        {
            var sender  = eventArgs.SenderInfo;
            var groupId = eventArgs.SourceGroup.Id;
            var message = new MessageBody();

            message.Add(SegmentBuilder.At(sender.UserId));

            var first = PcrReservationManager.SetOffTree(groupId, sender.UserId);

            if (first == null)
            {
                await eventArgs.Reply("树上没你。");

                return;
            }
            message.Add("已下树。");
            var alluser = PcrReservationManager.PeekAll(groupId);

            if (alluser.Count > 0)
            {
                message.AddRange(GetWaitUserMessage(alluser));
            }
            await eventArgs.Reply(message);
        }
Exemplo n.º 7
0
        private static Segment createSegmentFromResult(Segment originalSegment, string translatedText, FormattingAndTagsUsageOption formattingAndTagUsage)
        {
            if (formattingAndTagUsage == FormattingAndTagsUsageOption.Plaintext)
            {
                return(SegmentBuilder.CreateFromTrimmedStringAndITags(translatedText, originalSegment.ITags));
            }
            else if (formattingAndTagUsage == FormattingAndTagsUsageOption.OnlyFormatting)
            {
                // Convert to segment (conversion is needed because the result can contain formatting information)
                var convertedSegment = SegmentHtmlConverter.ConvertHtml2Segment(translatedText, originalSegment.ITags);
                var sb = new SegmentBuilder();
                sb.AppendSegment(convertedSegment);

                // Insert the tags to the end of the segment
                foreach (InlineTag it in originalSegment.ITags)
                {
                    sb.AppendInlineTag(it);
                }

                return(sb.ToSegment());
            }
            else
            {
                return(SegmentHtmlConverter.ConvertHtml2Segment(translatedText, originalSegment.ITags));
            }
        }
Exemplo n.º 8
0
        // Placed object message payload into a segment from a buffer pool.  When this get's too big, older blocks will be purged
        private ArraySegment <byte> SerializeMessageIntoPooledSegment(MemoryMessageData queueMessage)
        {
            // serialize payload
            int size = SegmentBuilder.CalculateAppendSize(queueMessage.Payload);

            // get segment from current block
            ArraySegment <byte> segment;

            if (currentBuffer == null || !currentBuffer.TryGetSegment(size, out segment))
            {
                // no block or block full, get new block and try again
                currentBuffer = bufferPool.Allocate();
                //call EvictionStrategy's OnBlockAllocated method
                this.evictionStrategy.OnBlockAllocated(currentBuffer);
                // if this fails with clean block, then requested size is too big
                if (!currentBuffer.TryGetSegment(size, out segment))
                {
                    string errmsg = String.Format(CultureInfo.InvariantCulture,
                                                  "Message size is too big. MessageSize: {0}", size);
                    throw new ArgumentOutOfRangeException(nameof(queueMessage), errmsg);
                }
            }
            // encode namespace, offset, partitionkey, properties and payload into segment
            int writeOffset = 0;

            SegmentBuilder.Append(segment, ref writeOffset, queueMessage.Payload);
            return(segment);
        }
        private void Run(IReadOnlyCollection <SystemFileInfo> importFiles, Language language)
        {
            var projectHelper         = new ProjectService(_projectsController, _studioVersionService);
            var analysisBands         = projectHelper.GetAnalysisBands(_projectsController.CurrentProject ?? _projectsController.SelectedProjects.FirstOrDefault());
            var filterItemService     = new FilterItemService(analysisBands);
            var commonService         = new ProjectFileService();
            var segmentVisitor        = new SegmentVisitor();
            var segmentBuilder        = new SegmentBuilder();
            var paragraphUnitProvider = new ParagraphUnitProvider(segmentVisitor, filterItemService, segmentBuilder);
            var sdlxliffImporter      = new SdlxliffImporter(commonService, filterItemService, paragraphUnitProvider, segmentBuilder);
            var sdlXliffReader        = new SdlxliffReader();

            _window = new StudioViewsFilesImportView();
            var model = new StudioViewsFilesImportViewModel(_window, _filesController, language, commonService, filterItemService, sdlxliffImporter, sdlXliffReader);

            _window.DataContext = model;
            if (importFiles != null)
            {
                model.AddFiles(importFiles);
            }

            _window.ShowDialog();

            if (model.DialogResult != DialogResult.OK)
            {
                return;
            }

            OpenMessageWindow(model);
        }
        public void BigSegmentStateIsQueriedOnlyOncePerUserEvenIfFlagReferencesMultipleSegments()
        {
            var segment1    = new SegmentBuilder("segmentkey1").Unbounded(true).Generation(2).Build();
            var segment2    = new SegmentBuilder("segmentkey2").Unbounded(true).Generation(3).Build();
            var bigSegments = new MockBigSegmentProvider();
            var membership  = MockMembership.New().Include(segment2);

            bigSegments.Membership[baseUser.Key] = membership;
            var flag = new FeatureFlagBuilder("key").On(true)
                       .Variations(LdValue.Of(false), LdValue.Of(true))
                       .FallthroughVariation(0)
                       .Rules(
                new RuleBuilder().Variation(1).Clauses(ClauseBuilder.ShouldMatchSegment(segment1.Key)).Build(),
                new RuleBuilder().Variation(1).Clauses(ClauseBuilder.ShouldMatchSegment(segment2.Key)).Build()
                )
                       .Build();
            var evaluator = BasicEvaluator.WithStoredSegments(segment1, segment2).WithBigSegments(bigSegments);

            var result = evaluator.Evaluate(flag, baseUser, EventFactory.Default);

            Assert.Equal(LdValue.Of(true), result.Result.Value);
            Assert.Equal(BigSegmentsStatus.Healthy, result.Result.Reason.BigSegmentsStatus);

            Assert.Equal(1, bigSegments.MembershipQueryCount);
            Assert.Equal(new List <string> {
                MakeBigSegmentRef(segment1), MakeBigSegmentRef(segment2)
            },
                         membership.Queries);
        }
Exemplo n.º 11
0
        protected override string GetOffset(CachedEventHubMessage lastItemPurged)
        {
            int readOffset = 0;

            SegmentBuilder.ReadNextString(lastItemPurged.Segment, ref readOffset);         // read namespace, not needed so throw away.
            return(SegmentBuilder.ReadNextString(lastItemPurged.Segment, ref readOffset)); // read offset
        }
        public void ExplicitExcludeUser()
        {
            var s = new SegmentBuilder("test").Version(1).Excluded("foo").Build();
            var u = User.WithKey("foo");

            Assert.False(SegmentMatchesUser(s, u));
        }
Exemplo n.º 13
0
        public void XliffReader_XLIFFSupportSniffer_ReturnsEqual(Enumerators.XLIFFSupport support)
        {
            // arrange
            var sniffer        = new XliffSniffer();
            var segmentBuilder = new SegmentBuilder();
            var xliffReader    = new XliffReder(sniffer, segmentBuilder);
            //var pocoFilterManager = new PocoFilterManager(false);
            var fileTypeManager = DefaultFileTypeManager.CreateInstance(true);
            var importOptions   = new ImportOptions();
            var analysisBands   = new List <AnalysisBand>();
            var sdlxliffWriter  = new SdlxliffWriter(fileTypeManager, segmentBuilder, importOptions, analysisBands);

            var testFile = support == Enumerators.XLIFFSupport.xliff12polyglot
                                ? _testFilesUtil.GetSampleFilePath("Xliff12", "Polyglot", "QuotesSample.docx.sdlxliff.xliff")
                                : _testFilesUtil.GetSampleFilePath("Xliff12", "xsi", "QuotesSample.docx.sdlxliff.xliff");
            var sdlxliffFile = _testFilesUtil.GetSampleFilePath("Sdlxliff", "QuotesSample.docx.sdlxliff");

            // act
            var xliff      = xliffReader.ReadXliff(testFile);
            var outputFile = sdlxliffFile + ".out.sdlxliff";
            var success    = sdlxliffWriter.UpdateFile(xliff, sdlxliffFile, outputFile);

            // assert
            Assert.Equal(support, xliff.Support);
        }
Exemplo n.º 14
0
        // Placed object message payload into a segment from a buffer pool.  When this get's too big, older blocks will be purged
        private ArraySegment <byte> SerializeMessageIntoPooledSegment(GeneratedBatchContainer queueMessage)
        {
            byte[] serializedPayload = this.serializationManager.SerializeToByteArray(queueMessage.Payload);
            // get size of namespace, offset, partitionkey, properties, and payload
            int size = SegmentBuilder.CalculateAppendSize(serializedPayload);

            // get segment
            ArraySegment <byte> segment;

            if (currentBuffer == null || !currentBuffer.TryGetSegment(size, out segment))
            {
                // no block or block full, get new block and try again
                currentBuffer = bufferPool.Allocate();
                //call EvictionStrategy's OnBlockAllocated method
                this.evictionStrategy.OnBlockAllocated(currentBuffer);
                // if this fails with clean block, then requested size is too big
                if (!currentBuffer.TryGetSegment(size, out segment))
                {
                    string errmsg = $"Message size is to big. MessageSize: {size}";
                    throw new ArgumentOutOfRangeException(nameof(queueMessage), errmsg);
                }
            }

            // encode namespace, offset, partitionkey, properties and payload into segment
            int writeOffset = 0;

            SegmentBuilder.Append(segment, ref writeOffset, serializedPayload);

            return(segment);
        }
Exemplo n.º 15
0
        public ParagraphUnitProviderTests()
        {
            var segmentBuilder = new SegmentBuilder();

            _paragraphUnitHelper = new ParagraphUnitHelper(segmentBuilder);

            var analysisBands = new List <AnalysisBand>
            {
                new AnalysisBand {
                    MaximumMatchValue = 74, MinimumMatchValue = 50
                },
                new AnalysisBand {
                    MaximumMatchValue = 84, MinimumMatchValue = 75
                },
                new AnalysisBand {
                    MaximumMatchValue = 94, MinimumMatchValue = 85
                },
                new AnalysisBand {
                    MaximumMatchValue = 99, MinimumMatchValue = 95
                }
            };
            var filterItemService = new FilterItemService(analysisBands);
            var segmentVisitor    = new SegmentVisitor();

            _paragraphUnitProvider = new ParagraphUnitProvider(segmentVisitor, filterItemService);
        }
        public void MultipleItemsAlignment()
        {
            var segment1 = new DataSegment(new byte[] { 1, 2, 3, 4 });
            var segment2 = new DataSegment(new byte[] { 1, 2, 3 });
            var segment3 = new DataSegment(new byte[] { 1, 2, 3, 4, 5 });

            var builder = new SegmentBuilder
            {
                { segment1, 8 },
                { segment2, 8 },
                { segment3, 8 }
            };

            builder.UpdateOffsets(0x400, 0x1000);

            Assert.Equal(0x400u, segment1.FileOffset);
            Assert.Equal(0x1000u, segment1.Rva);
            Assert.Equal(0x408u, segment2.FileOffset);
            Assert.Equal(0x1008u, segment2.Rva);
            Assert.Equal(0x410u, segment3.FileOffset);
            Assert.Equal(0x1010u, segment3.Rva);

            Assert.Equal(0x15u, builder.GetPhysicalSize());
            Assert.Equal(0x15u, builder.GetVirtualSize());

            Assert.Equal(new byte[]
            {
                1, 2, 3, 4, 0, 0, 0, 0,
                1, 2, 3, 0, 0, 0, 0, 0,
                1, 2, 3, 4, 5
            }, ToBytes(builder));
        }
Exemplo n.º 17
0
        public async ValueTask ForceReport(GroupMessageEventArgs eventArgs)
        {
            var groupId = eventArgs.SourceGroup.Id;
            var message = new MessageBody();
            var sender  = eventArgs.SenderInfo;

            message.Add(SegmentBuilder.At(sender.UserId));

            PcrReservationManager.Dequeue(groupId);
            var alluser = PcrReservationManager.PeekAll(groupId);
            var first   = alluser.FirstOrDefault();

            message.Add("嗯!我就当小伙伴出完刀了~");
            if (first != null)
            {
                message.Add("\n");
                message.Add(SegmentBuilder.At(first.UserId));
                if (first.IsOnTree)
                {
                    message.Add("你还在树上挂着!");
                }
                else
                {
                    message.Add("轮到您出刀了呢,出刀结束记得回复【报刀】!");
                }
            }
            message.AddRange(GetWaitUserMessage(alluser));

            await eventArgs.Reply(message);
        }
Exemplo n.º 18
0
        public IBatchContainer GetBatchContainer(ref CachedMessage cachedMessage)
        {
            //Deserialize payload
            int readOffset = 0;
            ArraySegment <byte> payload = SegmentBuilder.ReadNextBytes(cachedMessage.Segment, ref readOffset);
            MemoryMessageData   message = MemoryMessageData.Create(cachedMessage.StreamGuid, cachedMessage.StreamNamespace, new ArraySegment <byte>(payload.ToArray()));

            return(new MemoryBatchContainer <TSerializer>(message, this.serializer));
        }
Exemplo n.º 19
0
        public async ValueTask Report(GroupMessageEventArgs eventArgs)
        {
            var sender  = eventArgs.SenderInfo;
            var groupId = eventArgs.SourceGroup.Id;
            var message = new MessageBody();

            message.Add(SegmentBuilder.At(sender.UserId));

            var first = PcrReservationManager.Peek(groupId);

            if (first == null)
            {
                await eventArgs.Reply("你没约!");

                return;
            }

            if (sender.UserId != first.UserId)
            {
                var target = PcrReservationManager.SetCancel(groupId, sender.UserId);
                if (target == null)
                {
                    //出刀队列没有他
                    message.Add("好像没有您的预约记录。");
                }
                else
                {
                    message.Add("好的已经记录您提前出完刀啦~");
                }
            }
            else
            {
                PcrReservationManager.Dequeue(groupId);
                message.Add("(๑•̀ㅂ•́)و✧辛苦啦~");
            }

            var alluser = PcrReservationManager.PeekAll(groupId);

            first = alluser.FirstOrDefault();
            if (first != null)
            {
                message.Add("\n");
                message.Add(SegmentBuilder.At(first.UserId));
                if (first.IsOnTree)
                {
                    message.Add("你还在树上挂着!");
                }
                else
                {
                    message.Add("轮到您出刀了呢,出刀结束记得回复【报刀】!");
                }
            }
            message.AddRange(GetWaitUserMessage(alluser));

            await eventArgs.Reply(message);
        }
Exemplo n.º 20
0
        private static Segment[] getSegmentsFromTextbox(TextBox textbox)
        {
            var segments = new List <Segment>();

            foreach (string line in textbox.Lines)
            {
                segments.Add(SegmentBuilder.CreateFromString(line));
            }
            return(segments.ToArray());
        }
Exemplo n.º 21
0
        public void SegmentMatchClauseRetrievesSegmentFromStore()
        {
            var segment   = new SegmentBuilder("segkey").Version(1).Included("foo").Build();
            var evaluator = BasicEvaluator.WithStoredSegments(segment);

            var f    = new FeatureFlagBuilder("key").BooleanMatchingSegment("segkey").Build();
            var user = User.WithKey("foo");

            Assert.Equal(LdValue.Of(true), evaluator.Evaluate(f, user, EventFactory.Default).Result.Value);
        }
Exemplo n.º 22
0
        public ImportProcessor(IFileTypeManager fileTypeManager, TokenVisitor tokenVisitor,
                               ImportOptions settings, List <AnalysisBand> analysisBands, SegmentBuilder segmentBuilder)
        {
            _fileTypeManager = fileTypeManager;
            _analysisBands   = analysisBands;
            _settings        = settings;
            _segmentBuilder  = segmentBuilder;

            _tokenVisitor = tokenVisitor;
        }
Exemplo n.º 23
0
        /// <inheritdoc />
        public IBatchContainer GetBatchContainer(ref CachedMessage cachedMessage)
        {
            //Deserialize payload
            int readOffset = 0;
            ArraySegment <byte> payload = SegmentBuilder.ReadNextBytes(cachedMessage.Segment, ref readOffset);
            object payloadObject        = this.serializer.Deserialize <object>(payload);

            return(new GeneratedBatchContainer(cachedMessage.StreamId,
                                               payloadObject, new EventSequenceTokenV2(cachedMessage.SequenceNumber)));
        }
Exemplo n.º 24
0
    private void ComputeAllSegments()
    {
        allSegments.Clear();
        for (int i = 0; i < 4; ++i)
        {
            circleInter[i] = GetInterWithNextCircle(i);
        }

        if (seedInter.type == RaySphereIntersection.eType.None)
        {
            return;
        }


        int firstIndex = GetFirstIntersectingPlane(-1);

        if (firstIndex == -1)
        {
            // sphere is fully visible, the backCircle is the only circle segment
            // just take the point closest to any side plane as start
            Vector3 start = backPlaneInter.ProjectOnCircle(plane[0].ProjectedPoint(center));
            allSegments.Add(new CircleSegment(backPlaneInter.onPlane, backPlane.normal, start, 360));
            return;
        }
        var lsb = new List <SegmentBuilder>();

        for (int i = 0; i < 4; ++i)
        {
            if (planeInter[i].type != PlaneSphereIntersection.eType.Circle)
            {
                continue;
            }
            Vector3 s, e;
            GetPointsForCircleIntersection(i, out s, out e);

            if (IsVisible(e) || IsVisible(s))
            {
                lsb.Add(new SegmentBuilder(i, s, e));
            }
        }

        for (var index = 0; index < lsb.Count; index++)
        {
            SegmentBuilder builder = lsb[index];
            builder.BuildSegment(this);
            if (!circleInter[builder.planeIndex].HasValue)
            {
                // that segment doesn't end on a side circle,
                // we have to make the junction with the next one
                SegmentBuilder nextBuilder = lsb[(index + 1) % lsb.Count];
                SegmentBuilder junction    = new SegmentBuilder(-1, builder.end, nextBuilder.start);
                junction.BuildSegment(this);
            }
        }
    }
        public void MatchingRuleWithZeroRollout()
        {
            var clause = new ClauseBuilder().Attribute("email").Op("in").Values(LdValue.Of("*****@*****.**")).Build();
            var rule   = new SegmentRule(new List <Clause> {
                clause
            }, 0, null);
            var s = new SegmentBuilder("test").Version(1).Rules(rule).Build();
            var u = User.Builder("foo").Email("*****@*****.**").Build();

            Assert.False(SegmentMatchesUser(s, u));
        }
        public void CanCreateCompleteSegment()
        {
            var segment = SegmentBuilder.Create(s =>
                                                s.DepartingFrom("AMS").DepartingOn(2019, 03, 08, 15, 20).ArrivingAt("BCN")
                                                .ArrivingOn(2019, 03, 08, 17, 30));

            Assert.Equal("AMS", segment.DepartureStation);
            Assert.Equal("BCN", segment.ArrivalStation);
            Assert.Equal(new DateTime(2019, 03, 08, 15, 20, 00), segment.DepartureTime);
            Assert.Equal(new DateTime(2019, 03, 08, 17, 30, 00), segment.ArrivalTime);
        }
Exemplo n.º 27
0
        public IBatchContainer GetBatchContainer(ref CachedMessage cachedMessage)
        {
            //Deserialize payload
            int readOffset = 0;
            ArraySegment <byte> payload = SegmentBuilder.ReadNextBytes(cachedMessage.Segment, ref readOffset);
            var    stream        = new BinaryTokenStreamReader(payload);
            object payloadObject = this.serializationManager.Deserialize(stream);

            return(new GeneratedBatchContainer(cachedMessage.StreamGuid, cachedMessage.StreamNamespace,
                                               payloadObject, new EventSequenceTokenV2(cachedMessage.SequenceNumber)));
        }
        private void                    optimize()
        {
            var lRegSegments = new SegmentBuilder(mFrame, false);
            var lBitSegments = new SegmentBuilder((uint)mFrame * 16, true);

            string lSegName;

            int lCount = mItemList.Count;

            for (int i = 0; i < lCount; i++)
            {
                lSegName = mItemList[i].SlaveID.ToString();
                switch (mItemList[i].RegisterType)
                {
                case ERegisterType.HOLDING_REGISTER:    lSegName = lSegName + "HR"; break;

                case ERegisterType.INPUT_REGISTER:      lSegName = lSegName + "IR"; break;

                case ERegisterType.COIL_BIT:            lSegName = lSegName + "C"; break;

                case ERegisterType.INPUT_BIT:           lSegName = lSegName + "I"; break;
                }

                if (mItemList[i].RegisterType == ERegisterType.HOLDING_REGISTER || mItemList[i].RegisterType == ERegisterType.INPUT_REGISTER)
                {
                    lRegSegments.addItem(lSegName, mItemList[i]);
                }
                else
                {
                    lBitSegments.addItem(lSegName, mItemList[i]);
                }
            }

            var lSeg = lRegSegments.getSegments();

            mSegRegActual = new bool[lSeg.Item1.Length];
            mSegRegStart  = lSeg.Item1;
            mSegRegBuffer = new ushort[lSeg.Item1.Length][];

            for (int i = 0; i < lSeg.Item1.Length; i++)
            {
                mSegRegBuffer[i] = new ushort[lSeg.Item2[i]];
            }

            lSeg          = lBitSegments.getSegments();
            mSegBitActual = new bool[lSeg.Item1.Length];
            mSegBitStart  = lSeg.Item1;
            mSegBitBuffer = new bool[lSeg.Item1.Length][];

            for (int i = 0; i < lSeg.Item1.Length; i++)
            {
                mSegBitBuffer[i] = new bool[lSeg.Item2[i]];
            }
        }
Exemplo n.º 29
0
        public WizardPageImportPreparationViewModel(Window owner, object view, WizardContext wizardContext,
                                                    SegmentBuilder segmentBuilder, PathInfo pathInfo) : base(owner, view, wizardContext)
        {
            _segmentBuilder = segmentBuilder;
            _pathInfo       = pathInfo;

            IsValid = true;
            InitializeJobProcessList();

            LoadPage  += OnLoadPage;
            LeavePage += OnLeavePage;
        }
Exemplo n.º 30
0
        public async ValueTask ForceClear(GroupMessageEventArgs eventArgs)
        {
            var groupId = eventArgs.SourceGroup.Id;
            var message = new MessageBody();
            var sender  = eventArgs.SenderInfo;

            message.Add(SegmentBuilder.At(sender.UserId));

            PcrReservationManager.ClearQueue(groupId);
            message.Add("队列已清空");
            await eventArgs.Reply(message);
        }