示例#1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="ExportUsfmDialog"/> class.
        /// </summary>
        /// <param name="cache">database cache</param>
        /// <param name="filter">book filter to display which books we will export</param>
        /// <param name="appKey">location of registry</param>
        /// <param name="markup">type of markup format for export:
        /// Paratext (one domain, non-interleaved) OR Toolbox (optionally interleaved)</param>
        /// ------------------------------------------------------------------------------------
        public ExportUsfmDialog(FdoCache cache, FilteredScrBooks filter, RegistryKey appKey,
                                MarkupType markup) : this()
        {
            m_cache      = cache;
            m_markupType = markup;          // let dialog know if this is for Paratext or Toolbox
            if (appKey != null)             // might be null in tests - in this case derived class has to provide a m_regGroup
            {
                m_regGroup = new RegistryGroup(appKey, "ExportUsfmSettings");
            }

            // Display books and markup labels
            string filtered = (filter.AllBooks ? TeResourceHelper.GetResourceString("kstidExportDlgUnfiltered") :
                               TeResourceHelper.GetResourceString("kstidExportDlgFiltered"));
            string booksToExport = GetExportedBooksStr(filter);

            if (filter.BookCount == 1)
            {
                lblBooks.Text = string.Format(TeResourceHelper.GetResourceString("kstidBooksToExportSingularForm"),
                                              filtered, booksToExport);
            }
            else
            {
                lblBooks.Text = string.Format(lblBooks.Text, filter.BookCount, filtered, booksToExport);
            }
        }
示例#2
0
 public CaptureMarkupDefinition(MarkupType type, string startSyntax, string endSyntax)
 {
     Type        = type;
     StartSyntax = startSyntax;
     EndSyntax   = endSyntax;
     StartSpans  = new Stack <TextSpan>();
 }
        public static MarkedSegment SeekSegment(this byte[] array, int itemSize = 0)
        {
            int noiseCount = (array.Length > 4096) ? 1024 : 4096;

            long endPosition     = array.Length;
            long endTempPosition = 0;

            MarkupType endNoise = array.SeekMarkup(out endTempPosition, SeekDirection.Backward, 0, noiseCount);

            if (endNoise != MarkupType.None)
            {
                endPosition = endTempPosition;
            }

            long startPosition     = 0;
            long startTempPosition = 0;

            MarkupType startNoise = array.SeekMarkup(out startTempPosition, SeekDirection.Forward, 0, noiseCount);

            if (startNoise != MarkupType.None)
            {
                startPosition = startTempPosition;
            }

            return(new MarkedSegment()
            {
                Offset = startPosition, Length = endPosition - startPosition, ItemSize = itemSize
            });
        }
 public MarkupGlobalConfig(
     Client client,
     MarkupType type = MarkupType.Over)
 {
     Type   = type;
     Client = client;
 }
        public MarkupType HttpHeader(int received)
        {
            MarkupType noiseKind = MarkupType.None;

            lock (binReceive)
            {
                if (SerialPacketSize == 0)
                {
                    SerialPacketSize = 1;
                    msReceive        = new MemoryStream();
                }

                msReceive.Write(HeaderBuffer, 0, received);

                if (received < BufferSize)
                {
                    SerialPacketSize   = 0;
                    msReceive.Position = 0;
                    ParseRequest(msReceive);
                    ReadHeaders(msReceive);
                    if (VerifyRequest())
                    {
                        binReceive = msReceive.ToArray().Skip(Convert.ToInt32(msReceive.Position)).ToArray();
                    }
                    else
                    {
                        Denied = true;
                    }
                }
            }
            return(noiseKind);
        }
 public static MarkupConfig Calculate(IEnumerable <MarkupConfig> markups, MarkupType type, decimal cost, Address address)
 {
     return(markups.OrderBy(s => s.Begin)
            .FirstOrDefault(x => x.Type == type &&
                            x.Address.Id == address.Id &&
                            cost > x.Begin &&
                            cost <= x.End));
 }
        private void UpdateMarkupsByType(Address[] dstAddresses, MarkupType type)
        {
            var items = Settings.Value.Markups.Where(x => x.Type == type).ToArray();
            var src   = items.Where(x => x.Address == MarkupAddress.Value).ToArray();

            Settings.Value.Markups.RemoveEach(items.Except(src));
            Settings.Value.Markups.AddEach(dstAddresses.SelectMany(x => src.Select(y => new MarkupConfig(y, x))));
        }
