Add Package-Guid Map.
[mirror_edk2.git] / Tools / Java / Source / MigrationTools / org / tianocore / migration / Database.java
index 68ddf40b3060a77380445cc722bddfa8854ce321..f14184ab61c4b498daad620f85ba60ac4822b395 100644 (file)
@@ -23,6 +23,7 @@ public final class Database {
         DatabasePath = path;\r
 \r
         try {\r
+            importPkgGuid("PkgGuid.csv");\r
             importDBLib("Library.csv");\r
             importDBGuid("Guid.csv", "Guid");\r
             importDBGuid("Ppi.csv", "Ppi");\r
@@ -41,9 +42,32 @@ public final class Database {
     private Map<String,Guid> hashguid = new HashMap<String,Guid>();\r
     private Map<String,Func> hashfunc = new HashMap<String,Func>();\r
     private Map<String,Macro> hashmacro = new HashMap<String,Macro>();\r
+    private Map<String,String> hashPkgGuid = new HashMap<String,String>();\r
     \r
     //-------------------------------------import------------------------------------------//\r
-    \r
+    private void importPkgGuid(String filename) throws Exception {\r
+       BufferedReader rd = new BufferedReader(new FileReader(DatabasePath + File.separator + filename));\r
+        String line;\r
+        String[] linecontext;\r
+        Func lf;\r
+        \r
+        if (rd.ready()) {\r
+            System.out.println("Found " + filename + ", Importing Package Guid Database.");\r
+            //\r
+            // Skip the title row.\r
+            // \r
+            line = rd.readLine();\r
+            while ((line = rd.readLine()) != null) {\r
+                if (line.length() != 0) {\r
+                    linecontext = line.split(",");\r
+                    hashPkgGuid.put(linecontext[0], linecontext[1]);\r
+                }\r
+            }\r
+        }\r
+    }\r
+    public Iterator<String> dumpAllPkgGuid() {\r
+        return hashPkgGuid.values().iterator();\r
+    }\r
     private void importDBLib(String filename) throws Exception {\r
         BufferedReader rd = new BufferedReader(new FileReader(DatabasePath + File.separator + filename));\r
         String line;\r