public DynamicVariableParser(String path) { this.projectDir = path; vars = new List <DynamicVariable>(); // Read previous index file if it exists. try { if (File.Exists(projectDir + "HTTPPrint.idx")) { StreamReader fin = new StreamReader(projectDir + "HTTPPrint.idx"); String s = fin.ReadLine(); // Ignore old MPFS2.0 HTTPPrint.idx files if (!s.Contains("|")) { while (s != null) { DynamicVariable dv = new DynamicVariable(s); vars.Add(dv); s = fin.ReadLine(); } } fin.Close(); } } catch { // do nothing...just won't have old index information } }
/// <summary> /// Finds the index of a dynamic variable, or creates a new one /// </summary> /// <param name="name"></param> /// <returns>The index of the dynamic variable</returns> private int GetIndex(String name) { // Search for the dynamic variable DynamicVariable dv = new DynamicVariable(name); int i = vars.IndexOf(dv); // If not found, add a new one if (i == -1) { vars.Add(dv); i = vars.Count - 1; } // Mark as used and return the index vars[i].Count++; return(i); }
/// <summary> /// Finds the index of a dynamic variable, or creates a new one /// </summary> /// <param name="name"></param> /// <returns>The index of the dynamic variable</returns> private int GetIndex(String name) { // Search for the dynamic variable DynamicVariable dv = new DynamicVariable(name); int i = vars.IndexOf(dv); // If not found, add a new one if (i == -1) { vars.Add(dv); i = vars.Count - 1; } // Mark as used and return the index vars[i].Count++; return i; }
public DynamicVariableParser(String path) { this.projectDir = path; vars = new List<DynamicVariable>(); // Read previous index file if it exists. try { if (File.Exists(projectDir + "HTTPPrint.idx")) { StreamReader fin = new StreamReader(projectDir + "HTTPPrint.idx"); String s = fin.ReadLine(); // Ignore old MPFS2.0 HTTPPrint.idx files if (!s.Contains("|")) { while (s != null) { DynamicVariable dv = new DynamicVariable(s); vars.Add(dv); s = fin.ReadLine(); } } fin.Close(); } } catch { // do nothing...just won't have old index information } }