示例#8
0
 public int MarkupCount(Guid sourceId, string moduleKey, MarkupType markupType)
 {
     return
         (_currencyService.Count <Markup>(
              m =>
              m.SourceId == sourceId && m.ModuleKey.Equals(moduleKey, StringComparison.OrdinalIgnoreCase) &&
              m.MarkupType == markupType));
 }
 internal static byte Translate(MarkupType markupType)
 {
     if (markupType != 0 && markupType == MarkupType.HTML)
     {
         return(1);
     }
     return(0);
 }
示例#10
0
 public ProductCategoryDiscount(string name, ProductCategory category, bool shouldApplyToAll, DateTime beginDate, DateTime?endDate, double markupValue, MarkupType markupType)
 {
     Name             = name;
     Category         = category;
     ShouldApplyToAll = shouldApplyToAll;
     BeginDate        = beginDate;
     EndDate          = endDate;
     Value            = markupValue;
     MarkupType       = markupType;
 }
        /// <summary>
        /// The Markup.
        /// </summary>
        /// <param name="stream">The stream<see cref="Stream"/>.</param>
        /// <param name="blocksize">The blocksize<see cref="long"/>.</param>
        /// <param name="bytenoise">The bytenoise<see cref="MarkupType"/>.</param>
        /// <returns>The <see cref="Stream"/>.</returns>
        public static Stream Markup(this Stream stream, long blocksize, MarkupType bytenoise)
        {
            long blockSize = blocksize;
            long blockLeft = stream.Length % blockSize;
            long resize    = (blockSize - blockLeft >= 28) ? blockSize - blockLeft - 16 : blockSize + (blockSize - blockLeft) - 16;

            byte[] byteMarkup = new byte[resize].Initialize((byte)bytenoise);
            stream.Write(byteMarkup, 0, (int)resize);
            return(stream);
        }
        public IList <MarkupConfig> MarkupByType(MarkupType type, Address currentddress)
        {
            var result = Settings.Value.Markups
                         .Where(t => t.Type == type && t.Address == currentddress)
                         .OrderBy(m => m.Begin)
                         .LinkTo(Settings.Value.Markups, i => Settings.Value.AddMarkup((MarkupConfig)i));

            MarkupConfig.Validate(result);
            return(result);
        }
示例#13
0
        public static byte Translate(MarkupType markupType)
        {
            switch (markupType)
            {
            case MarkupType.HTML:
                return(1);

            default:
                return(0);
            }
        }
        public unsafe MarkupType IncomingMessage(int received)
        {
            disposed = false;
            MarkupType noiseKind = MarkupType.None;

            if (Protocol == DealProtocol.DOTP)
            {
                return(SyncMessage(received));
            }
            return(noiseKind);
        }
 public IMarkupProcessor GetProcessor(MarkupType markupType)
 {
     switch (markupType)
       {
     case MarkupType.Markdown:
       return new MarkdownProcessor();
     case MarkupType.Textile:
       return new TextileProcessor();
     default:
       throw new ArgumentOutOfRangeException("markupType");
       }
 }
