Ejemplo n.º 1
0
        public static string ToNewMapnumber1W(string oldMapnumber1W)
        {
            if (!OldMapnumberCheck.Check1W(oldMapnumber1W))
            {
                return("");
            }
            var temp   = oldMapnumber1W.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);

            return(new100 + "G" + new1R.ToString().PadLeft(3, '0') + new1C.ToString().PadLeft(3, '0'));
        }
Ejemplo n.º 2
0
        public static string ToOldMapnumber1W(string oldMapnumber1W)
        {
            if (string.IsNullOrEmpty(oldMapnumber1W))
            {
                return("");
            }

            if (OldMapnumberCheck.Check1W(oldMapnumber1W))
            {
                return(oldMapnumber1W);
            }

            oldMapnumber1W = ChangeOldMapnumberChar(oldMapnumber1W);
            if (!oldMapnumber1W.Contains("-"))
            {
                return("");
            }
            var split  = oldMapnumber1W.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries);
            var length = split.Length;

            if (length != 4)
            {
                return("");
            }
            var x10 = split[0] + "-" + split[1] + "-" + split[2];
            var s10 = ToOldMapnumber10W(x10);

            if (string.IsNullOrEmpty(s10) || !int.TryParse(split[3], out int x1))
            {
                return("");
            }
            var s1 = x1.ToString("00");

            oldMapnumber1W = s10 + "-(" + s1 + ")";
            if (OldMapnumberCheck.Check1W(oldMapnumber1W))
            {
                return(oldMapnumber1W);
            }
            return("");
        }