Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 085453be

Přidáno uživatelem Eliška Mourycová před téměř 4 roky(ů)

Re #8691. Working on retrieving data in time span from a directory.

Zobrazit rozdíly:

Server/ServerApp/DataDownload/DataDownloader.cs
185 185
			return nameZip;
186 186
		}
187 187

  
188

  
189
		private void ExtractDateFromFileName(string fileName, ref int month, ref int year)
190
		{
191

  
192
		}
193

  
188 194
		/// <summary>
189 195
		/// Downloads a specific archive.
190 196
		/// </summary>
......
222 228
				foreach (ZipArchiveEntry entry in zipArchive.Entries)
223 229
				{
224 230
					// get the relative path to the file:
225
					string extractedFile = nameFolder + entry.Name;
231
					string newFileName = $"{month}-{year}.{format}";
232
					string extractedFile = nameFolder + newFileName; //+ entry.Name;
226 233

  
227 234
					// add full path to the list:
228 235
					extractedFiles.Add(Path.GetFullPath(extractedFile));
......
236 243
					else
237 244
					{
238 245
						// if overwrite is not desired, check if the file exists first:
239
						if(File.Exists(nameFolder + entry.Name))
246
						if(File.Exists(extractedFile/*nameFolder + entry.Name*/))
240 247
						{
241 248
							continue;
242 249
						}
......
335 342
			throw new NotImplementedException();
336 343
		}
337 344

  
345

  
346

  
338 347
		public List<string> GetData(string subDirectory, Date startDate, Date endDate)
339 348
		{
340 349
			string[] files = Directory.GetFiles(subDirectory);
341 350
			for(int i = 0; i < files.Length; i++)
342 351
			{
352
				string currFileName = Path.GetFileName(files[i]);
353
				Console.WriteLine("curr file: " + currFileName);
354
				string[] splits = currFileName.Split(new char[] { '-', '.' });
355

  
356
				int month = int.Parse(splits[0]);
357
				int year = int.Parse(splits[1]);
358

  
359

  
360
				Date d = new Date((uint)month, (uint)year);
361

  
343 362

  
344 363
			}
345 364

  

Také k dispozici: Unified diff