public static IEnumerable <LogResult> Rename(string fileName, Action <string> fileStarted) { var rootDir = new DirectoryInfo(fileName); foreach (var dir in rootDir.GetDirectories("*.gdb", SearchOption.TopDirectoryOnly)) { LogResult result; try { fileStarted(dir.Name); result = ListGdb(dir.FullName); } catch (Exception ex) { result = new LogResult(dir.FullName, ex.Message); } yield return(result); } }
private static LogResult ListGdb(string gdbFileName) { var geodatabase = Geodatabase.Open(gdbFileName); var tableName = geodatabase .GetChildDatasets("\\", "Feature Class") .OrderBy(l => l.Length) .First(); var table = geodatabase.OpenTable(tableName); var definition = XDocument.Parse(table.Definition); var logResult = new LogResult( gdbFileName, tableName, FieldType(definition, OldCoda1), FieldType(definition, NewCoda2), FieldType(definition, OldCoda3), FieldType(definition, NewCoda4) ); table.Close(); geodatabase.Close(); return(logResult); }
private static LogResult ListGdb(string gdbFileName) { var geodatabase = Geodatabase.Open(gdbFileName); var tableName = geodatabase .GetChildDatasets("\\", "Feature Class") .OrderBy(l => l.Length) .First(); var table = geodatabase.OpenTable(tableName); var definition = XDocument.Parse(table.Definition); var logResult = new LogResult( gdbFileName, tableName, FieldType(definition, OldCoda1), FieldType(definition, NewCoda2), FieldType(definition, OldCoda3), FieldType(definition, NewCoda4) ); table.Close(); geodatabase.Close(); return logResult; }
public static IEnumerable<LogResult> Rename(string fileName, Action<string> fileStarted) { var rootDir = new DirectoryInfo(fileName); foreach (var dir in rootDir.GetDirectories("*.gdb", SearchOption.TopDirectoryOnly)) { LogResult result; try { fileStarted(dir.Name); result = ListGdb(dir.FullName); } catch (Exception ex) { result = new LogResult(dir.FullName, ex.Message); } yield return result; } }