/// <summary> /// Parses the diversion rights file and returns a Vector of StateMod_DiversionRight objects. </summary> /// <param name="filename"> the diversion rights file to parse. </param> /// <returns> a Vector of StateMod_DiversionRight objects. </returns> /// <exception cref="Exception"> if an error occurs </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static java.util.List<StateMod_DiversionRight> readStateModFile(String filename) throws Exception public static IList <StateMod_DiversionRight> readStateModFile(string filename) { string routine = "StateMod_DiversionRight.readStateModFile"; IList <StateMod_DiversionRight> theDivRights = new List <StateMod_DiversionRight> (); int[] format_0 = new int[] { StringUtil.TYPE_STRING, StringUtil.TYPE_STRING, StringUtil.TYPE_STRING, StringUtil.TYPE_STRING, StringUtil.TYPE_DOUBLE, StringUtil.TYPE_INTEGER }; int[] format_0w = new int[] { 12, 24, 12, 16, 8, 8 }; string iline = null; IList <object> v = new List <object>(6); StreamReader @in = null; StateMod_DiversionRight aRight = null; Message.printStatus(2, routine, "Reading diversion rights file: " + filename); try { @in = new StreamReader(IOUtil.getPathUsingWorkingDir(filename)); while (!string.ReferenceEquals((iline = @in.ReadLine()), null)) { // check for comments if (iline.StartsWith("#", StringComparison.Ordinal) || iline.Trim().Length == 0) { continue; } aRight = new StateMod_DiversionRight(); if (Message.isDebugOn) { Message.printDebug(50, routine, "iline: " + iline); } StringUtil.fixedRead(iline, format_0, format_0w, v); aRight.setID(((string)v[0]).Trim()); aRight.setName(((string)v[1]).Trim()); aRight.setCgoto(((string)v[2]).Trim()); aRight.setIrtem(((string)v[3]).Trim()); aRight.setDcrdiv((double?)v[4]); aRight.setSwitch((int?)v[5]); // Mark as clean because set methods may have marked dirty... aRight.setDirty(false); theDivRights.Add(aRight); } } catch (Exception e) { Message.printWarning(3, routine, e); throw e; } finally { if (@in != null) { @in.Close(); } } return(theDivRights); }