コード例 #1
0
ファイル: CommonServices.cs プロジェクト: wyh0395/Berry
 public static string GetPropertyValue(string propertyName)
 {
     return(CommonServices.GetPropertyValue(propertyName, true));
 }
コード例 #2
0
ファイル: CommonServices.cs プロジェクト: wyh0395/Berry
        public static uint ConvertString(string objectId, int fromCCSID, int toCCSID, byte[] inString, int inLength, out byte[] outString, ref int outLength, int options, out uint bytesConverted)
        {
            uint num = 545284184u;

            if (outLength == 0)
            {
                outLength = inLength * 4;
            }
            outString      = new byte[outLength];
            bytesConverted = 0u;
            if (fromCCSID == 1200 && inLength >= 2)
            {
                if (inString[0] == 254 && inString[1] == 255)
                {
                    options &= -241;
                    if (toCCSID == fromCCSID && (options & 256) == 256)
                    {
                        options &= -3841;
                    }
                    else
                    {
                        options |= 16;
                    }
                }
                else if (inString[0] == 255 && inString[1] == 255)
                {
                    options &= -241;
                    if (toCCSID == fromCCSID && (options & 512) == 512)
                    {
                        options &= -3841;
                    }
                    else
                    {
                        options |= 32;
                    }
                }
            }
            if (fromCCSID == 1200 && fromCCSID == toCCSID)
            {
                unchecked
                {
                    outLength = (int)((long)Math.Min(inLength, outLength) & (long)((ulong)-2));
                }
                Buffer.BlockCopy(inString, 0, outString, 0, outLength);
                bytesConverted = (uint)outLength;
                if ((options & 528) == 528 || (options & 288) == 288)
                {
                    CommonServices.ByteSwapShort(ref outString, outLength);
                }
                num = 0u;
            }
            else
            {
                int options2 = options & -268439537;
                inLength = Math.Min(inLength, outLength * 4);
                if (fromCCSID == 1200 && (options & 16) == 16)
                {
                    CommonServices.ByteSwapShort(ref inString, inLength);
                }
                //if (CommonServices.cs != null || CommonServices.CreateCommonServices())
                //{
                //  num = CommonServices.cs.ConvertString(objectId, fromCCSID, toCCSID, inString, inLength, ref outString, ref outLength, options2, ref bytesConverted);
                //}


                if (fromCCSID == 1200 && (options & 268435456) != 268435456 && (options & 16) == 16)
                {
                    CommonServices.ByteSwapShort(ref inString, inLength);
                }
                if (num == 0u && toCCSID == 1200 && (options & 256) == 256)
                {
                    CommonServices.ByteSwapShort(ref outString, outLength);
                }

                num = new  ConvertStringHelper().ConvertString(objectId, fromCCSID, toCCSID, inString, inLength, ref outString, ref outLength, options2, ref bytesConverted);
            }
            return(num);
        }
コード例 #3
0
ファイル: CommonServices.cs プロジェクト: wyh0395/Berry
 public static uint ConvertString(int fromCCSID, int toCCSID, byte[] inString, int inLength, out byte[] outString, ref int outLength, int options, out uint bytesConverted)
 {
     return(CommonServices.ConvertString(string.Empty, fromCCSID, toCCSID, inString, inLength, out outString, ref outLength, options, out bytesConverted));
 }