private void ParseImportDeclarations() { for (int i = 0; i < File.Count; i++) { int lineIndexer = i; string line = File[i]; ImportDeclaration importDeclaration = null; try { if (line.Contains("Imports")) { importDeclaration = new ImportDeclaration(lineIndexer, line); } else { continue; } } catch (InvalidOperationException) { continue; } DeclaredNamespaces.Add(importDeclaration); } }
public ImportGenerator(string @namespace, IFileReader FileReader, IFileWriter fileWriter) { ImportDeclaration = new ImportDeclaration(@namespace); this.FileReader = FileReader; this.FileWriter = fileWriter; this.DeclaredNamespaces = new List <ImportDeclaration>(); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (!(obj is ImportDeclaration)) { return(false); } ImportDeclaration other = obj as ImportDeclaration; return(other == this); }
private void WriteToFile(ImportDeclaration importDeclaration) { File.Insert(ImportDeclaration.Line, ImportDeclaration.ToString()); FileWriter.WriteFile(File); }