示例#16
0
        public void MessageReceivedCallback(IAsyncResult result)
        {
            ITransferContext context   = (ITransferContext)result.AsyncState;
            MarkupType       noiseKind = MarkupType.None;

            int receive = context.Listener.EndReceive(result);

            if (receive > 0)
            {
                noiseKind = context.IncomingMessage(receive);
            }

            if (context.DeserialPacketSize > 0)
            {
                int buffersize = (context.DeserialPacketSize < context.BufferSize) ? (int)context.DeserialPacketSize : context.BufferSize;
                context.Listener.BeginReceive(context.MessageBuffer, 0, buffersize, SocketFlags.None, MessageReceivedCallback, context);
            }
            else
            {
                object received     = context.DeserialPacket;
                object readPosition = context.DeserialPacketId;

                if (noiseKind == MarkupType.Block || (noiseKind == MarkupType.End && (int)readPosition < (context.Transfer.HeaderReceived.Context.ObjectsCount - 1)))
                {
                    context.Listener.BeginReceive(context.MessageBuffer, 0, context.BufferSize, SocketFlags.None, MessageReceivedCallback, context);
                }

                TransferOperation request = new TransferOperation(context.Transfer, MessagePart.Message, DirectionType.Receive);
                request.Resolve(received, readPosition);

                if (context.ObjectsLeft <= 0 && !context.BatchesReceivedNotice.SafeWaitHandle.IsClosed)
                {
                    context.BatchesReceivedNotice.Set();
                }

                if (noiseKind == MarkupType.End && (int)readPosition >= (context.Transfer.HeaderReceived.Context.ObjectsCount - 1))
                {
                    context.BatchesReceivedNotice.WaitOne();
                    context.MessageReceivedNotice.Set();

                    try
                    {
                        MessageReceived.Execute(context);
                    }
                    catch (Exception ex)
                    {
                        Echo(ex.Message);
                        CloseClient(context.Id);
                    }
                }
            }
        }
        public static byte[] Markup(this byte[] array, int blocksize, MarkupType bytenoise, int written = 0, int byteprefix = 0)
        {
            int  arrayLength = (written > 0) ? written : array.Length;
            int  blockSize   = blocksize;
            long blockLeft   = arrayLength % blockSize;
            long resize      = (blockSize - blockLeft >= 28) ? blockSize - blockLeft - byteprefix : blockSize + (blockSize - blockLeft) - byteprefix;

            byte[] byteMarkup = new byte[resize].Initialize((byte)bytenoise);
            Array.Resize <byte>(ref array, arrayLength + (int)resize);
            byteMarkup.CopyTo(array, arrayLength);
            byteMarkup = null;
            return(array);
        }
 public MarkupGlobalConfig(decimal begin,
                           decimal end,
                           decimal markup,
                           Client client,
                           MarkupType type = MarkupType.Over)
 {
     Begin     = begin;
     End       = end;
     Markup    = markup;
     MaxMarkup = markup;
     Type      = type;
     Client    = client;
 }
示例#19
0
 public void Process(MarkupType type, string source)
 {
     try
       {
     var processor = ProcessorFactory.GetProcessor(type);
     PropertyBag["result"] = processor.Process(source);
       }
       catch (ArgumentOutOfRangeException)
       {
     RenderView("error");
     PropertyBag["message"] = "No suitable markup processor found";
       }
 }
