()
| 22 | } |
| 23 | |
| 24 | public void run() |
| 25 | { |
| 26 | try |
| 27 | { |
| 28 | Set mapSet = Main.resourceFiles.entrySet(); |
| 29 | int entryCount = mapSet.size(); |
| 30 | Main.itemTemplates = new ArrayList(entryCount); |
| 31 | int processedCount = 0; |
| 32 | int currentProgress = 0; |
| 33 | |
| 34 | for (Object mapEntryObj : mapSet) { |
| 35 | Map.Entry mapEntry = (Map.Entry)mapEntryObj; |
| 36 | String resourceName = null; |
| 37 | InputStream in = null; |
| 38 | Object entryObject = mapEntry.getValue(); |
| 39 | if ((entryObject instanceof File)) { |
| 40 | File file = (File)entryObject; |
| 41 | String name = file.getName().toLowerCase(); |
| 42 | int sep = name.lastIndexOf('.'); |
| 43 | if ((sep > 0) && (name.substring(sep).equals(".uti"))) { |
| 44 | resourceName = name.substring(0, sep); |
| 45 | in = new FileInputStream(file); |
| 46 | } |
| 47 | } else if ((entryObject instanceof KeyEntry)) { |
| 48 | KeyEntry keyEntry = (KeyEntry)entryObject; |
| 49 | String name = keyEntry.getFileName().toLowerCase(); |
| 50 | int sep = name.lastIndexOf('.'); |
| 51 | if ((sep > 0) && (name.substring(sep).equals(".uti"))) { |
| 52 | resourceName = keyEntry.getResourceName(); |
| 53 | in = keyEntry.getInputStream(); |
| 54 | } |
| 55 | |
| 56 | } |
| 57 | |
| 58 | if (in != null) { |
| 59 | Database database = new Database(); |
| 60 | database.load(in); |
| 61 | in.close(); |
| 62 | DBList fieldList = (DBList)database.getTopLevelStruct().getValue(); |
| 63 | String itemName = fieldList.getString("LocalizedName"); |
| 64 | String itemDescription = fieldList.getString("Description"); |
| 65 | if ((itemName.length() > 0) && (itemDescription.length() > 0)) { |
| 66 | DBElement resourceElement = new DBElement(11, 0, "TemplateResRef", resourceName); |
| 67 | fieldList.setElement("TemplateResRef", resourceElement); |
| 68 | ItemTemplate itemTemplate = new ItemTemplate(fieldList); |
| 69 | Main.itemTemplates.add(itemTemplate); |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | processedCount++; |
| 74 | int newProgress = processedCount * 100 / entryCount; |
| 75 | if (newProgress > currentProgress + 9) { |
| 76 | currentProgress = newProgress; |
| 77 | this.progressDialog.updateProgress(currentProgress); |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | this.success = true; |
nothing calls this directly
no test coverage detected