public int AddLocalTideModelEntry(LocalOceanModelEntry item) { int rValue = LocalOceanModelData.Add(item); LocalOceanModelData.Sort(); return(rValue); }
internal void getLocalModels(string path) { string[] dirs = Directory.GetDirectories(path + "LocalModels" + Path.DirectorySeparatorChar); for (int i = 0; i < dirs.Length; i++) { LocalOceanModelEntry tm = new LocalOceanModelEntry(); tm.FilePath = Path.GetFileName(dirs[i]); string[] waves = Directory.GetFiles(dirs[i], "*gz"); if (waves.Length > 0) { 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]; } for (int j = 0; j < localModelInformation.GetLength(0); j++) { string li = localModelInformation[j, 1]; string lm = Path.GetFileName(dirs[i]); if (li == lm) { tm.Number = int.Parse(localModelInformation[j, 0]); tm.Location = localModelInformation[j, 2]; } } 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; } AddLocalTideModelEntry(tm); } } }