示例#20
0
 public MarkupConfig(Address address,
                     decimal begin,
                     decimal end,
                     decimal markup,
                     MarkupType type = MarkupType.Over)
 {
     Address   = address;
     Begin     = begin;
     End       = end;
     Markup    = markup;
     MaxMarkup = markup;
     Type      = type;
 }
 private void Parse()
 {
     if (m_parsed)
     {
         return;
     }
     try
     {
         m_parsed = true;
         m_paragraphDef.CriGenerationPhase = ReportElement.CriGenerationPhases.Definition;
         m_textRunDef.CriGenerationPhase   = ReportElement.CriGenerationPhases.Definition;
         ReportEnumProperty <MarkupType> markupType = m_textRunDef.MarkupType;
         MarkupType     markupType2    = (!markupType.IsExpression) ? markupType.Value : m_textRunDef.Instance.MarkupType;
         RichTextParser richTextParser = null;
         if (markupType2 != MarkupType.HTML)
         {
             return;
         }
         richTextParser = new HtmlParser(m_multipleParagraphsAllowed, this, this);
         InternalTextRunInstance internalTextRunInstance = (InternalTextRunInstance)m_textRunDef.Instance;
         Microsoft.ReportingServices.RdlExpressions.VariantResult originalValue = internalTextRunInstance.GetOriginalValue();
         if (!originalValue.ErrorOccurred && originalValue.TypeCode != 0)
         {
             try
             {
                 string richText = (originalValue.TypeCode != TypeCode.String) ? internalTextRunInstance.TextRunDef.FormatTextRunValue(originalValue.Value, originalValue.TypeCode, m_textRunDef.RenderingContext.OdpContext) : (originalValue.Value as string);
                 m_compiledParagraphCollection = (CompiledParagraphInstanceCollection)richTextParser.Parse(richText);
             }
             catch (Exception ex)
             {
                 m_errorContext.Register(ProcessingErrorCode.rsInvalidRichTextParseFailed, Severity.Warning, "TextRun", internalTextRunInstance.TextRunDef.Name, ex.Message);
                 m_parseErrorOccured         = true;
                 CreateSingleTextRun().Value = RPRes.rsRichTextParseErrorValue;
             }
         }
         else
         {
             ICompiledTextRunInstance compiledTextRunInstance = CreateSingleTextRun();
             if (originalValue.ErrorOccurred)
             {
                 compiledTextRunInstance.Value = RPRes.rsExpressionErrorValue;
             }
         }
     }
     finally
     {
         m_textRunDef.CriGenerationPhase   = ReportElement.CriGenerationPhases.None;
         m_paragraphDef.CriGenerationPhase = ReportElement.CriGenerationPhases.None;
     }
 }
示例#22
0
 public bool ClearMarkup(string moduleKey, string memberId, MarkupType markupType)
 {
     try
     {
         return(_currencyService.DeleteByConditon <Markup>(
                    m =>
                    m.ModuleKey.Equals(moduleKey, StringComparison.OrdinalIgnoreCase) &&
                    m.MemberId.Equals(memberId, StringComparison.OrdinalIgnoreCase) && m.MarkupType == markupType) > 0);
     }
     catch (Exception ex)
     {
         Logger.Error(ex, "清理标记出错了");
         return(false);
     }
 }
        /// <summary>
        /// The SeekMarkup.
        /// </summary>
        /// <param name="stream">The stream<see cref="Stream"/>.</param>
        /// <param name="seekorigin">The seekorigin<see cref="SeekOrigin"/>.</param>
        /// <param name="direction">The direction<see cref="SeekDirection"/>.</param>
        /// <param name="offset">The offset<see cref="int"/>.</param>
        /// <param name="_length">The _length<see cref="int"/>.</param>
        /// <returns>The <see cref="MarkupType"/>.</returns>
        public static MarkupType SeekMarkup(this Stream stream, SeekOrigin seekorigin = SeekOrigin.Begin, SeekDirection direction = SeekDirection.Forward, int offset = 0, int _length = -1)
        {
            bool       isFwd     = (direction != SeekDirection.Forward) ? false : true;
            short      noiseFlag = 0;
            MarkupType noiseKind = MarkupType.None;
            MarkupType lastKind  = MarkupType.None;

            if (stream.Length > 0)
            {
                long length       = (_length <= 0) ? stream.Length : _length;
                long saveposition = stream.Position;
                offset += (!isFwd) ? 1 : 0;
                length -= ((!isFwd) ? 0 : 1);

                for (int i = offset; i < length; i++)
                {
                    if (!isFwd)
                    {
                        stream.Seek(-i, seekorigin);
                    }
                    else
                    {
                        stream.Seek(i, seekorigin);
                    }

                    byte checknoise = (byte)stream.ReadByte();

                    MarkupType tempKind = MarkupType.None;
                    if (checknoise.IsMarkup(out tempKind))
                    {
                        lastKind = tempKind;
                        noiseFlag++;
                    }
                    else if (noiseFlag >= 16)
                    {
                        noiseKind = lastKind;
                        return(noiseKind);
                    }
                    else
                    {
                        lastKind  = tempKind;
                        noiseFlag = 0;
                    }
                }
                stream.Position = saveposition;
            }
            return(lastKind);
        }
        public static MarkupType SeekMarkup(this byte[] array, out long position, SeekDirection direction = SeekDirection.Forward, int offset = 0, int _length = -1)
        {
            bool       isFwd     = (direction != SeekDirection.Forward) ? false : true;
            short      noiseFlag = 0;
            MarkupType noiseKind = MarkupType.None;
            MarkupType lastKind  = MarkupType.None;

            if (array.Length > 0)
            {
                long length      = (_length <= 0 || _length > array.Length) ? array.Length : _length;
                int  arraylength = array.Length;
                offset += (!isFwd) ? 1 : 0;
                length -= ((!isFwd) ? 0 : 1);

                for (int i = offset; i < length; i++)
                {
                    byte checknoise = 0;
                    if (!isFwd)
                    {
                        checknoise = array[arraylength - i];
                    }
                    else
                    {
                        checknoise = array[i];
                    }

                    MarkupType tempKind = MarkupType.None;
                    if (checknoise.IsMarkup(out tempKind))
                    {
                        lastKind = tempKind;
                        noiseFlag++;
                    }
                    else if (noiseFlag >= 16)
                    {
                        noiseKind = lastKind;
                        position  = (!isFwd) ? arraylength - i + 1 : i;
                        return(noiseKind);
                    }
                    else
                    {
                        lastKind  = tempKind;
                        noiseFlag = 0;
                    }
                }
            }
            position = (!isFwd && noiseFlag != 0) ? array.Length - noiseFlag + 1 : 0;
            return(lastKind);
        }
