/// <summary> /// Build a BS1192 file type /// </summary> /// <param name="fileType">The file type to use. If nothing is supplied, AF is used.</param> public FileType(Standard.FileTypes fileType) { this.CurrentFileType = fileType; this.Required = true; this.NumberOfChars = 2; this.FixedNumberOfChars = true; }
public FileType(string s) { if (CheckFormatAndLength(s)) { throw new Exception("Cannot build FileType because supplied string is invalid"); } if (!Enum.TryParse(s, out Standard.FileTypes filetype)) { throw new Exception("Could not parse string into FileType."); } // we set the public value so it goes through the set accessor, doing an additional layer of verification this.CurrentFileType = filetype; this.Required = true; this.NumberOfChars = 2; this.FixedNumberOfChars = true; }