jSignature.Tools.Base30Converter.Base30ToNative C# (CSharp) Method

Base30ToNative() public method

Returns a .net-specific array of arrays structure representing a single signature stroke A compressed string like this one: "3E13Z5Y5_1O24Z66_1O1Z3_3E2Z4" representing this raw signature data: [{'x':[100,101,104,99,104],'y':[50,52,56,50,44]},{'x':[50,51,48],'y':[100,102,98]}] turns into this .Net-specific structure (of array or arrays of arrays) [[[100,50],[1,2],[3,4],[-5,-6],[5,-6]], [[50,100],[1,2],[-3,-4]]]
public Base30ToNative ( string data ) : int[][][]
data string string of data encoded in base30 format. Ex: "3E13Z5Y5_1O24Z66_1O1Z3_3E2Z4"
return int[][][]
        public int[][][] Base30ToNative(string data)
        {
            List<int[][]> ss = new List<int[][]>();

            string[] parts = data.Split('_');
            int len = parts.Length / 2;

            for (int i = 0; i < len; i++)
            {
                ss.Add(GetStroke(
                    parts[i * 2]
                    , parts[i * 2 + 1]
                ));
            }
            return ss.ToArray();
        }

Usage Example

        public void id002_DecompressSig()
        {
            // [[[100,50],[1,2],[3,4],[-5,-6],[5,-6]], [[50,100],[1,2],[-3,-4]]];
            // [{'x':[100,101,104,99,104],'y':[50,52,56,50,44]},{'x':[50,51,48],'y':[100,102,98]}]
            // "3E13Z5Y5_1O24Z66_1O1Z3_3E2Z4"

            int[][][] shouldbe = new int[][][] {
                new int[][] {
                    new int[] { 100, 50 }
                    , new int[] { 1, 2 }
                    , new int[] { 3, 4 }
                    , new int[] { -5, -6 }
                    , new int[] { 5, -6 }
                }
                , new int[][] {
                    new int[] { 50, 100 }
                    , new int[] { 1, 2 }
                    , new int[] { -3, -4 }
                }
            };

            var c = new jSignature.Tools.Base30Converter();

            Assert.AreEqual(
                shouldbe
                , c.Base30ToNative("3E13Z5Y5_1O24Z66_1O1Z3_3E2Z4")
                );
        }
All Usage Examples Of jSignature.Tools.Base30Converter::Base30ToNative