示例#25
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Gets the scheme format in a format that can be presented in the User Interface (this
        /// is also the format Paratext uses internally).
        /// </summary>
        /// <param name="markup">The markup.</param>
        /// <param name="scheme">The scheme.</param>
        /// ------------------------------------------------------------------------------------
        public static string GetUiSchemeFormat(MarkupType markup, SchemeFormat scheme)
        {
            string mattBookNum = (markup == MarkupType.Paratext) ? "41" : "40";

            switch (scheme)
            {
            default:
            case SchemeFormat.NNBBB:
                return(mattBookNum + "MAT");

            case SchemeFormat.BBB:
                return("MAT");

            case SchemeFormat.NN:
                return(mattBookNum);
            }
        }
示例#26
0
        public List <Member> LoadByPage(Guid sourceId, string moduleKey, MarkupType markupType, int pageIndex, int pageSize, out int totalCount)
        {
            totalCount = MarkupCount(sourceId, moduleKey, markupType);

            using (var dbContext = new MarkupDbContext())
            {
                var members = (from m in dbContext.Markups
                               join member in dbContext.Members
                               on m.MemberId equals member.Id
                               where
                               m.SourceId == sourceId && m.ModuleKey.Equals(moduleKey, StringComparison.OrdinalIgnoreCase) &&
                               m.MarkupType == markupType
                               orderby m.CreateTime descending
                               select member).Skip((pageIndex - 1) * pageSize).Take(pageSize);

                return(members.ToList());
            }
        }
        public MarkupType ReceiveBytes(byte[] buffer, long received)
        {
            MarkupType noiseKind = MarkupType.None;

            lock (binReceive)
            {
                int  offset = 0, length = (int)received;
                bool inprogress = false;
                if (SerialPacketSize == 0)
                {
                    SerialPacketSize = BitConverter.ToInt64(buffer, 4);
                    DeserialPacketId = BitConverter.ToInt32(buffer, 12);
                    binReceive       = new byte[SerialPacketSize];
                    GCHandle gc = GCHandle.Alloc(binReceive, GCHandleType.Pinned);
                    binReceivePtr = GCHandle.ToIntPtr(gc);
                    offset        = SerialPacketOffset;
                    length       -= SerialPacketOffset;
                }

                if (SerialPacketSize > 0)
                {
                    inprogress = true;
                }

                SerialPacketSize -= length;

                if (SerialPacketSize < 1)
                {
                    long endPosition = received;
                    noiseKind = buffer.SeekMarkup(out endPosition, SeekDirection.Backward);
                }

                int destid = (binReceive.Length - ((int)SerialPacketSize + length));
                if (inprogress)
                {
                    fixed(byte *msgbuff = buffer)
                    {
                        Extractor.CopyBlock(GCHandle.FromIntPtr(binReceivePtr).AddrOfPinnedObject().ToPointer(), (ulong)destid, msgbuff, (ulong)offset, (ulong)length);
                        //  Extractor.CopyBlock(GCHandle.FromIntPtr(binReceivePtr).AddrOfPinnedObject() + destid, new IntPtr(msgbuff) + offset, (ulong)length);
                    }
                }
            }
            return(noiseKind);
        }
        public unsafe MarkupType SyncMessage(int received)
        {
            MarkupType noiseKind = MarkupType.None;

            lock (binReceive)
            {
                int  offset = 0, length = received;
                bool inprogress = false;

                if (SerialPacketSize == 0)
                {
                    SerialPacketSize = *((int *)(messageBufferAddress + 4).ToPointer());
                    DeserialPacketId = *((int *)(messageBufferAddress + 12).ToPointer());

                    binReceive = new byte[SerialPacketSize];
                    GCHandle gc = GCHandle.Alloc(binReceive, GCHandleType.Pinned);
                    binReceiveHandler = GCHandle.ToIntPtr(gc);
                    binReceiveAddress = gc.AddrOfPinnedObject();

                    offset  = SerialPacketOffset;
                    length -= SerialPacketOffset;
                }

                if (SerialPacketSize > 0)
                {
                    inprogress = true;
                }

                SerialPacketSize -= length;

                if (SerialPacketSize < 1)
                {
                    long endPosition = length;
                    noiseKind = MessageBuffer.SeekMarkup(out endPosition, SeekDirection.Backward);
                }

                int destid = (int)(binReceive.Length - (SerialPacketSize + length));
                if (inprogress)
                {
                    Extractor.CopyBlock(binReceiveAddress, destid, messageBufferAddress, offset, length);
                }
            }
            return(noiseKind);
        }
        public MarkupType IncomingHeader(int received)
        {
            disposed = false;
            MarkupType noiseKind = MarkupType.None;

            if (Protocol == DealProtocol.NONE)
            {
                IdentifyProtocol();
            }
            if (Protocol == DealProtocol.DOTP)
            {
                return(SyncHeader(received));
            }
            else if (Protocol == DealProtocol.HTTP)
            {
                return(HttpHeader(received));
            }
            return(noiseKind);
        }
 public static string GetTypeDescription(MarkupType type)
 {
     if (type == MarkupType.VitallyImportant)
     {
         return("Наценки ЖНВЛС");
     }
     if (type == MarkupType.Over)
     {
         return("Наценки на прочий ассортимент");
     }
     if (type == MarkupType.Nds18)
     {
         return("Наценки товара с 18% НДС");
     }
     if (type == MarkupType.Special)
     {
         return("Специальные наценки");
     }
     return("Не определен");
 }
        /// <summary>
        /// The IsMarkup.
        /// </summary>
        /// <param name="checknoise">The checknoise<see cref="byte"/>.</param>
        /// <param name="noisekind">The noisekind<see cref="MarkupType"/>.</param>
        /// <returns>The <see cref="bool"/>.</returns>
        public static bool IsMarkup(this byte checknoise, out MarkupType noisekind)
        {
            switch (checknoise)
            {
            case (byte)MarkupType.Block:
                noisekind = MarkupType.Block;
                return(true);

            case (byte)MarkupType.End:
                noisekind = MarkupType.End;
                return(true);

            case (byte)MarkupType.Empty:
                noisekind = MarkupType.Empty;
                return(false);

            default:
                noisekind = MarkupType.None;
                return(false);
            }
        }
        /// <summary>
        /// The IsSpliter.
        /// </summary>
        /// <param name="checknoise">The checknoise<see cref="byte"/>.</param>
        /// <param name="spliterkind">The spliterkind<see cref="MarkupType"/>.</param>
        /// <returns>The <see cref="bool"/>.</returns>
        public static bool IsSpliter(this byte checknoise, out MarkupType spliterkind)
        {
            switch (checknoise)
            {
            case (byte)MarkupType.Empty:
                spliterkind = MarkupType.Empty;
                return(true);

            case (byte)MarkupType.Line:
                spliterkind = MarkupType.Line;
                return(true);

            case (byte)MarkupType.Space:
                spliterkind = MarkupType.Space;
                return(true);

            case (byte)MarkupType.Semi:
                spliterkind = MarkupType.Semi;
                return(true);

            case (byte)MarkupType.Coma:
                spliterkind = MarkupType.Coma;
                return(true);

            case (byte)MarkupType.Colon:
                spliterkind = MarkupType.Colon;
                return(true);

            case (byte)MarkupType.Dot:
                spliterkind = MarkupType.Dot;
                return(true);

            default:
                spliterkind = MarkupType.None;
                return(false);
            }
        }
示例#33
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Gets the book number to be used in the exported file name. ParaText numbering schemes
		/// begin the New Testament with 41 instead of 40.
		/// </summary>
		/// <param name="bookNum">canonical number of the book.</param>
		/// <param name="markupSystem">whether export is for Toolbox or ParaText</param>
		/// <returns>the number used to represent the book, adjusted for ParaText as needed</returns>
		/// ------------------------------------------------------------------------------------
		protected static int GetExportBookCanonicalNum(int bookNum, MarkupType markupSystem)
		{
			// Increment ParaText book Ids for New Testament books by 1
			if (markupSystem == MarkupType.Paratext && bookNum > 39)
				return bookNum + 1;
			else
				return bookNum;
		}
示例#34
0
文件: Markup.cs 项目: arccoza/redu
 public static bool Find(MarkupType markup, IList<byte> data, int start, int count, ref int index)
 {
     return Find(B[markup], data, start, count, ref index);
 }
示例#35
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="ExportUsfmDialog"/> class.
		/// </summary>
		/// <param name="cache">database cache</param>
		/// <param name="filter">book filter to display which books we will export</param>
		/// <param name="appKey">location of registry</param>
		/// <param name="markup">type of markup format for export:
		/// Paratext (one domain, non-interleaved) OR Toolbox (optionally interleaved)</param>
		/// <param name="helpTopicProvider">The help topic provider.</param>
		/// <param name="app">The application</param>
		/// ------------------------------------------------------------------------------------
		public ExportUsfmDialog(FdoCache cache, FilteredScrBooks filter, RegistryKey appKey,
			MarkupType markup, IHelpTopicProvider helpTopicProvider, IApp app) : this()
		{
			m_cache = cache;
			m_helpTopicProvider = helpTopicProvider;
			m_app = app;
			m_markupType = markup; // let dialog know if this is for Paratext or Toolbox
			if (appKey != null) // might be null in tests - in this case derived class has to provide a m_regGroup
				m_regGroup = new RegistryGroup(appKey, "ExportUsfmSettings");

			// Display books and markup labels
			string filtered = (filter.AllBooks ? TeResourceHelper.GetResourceString("kstidExportDlgUnfiltered") :
				TeResourceHelper.GetResourceString("kstidExportDlgFiltered"));
			string booksToExport = GetExportedBooksStr(filter);
			if (filter.BookCount == 1)
			{
				lblBooks.Text = string.Format(TeResourceHelper.GetResourceString("kstidBooksToExportSingularForm"),
					filtered, booksToExport);
			}
			else
			{
				lblBooks.Text = string.Format(lblBooks.Text, filter.BookCount, filtered, booksToExport);
			}
		}
示例#36
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Exposes the GetExportBookCanonicalNum method.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public new int GetExportBookCanonicalNum(int bookNum, MarkupType markupSystem)
		{
			CheckDisposed();

			return ExportUsfm.GetExportBookCanonicalNum(bookNum, markupSystem);
		}
示例#37
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Sets up and verifies that usfm and toolbox exported scriptures do not include
		/// references with checking error annotations.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private void VerifyOutputForRefWithCheckingError(MarkupType type, string source,
			string[] expected)
		{
			using (DummyFileMaker filemaker = new DummyFileMaker("junk.jpg", true))
			{
				IScrSection section =
					ExportHelper.CreateSection(this, m_book, "My section head");

				IScrTxtPara para = ExportHelper.AppendParagraph(this,
					m_book, section, source, m_wsVern, ScrStyleNames.NormalParagraph);

				AddAnnotation(para, new BCVRef(1001001), NoteType.CheckingError);

				// export
				m_exporter.MarkupSystem = type;
				m_exporter.ExportScriptureDomain = true;
				m_exporter.ExportBackTranslationDomain = false;
				m_exporter.ExportNotesDomain = true;
				m_exporter.ExportParagraph(para);
				m_exporter.FileWriter.VerifyOutput(expected);
			}
		}
