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

◆ ToBase64CharArray() [2/2]

static unsafe int System.Convert.ToBase64CharArray ( byte[] inArray,
int offsetIn,
int length,
char[] outArray,
int offsetOut,
Base64FormattingOptions options )
inlinestatic

Definition at line 2746 of file Convert.cs.

2747 {
2748 if (inArray == null)
2749 {
2750 throw new ArgumentNullException("inArray");
2751 }
2752 if (outArray == null)
2753 {
2754 throw new ArgumentNullException("outArray");
2755 }
2756 if (length < 0)
2757 {
2758 throw new ArgumentOutOfRangeException("length", SR.ArgumentOutOfRange_Index);
2759 }
2760 if (offsetIn < 0)
2761 {
2762 throw new ArgumentOutOfRangeException("offsetIn", SR.ArgumentOutOfRange_GenericPositive);
2763 }
2764 if (offsetOut < 0)
2765 {
2766 throw new ArgumentOutOfRangeException("offsetOut", SR.ArgumentOutOfRange_GenericPositive);
2767 }
2768 if (options < Base64FormattingOptions.None || options > Base64FormattingOptions.InsertLineBreaks)
2769 {
2770 throw new ArgumentException(SR.Format(SR.Arg_EnumIllegalVal, (int)options), "options");
2771 }
2772 int num = inArray.Length;
2773 if (offsetIn > num - length)
2774 {
2775 throw new ArgumentOutOfRangeException("offsetIn", SR.ArgumentOutOfRange_OffsetLength);
2776 }
2777 if (num == 0)
2778 {
2779 return 0;
2780 }
2781 bool insertLineBreaks = options == Base64FormattingOptions.InsertLineBreaks;
2782 int num2 = outArray.Length;
2783 int num3 = ToBase64_CalculateAndValidateOutputLength(length, insertLineBreaks);
2784 if (offsetOut > num2 - num3)
2785 {
2786 throw new ArgumentOutOfRangeException("offsetOut", SR.ArgumentOutOfRange_OffsetOut);
2787 }
2788 int result;
2789 fixed (char* outChars = &outArray[offsetOut])
2790 {
2791 fixed (byte* inData = &inArray[0])
2792 {
2793 result = ConvertToBase64Array(outChars, inData, offsetIn, length, insertLineBreaks);
2794 }
2795 }
2796 return result;
2797 }
static int ToBase64_CalculateAndValidateOutputLength(int inputLength, bool insertLineBreaks)
Definition Convert.cs:2881
static unsafe int ConvertToBase64Array(char *outChars, byte *inData, int offset, int length, bool insertLineBreaks)
Definition Convert.cs:2827

References System.SR.Arg_EnumIllegalVal, System.SR.ArgumentOutOfRange_GenericPositive, System.SR.ArgumentOutOfRange_Index, System.SR.ArgumentOutOfRange_OffsetLength, System.SR.ArgumentOutOfRange_OffsetOut, System.Convert.ConvertToBase64Array(), System.SR.Format(), System.length, System.options, and System.Convert.ToBase64_CalculateAndValidateOutputLength().