public int AddOceanModelEntryEntry(OceanModelEntry item) { int rValue = OceanModelData.Add(item); OceanModelData.Sort(); return(rValue); }
internal void getOceanModels(string path) { string[] dirs = Directory.GetDirectories(path + FilePath._OceanModels + Path.DirectorySeparatorChar); for (int i = 0; i < dirs.Length; i++) { OceanModelEntry tm = new OceanModelEntry(); tm.FilePath = Path.GetFileName(dirs[i]); string[] waves = Directory.GetFiles(dirs[i]); tm.DarwinSymbol = new string[waves.Length]; string[] parts = null; for (int j = 0; j < waves.Length; j++) { parts = Path.GetFileName(waves[j]).Split(new char[] { '.' }, StringSplitOptions.None); tm.DarwinSymbol[j] = parts[0]; } tm.Year = int.Parse(parts[parts.Length - 3]); if (parts.Length == 5) { tm.ModelName = parts[1]; } if (parts.Length == 6) { tm.ModelName = parts[1] + "." + parts[2]; } FileStream fs = new FileStream(waves[0], FileMode.Open); GZipStream decompressingStream = new GZipStream(fs, CompressionMode.Decompress); using (var sr = new StreamReader(decompressingStream)) { string tmp = null; for (int j = 0; j < 8; j++) { tmp = sr.ReadLine().Trim(); } tm.Description = tmp; } AddOceanModelEntryEntry(tm); } }