Ejemplo n.º 1
0
        public static string ToOldMapnumber5K(string oldMapnumber5K)
        {
            if (string.IsNullOrEmpty(oldMapnumber5K))
            {
                return("");
            }

            if (OldMapnumberCheck.Check5K(oldMapnumber5K))
            {
                return(oldMapnumber5K);
            }

            oldMapnumber5K = ChangeOldMapnumberChar(oldMapnumber5K);
            if (!oldMapnumber5K.Contains("-"))
            {
                return("");
            }

            var split  = oldMapnumber5K.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries);
            var length = split.Length;

            if (length != 5)
            {
                return("");
            }

            var x1 = split[0] + "-" + split[1] + "-" + split[2] + "-(" + split[3] + ")";
            var s1 = ToOldMapnumber1W(x1);

            if (string.IsNullOrEmpty(s1) || !int.TryParse(split[4], out int x0_5))
            {
                return("");
            }

            var s0_5 = OldMapnumber.Change1234Toabcd(x0_5);

            oldMapnumber5K = s1 + "-" + s0_5;
            if (OldMapnumberCheck.Check5K(oldMapnumber5K))
            {
                return(oldMapnumber5K);
            }

            return("");
        }
Ejemplo n.º 2
0
        public static string ToNewMapnumber5K(string oldMapnumber5K)
        {
            if (!OldMapnumberCheck.Check5K(oldMapnumber5K))
            {
                return("");
            }
            var temp   = oldMapnumber5K.Split('-');
            var new100 = temp[0] + temp[1].PadLeft(2, '0');
            var sub10W = temp[2];

            if (!int.TryParse(sub10W, out int x))
            {
                return("");
            }
            var new10R  = ToNew10WRow(x);
            var new10C  = ToNew10WColumn(x);
            var sub1W   = temp[3];
            var subTemp = sub1W.Split(new char[] { '(', ')' }, StringSplitOptions.RemoveEmptyEntries);

            if (!int.TryParse(subTemp[0], out int k))
            {
                return("");
            }
            var new1R   = ToNew1WRow(k, new10R);
            var new1C   = ToNew1WColumn(k, new10C);
            var sub0_5W = temp[4];
            var chrStr  = temp[4];

            if (chrStr.Length != 1)
            {
                return("");
            }
            var l       = OldMapnumber.ChangeABCDabcdTo1234(chrStr[0]);
            var new0_5R = ToNew5KRow(l, new1R);
            var new0_5C = ToNew5KColumn(l, new1C);

            return(new100 + "H" + new0_5R.ToString().PadLeft(3, '0') + new0_5C.ToString().PadLeft(3, '0'));
        }