Mercurial > repos > IBDev-IBBoard.WarFoundry.API
comparison API/Factories/Xml/WarFoundryXmlFactory.cs @ 443:86725e88052e
Re #380: WarFoundry chokes on zips written by Mac OS X
* Add "is dot-file" check to behave like Linux and Mac and ignore files with name ".something"
Also:
* Fix load failure message argument order
* Save some regex checks by making sure zip entry is a file first
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 04 Dec 2011 20:40:31 +0000 |
parents | 71fceea2725b |
children | cbeee87dc2d3 |
comparison
equal
deleted
inserted
replaced
442:5ac76de8ce62 | 443:86725e88052e |
---|---|
38 } | 38 } |
39 | 39 |
40 return factory; | 40 return factory; |
41 } | 41 } |
42 | 42 |
43 private WarFoundryXmlFactory() : base() | 43 protected WarFoundryXmlFactory() : base() |
44 { | 44 { |
45 gameSystemFactory = new WarFoundryXmlGameSystemFactory(this); | 45 gameSystemFactory = new WarFoundryXmlGameSystemFactory(this); |
46 raceFactory = new WarFoundryXmlRaceFactory(this); | 46 raceFactory = new WarFoundryXmlRaceFactory(this); |
47 armyFactory = new WarFoundryXmlArmyFactory(); | 47 armyFactory = new WarFoundryXmlArmyFactory(); |
48 } | 48 } |
87 Regex re = new Regex("^" + Regex.Escape(wildcardPattern).Replace(@"\*", ".*").Replace(@"\?", ".") + "$", RegexOptions.IgnoreCase | RegexOptions.Singleline); | 87 Regex re = new Regex("^" + Regex.Escape(wildcardPattern).Replace(@"\*", ".*").Replace(@"\?", ".") + "$", RegexOptions.IgnoreCase | RegexOptions.Singleline); |
88 ICollection<ZipEntry> entries = new List<ZipEntry>(); | 88 ICollection<ZipEntry> entries = new List<ZipEntry>(); |
89 | 89 |
90 foreach (ZipEntry entry in file) | 90 foreach (ZipEntry entry in file) |
91 { | 91 { |
92 if (re.IsMatch(entry.Name)) | 92 if (entry.IsFile && re.IsMatch(entry.Name)) |
93 { | 93 { |
94 entries.Add(entry); | 94 entries.Add(entry); |
95 } | 95 } |
96 } | 96 } |
97 | 97 |