/// <summary> /// Loads A Specified File /// </summary> /// <param name="filepath">The File Path To Load</param> public void LoadCompanyFile(string filepath) { _saveFile = filepath; string content = new StreamReader(filepath).ReadToEnd(); string[] lines = content.Split('\n'); foreach (string line in lines) { Match match = Regex.Match(line, Properties.Settings.Default.CompanyLoadRegex); if (match.Success) { string name = match.Groups["name"].Value; string website = match.Groups["website"].Value; string rep = match.Groups["repid"].Value; string job = match.Groups["jobid"].Value; string board = match.Groups["boardid"].Value; string salery = match.Groups["salary"].Value; string position = match.Groups["position"].Value; Enum.PositionType p = Enums.ParsePositionType(Int32.Parse(position)); string status = match.Groups["status"].Value; Enum.ApplicationStatus s = Enums.ParseStatus(Int32.Parse(status)); string date = match.Groups["date"].Value; string[] dates = date.Split('-'); string location = match.Groups["location"].Value; string notes = match.Groups["notes"].Value; Company c = new Company(name, website, Int32.Parse(rep), Int32.Parse(job), Int32.Parse(board), s, new DateTime(Int32.Parse(dates[0]), Int32.Parse(dates[1]), Int32.Parse(dates[2])), location, p, notes); _cm.AddObject(c); } } }