public bool Parse(FileNameSheetComponents components, string filename) { Match match = patternShtNumAndName.Match(filename); if (!match.Success) { return(false); } GroupCollection g = match.Groups; string test; components.separator = g[SEPARATOR_STR].Value; // phase-bldg test = g[PHASE_BLDG_STR].Value; if (!string.IsNullOrEmpty(test)) { components.phaseBldg = test; components.phaseBldgSep = g[PHASE_BLDG_SEP_STR].Value; components.sheetID = g[SHEET_ID_1_STR].Value; } else { components.sheetID = g[SHEET_ID_2_STR].Value; } // test = g[COMMENT_1_STR].Value; // if (string.IsNullOrEmpty(test)) // { // test = g[COMMENT_2_STR].Value; // if (!string.IsNullOrEmpty(test)) // { //// components.comment = test; // components.originalSheetTitle = g[SHEET_NAME_2_STR].Value; // } // else if (!string.IsNullOrEmpty(g[SHEET_NAME_3_STR].Value)) // { // components.originalSheetTitle = g[SHEET_NAME_3_STR].Value; // } // else if (!string.IsNullOrEmpty(g[SHEET_NAME_4_STR].Value)) // { // components.originalSheetTitle = g[SHEET_NAME_4_STR].Value; // } // } // else // { components.originalSheetTitle = ""; // components.comment = test; // } components.sheetTitle = components.originalSheetTitle; return(true); }
public bool ParseSheetId(FileNameSheetComponents components, string shtId) { if (shtId.IsVoid()) { return(false); } Match match = patternShtNum.Match(shtId); if (!match.Success) { return(false); } GroupCollection g = match.Groups; string test; test = g[DISCIPLINE].Value; if (!test.IsVoid()) { components.discipline = test; components.category = g[CATEGORY].Value; test = g[SEP1].Value; if (!test.IsVoid()) { components.seperator1 = test; components.subcategory = g[SUBCATEGORY].Value; test = g[SEP2].Value; if (!test.IsVoid()) { components.seperator2 = test; components.modifier = g[MODIFIER].Value; test = g[SEP3].Value; if (!test.IsVoid()) { components.seperator3 = test; components.submodifier = g[SUBMODIFIER].Value; } } } } else { // should never happen return(false); } return(true); }