示例#38
0
 public Forum(long forumID, long forumCategoryID, string forumCode, string name, string description, string uRLToken, DateTime dateCreated, int? rank, AccessType postWriteAccess, AccessType replyWriteAccess, AccessType readAccess, long? postWriteAccessRoleID, long? replyWriteAccessRoleID, long? readAccessRoleID, long? moderatorRoleID, MarkupType markupLevel, bool? showSignatures, bool allowImagesInMessages, bool allowImagesInSignatures, bool requireModeration, bool allowVoting, DisplayOrderType topicDisplayOrder, bool locked)
 {
     this.forumID = forumID;
     this.forumCategoryID = forumCategoryID;
     this.forumCode = forumCode;
     this.name = name;
     this.description = description;
     this.uRLToken = uRLToken;
     this.dateCreated = dateCreated;
     this.rank = rank;
     this.postWriteAccess = (short)postWriteAccess;
     this.replyWriteAccess = (short)replyWriteAccess;
     this.readAccess = (short)readAccess;
     this.postWriteAccessRoleID = postWriteAccessRoleID;
     this.replyWriteAccessRoleID = replyWriteAccessRoleID;
     this.readAccessRoleID = readAccessRoleID;
     this.moderatorRoleID = moderatorRoleID;
     this.markupLevel = (short)markupLevel;
     this.showSignatures = showSignatures;
     this.allowImagesInMessages = allowImagesInMessages;
     this.allowImagesInSignatures = allowImagesInSignatures;
     this.requireModeration = requireModeration;
     this.allowVoting = allowVoting;
     this.topicDisplayOrder = (short)topicDisplayOrder;
     this.locked = locked;
 }
 public void ShouldReturnCorrectInstance(MarkupType type, Type expectedProcessor)
 {
     var factory = new MarkupProcessorFactory();
       var processor = factory.GetProcessor(type);
       Assert.That(processor, Is.InstanceOf(expectedProcessor));
 }
示例#40
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Gets the scheme format in a format that can be presented in the User Interface (this
		/// is also the format Paratext uses internally).
		/// </summary>
		/// <param name="markup">The markup.</param>
		/// <param name="scheme">The scheme.</param>
		/// ------------------------------------------------------------------------------------
		public static string GetUiSchemeFormat(MarkupType markup, SchemeFormat scheme)
		{
			string mattBookNum = (markup == MarkupType.Paratext) ? "41" : "40";
			switch (scheme)
			{
				default:
				case SchemeFormat.NNBBB:
					return mattBookNum + "MAT";
				case SchemeFormat.BBB:
					return "MAT";
				case SchemeFormat.NN:
					return mattBookNum;
			}
		}