Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetChars() [2/6]

unsafe override int System.Text.ISCIIEncoding.GetChars ( byte * bytes,
int byteCount,
char * chars,
int charCount,
System::Text::DecoderNLS baseDecoder )
inlinevirtual

Reimplemented from System.Text.EncodingNLS.

Definition at line 623 of file ISCIIEncoding.cs.

624 {
625 ISCIIDecoder iSCIIDecoder = (ISCIIDecoder)baseDecoder;
626 EncodingCharBuffer encodingCharBuffer = new EncodingCharBuffer(this, iSCIIDecoder, chars, charCount, bytes, byteCount);
627 int num = _defaultCodePage;
628 bool flag = false;
629 bool flag2 = false;
630 bool flag3 = false;
631 char c = '\0';
632 char c2 = '\0';
633 if (iSCIIDecoder != null)
634 {
635 num = iSCIIDecoder.currentCodePage;
636 flag = iSCIIDecoder.bLastATR;
637 flag2 = iSCIIDecoder.bLastVirama;
638 flag3 = iSCIIDecoder.bLastDevenagariStressAbbr;
639 c = iSCIIDecoder.cLastCharForNextNukta;
640 c2 = iSCIIDecoder.cLastCharForNoNextNukta;
641 }
642 bool flag4 = flag2 || flag || flag3 || c != '\0';
643 int num2 = -1;
644 if (num >= 2 && num <= 11)
645 {
647 }
648 while (encodingCharBuffer.MoreData)
649 {
650 byte nextByte = encodingCharBuffer.GetNextByte();
651 if (flag4)
652 {
653 flag4 = false;
654 if (flag)
655 {
656 if (nextByte >= 66 && nextByte <= 75)
657 {
658 num = nextByte & 0xF;
660 flag = false;
661 continue;
662 }
663 if (nextByte == 64)
664 {
665 num = _defaultCodePage;
666 num2 = -1;
667 if (num >= 2 && num <= 11)
668 {
670 }
671 flag = false;
672 continue;
673 }
674 if (nextByte == 65)
675 {
676 num = _defaultCodePage;
677 num2 = -1;
678 if (num >= 2 && num <= 11)
679 {
681 }
682 flag = false;
683 continue;
684 }
685 if (!encodingCharBuffer.Fallback(239))
686 {
687 break;
688 }
689 flag = false;
690 }
691 else if (flag2)
692 {
693 if (nextByte == 232)
694 {
695 if (!encodingCharBuffer.AddChar('\u200c'))
696 {
697 break;
698 }
699 flag2 = false;
700 continue;
701 }
702 if (nextByte == 233)
703 {
704 if (!encodingCharBuffer.AddChar('\u200d'))
705 {
706 break;
707 }
708 flag2 = false;
709 continue;
710 }
711 flag2 = false;
712 }
713 else if (flag3)
714 {
715 if (nextByte == 184)
716 {
717 if (!encodingCharBuffer.AddChar('\u0952'))
718 {
719 break;
720 }
721 flag3 = false;
722 continue;
723 }
724 if (nextByte == 191)
725 {
726 if (!encodingCharBuffer.AddChar('॰'))
727 {
728 break;
729 }
730 flag3 = false;
731 continue;
732 }
733 if (!encodingCharBuffer.Fallback(240))
734 {
735 break;
736 }
737 flag3 = false;
738 }
739 else
740 {
741 if (nextByte == 233)
742 {
743 if (!encodingCharBuffer.AddChar(c))
744 {
745 break;
746 }
747 c = (c2 = '\0');
748 continue;
749 }
750 if (!encodingCharBuffer.AddChar(c2))
751 {
752 break;
753 }
754 c = (c2 = '\0');
755 }
756 }
757 if (nextByte < 160)
758 {
759 if (!encodingCharBuffer.AddChar((char)nextByte))
760 {
761 break;
762 }
763 continue;
764 }
765 if (nextByte == 239)
766 {
767 flag = (flag4 = true);
768 continue;
769 }
770 char c3 = s_IndicMapping[num2, 0, nextByte - 160];
771 char c4 = s_IndicMapping[num2, 1, nextByte - 160];
772 if (c4 == '\0' || nextByte == 233)
773 {
774 if (c3 == '\0')
775 {
776 if (!encodingCharBuffer.Fallback(nextByte))
777 {
778 break;
779 }
780 }
781 else if (!encodingCharBuffer.AddChar(c3))
782 {
783 break;
784 }
785 }
786 else if (nextByte == 232)
787 {
788 if (!encodingCharBuffer.AddChar(c3))
789 {
790 break;
791 }
792 flag2 = (flag4 = true);
793 }
794 else if ((c4 & 0xF000) == 0)
795 {
796 flag4 = true;
797 c = c4;
798 c2 = c3;
799 }
800 else
801 {
802 flag3 = (flag4 = true);
803 }
804 }
805 if (iSCIIDecoder == null || iSCIIDecoder.MustFlush)
806 {
807 if (flag)
808 {
809 if (encodingCharBuffer.Fallback(239))
810 {
811 flag = false;
812 }
813 else
814 {
815 encodingCharBuffer.GetNextByte();
816 }
817 }
818 else if (flag3)
819 {
820 if (encodingCharBuffer.Fallback(240))
821 {
822 flag3 = false;
823 }
824 else
825 {
826 encodingCharBuffer.GetNextByte();
827 }
828 }
829 else if (c2 != 0)
830 {
831 if (encodingCharBuffer.AddChar(c2))
832 {
833 c2 = (c = '\0');
834 }
835 else
836 {
837 encodingCharBuffer.GetNextByte();
838 }
839 }
840 }
841 if (iSCIIDecoder != null && chars != null)
842 {
843 if (!iSCIIDecoder.MustFlush || c2 != '\0' || flag || flag3)
844 {
851 }
852 else
853 {
856 iSCIIDecoder.bLastATR = false;
860 }
862 }
863 return encodingCharBuffer.Count;
864 }
static readonly char[,,] s_IndicMapping
static readonly int[] s_IndicMappingIndex

References System.Text.ISCIIEncoding._defaultCodePage, System.byteCount, System.bytes, System.charCount, System.chars, System.Runtime.Serialization.Dictionary, System.Text.ISCIIEncoding.s_IndicMapping, and System.Text.ISCIIEncoding.s_IndicMappingIndex.

Referenced by System.Text.ISCIIEncoding.GetCharCount().