public static string ToOldMapnumber5W(string oldMapnumber5W) { if (string.IsNullOrEmpty(oldMapnumber5W)) { return(""); } if (OldMapnumberCheck.Check5W(oldMapnumber5W)) { return(oldMapnumber5W); } oldMapnumber5W = ChangeOldMapnumberChar(oldMapnumber5W); if (!oldMapnumber5W.Contains("-")) { return(""); } var split = oldMapnumber5W.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries); int 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 x5)) { return(""); } var s5 = OldMapnumber.Change1234ToABCD(x5); oldMapnumber5W = s10 + "-" + s5; if (OldMapnumberCheck.Check5W(oldMapnumber5W)) { return(oldMapnumber5W); } return(""); }
public static string ToOldMapnumber(string mapnumber) { if (!NewMapnumberCheck.Check(mapnumber)) { return(""); } NewMapnumber.GetInfo(mapnumber, out bool success, out string m100WRow, out string m100WColumn, out string scale, out string row, out string column); if (!success) { return(""); } if (scale.Length != 1) { throw new Exception(); } var scaleChr = scale[0]; var scaleNumber = NewMapnumber.NewMapnumberGetScaleDenominatorNumberByScaleStr(scaleChr); switch (scaleNumber) { case 1000000: { return(ToOldMapnumber100W(m100WRow, m100WColumn)); } case 500000: { var o100W = ToOldMapnumber100W(m100WRow, m100WColumn); var o50W = ToOld50WNum(row, column); var o50WStr = OldMapnumber.Change1234ToABCD(o50W); if (string.IsNullOrEmpty(o50WStr)) { return(""); } return(o100W + "-" + o50WStr); } case 250000: { var o100W = ToOldMapnumber100W(m100WRow, m100WColumn); var o25W = ToOld25WNum(row, column); if (o25W <= 0 || o25W > 16) { return(""); } return(o100W + "-[" + o25W.ToString("00") + "]"); } case 100000: { var o100W = ToOldMapnumber100W(m100WRow, m100WColumn); var o10W = ToOld10WNum(row, column); if (o10W <= 0 || o10W > 144) { return(""); } return(o100W + "-" + o10W.ToString("000")); } case 50000: { var o100W = ToOldMapnumber100W(m100WRow, m100WColumn); var o5W = ToOld5WNum(row, column); var o5WStr = OldMapnumber.Change1234ToABCD(o5W); if (string.IsNullOrEmpty(o5WStr)) { return(""); } var n10WR = New5WRCToNew10WRC(int.Parse(row)); var n10WC = New5WRCToNew10WRC(int.Parse(column)); var o10W = ToOld10WNum(n10WR.ToString(), n10WC.ToString()); if (o10W <= 0 || o10W > 144) { return(""); } return(o100W + "-" + o10W.ToString("000") + "-" + o5WStr); } case 25000: { var o100W = ToOldMapnumber100W(m100WRow, m100WColumn); var o2_5W = ToOld2_5WNum(row, column); if (o2_5W <= 0 || o2_5W > 4) { return(""); } var n5WR = New2_5WRCToNew5WRC(int.Parse(row)); var n5WC = New2_5WRCToNew5WRC(int.Parse(column)); var o5W = ToOld5WNum(n5WR.ToString(), n5WC.ToString()); var o5WStr = OldMapnumber.Change1234ToABCD(o5W); if (string.IsNullOrEmpty(o5WStr)) { return(""); } var n10WR = New5WRCToNew10WRC(n5WR); var n10WC = New5WRCToNew10WRC(n5WC); var o10W = ToOld10WNum(n10WR.ToString(), n10WC.ToString()); if (o10W <= 0 || o10W > 144) { return(""); } return(o100W + "-" + o10W.ToString("000") + "-" + o5WStr + "-" + o2_5W.ToString()); } case 10000: { var o100W = ToOldMapnumber100W(m100WRow, m100WColumn); var o1W = ToOld1WNum(row, column); if (o1W <= 0 || o1W > 64) { return(""); } var n10WR = New1WRCToNew10WRC(int.Parse(row)); var n10WC = New1WRCToNew10WRC(int.Parse(column)); var o10W = ToOld10WNum(n10WR.ToString(), n10WC.ToString()); if (o10W <= 0 || o10W > 144) { return(""); } return(o100W + "-" + o10W.ToString("000") + "-(" + o1W.ToString("00") + ")"); } case 5000: { var o100W = ToOldMapnumber100W(m100WRow, m100WColumn); var o0_5W = ToOld5KNum(row, column); var o0_5WStr = OldMapnumber.Change1234Toabcd(o0_5W); if (string.IsNullOrEmpty(o0_5WStr)) { return(""); } var n1WR = New5KRCToNew1WRC(int.Parse(row)); var n1WC = New5KRCToNew1WRC(int.Parse(column)); var o1W = ToOld1WNum(n1WR.ToString(), n1WC.ToString()); if (o1W <= 0 || o1W > 64) { return(""); } var n10WR = New1WRCToNew10WRC(n1WR); var n10WC = New1WRCToNew10WRC(n1WC); var o10W = ToOld10WNum(n10WR.ToString(), n10WC.ToString()); if (o10W <= 0 || o10W > 144) { return(""); } return(o100W + "-" + o10W.ToString("000") + "-(" + o1W.ToString("00") + ")-" + o0_5WStr); } default: { return(null); } } }