Beispiel #1
0
		private bool LoadWeatherData(String weatherFileName)
			{
			DateTime actuallTime = DateTime.Now;
			FileInfo weatherFileInfo = new FileInfo(weatherFileName);
			if ((weatherFileInfo.Exists)
				&& (weatherFileInfo.LastWriteTime.AddMinutes(58) > actuallTime))
				return false;
			String rawDataName = "http://aps.mowis.at/kunden/wpmedia/getForecasts.php";
			XmlDocument weatherData = new XmlDocument();
			try
				{
				weatherData.Load(rawDataName);
				}
			catch (Exception Excp)
				{
				throw new Exception($"LoadWeatherData - " +
					$"Es trat beim Laden der Wetterdaten von \"{rawDataName}" +
					$"\" der folgende Fehler auf:\r\n{Excp}");
				return false;
				}
			if (weatherData.DocumentElement == null)
				return false;
			weatherFileInfo.CreateDirectory_IfNotExists();
			weatherFileInfo.Delete();
			weatherData.Save(weatherFileInfo.FullName);
			return true;
			}
Beispiel #2
0
		/// <summary>Stores the image in the specified type under the specified folder, with the <paramref name="filename" />.</summary>
		public static FileInfo SaveAsFileDialog(this BitmapSource image, string filename = null)
		{
			var dlg = new SaveFileDialog
			{
				FileName = filename ?? "Abbildung",
				DefaultExt = ".png",
				Filter = "PNG|*.png|JPG|*.jpg|GIF|*.gif|BMP|*.bmp|TIFF|*.tiff|WMP|*.wmp"
			};
			var result = dlg.ShowDialog();

			if (result == true)
			{
				var fileInfo = new FileInfo(dlg.FileName);
				fileInfo.CreateDirectory_IfNotExists();
				fileInfo.AppendIndexToFile_IfExists();

				var le = fileInfo.Extension.ToLower();
				if (le == ".png")
					image.SaveAs_PngFile(fileInfo);
				if (le == ".jpg")
					image.SaveAs_JpgFile(fileInfo);
				if (le == ".gif")
					image.SaveAs_GifFile(fileInfo);
				if (le == ".bmp")
					image.SaveAs_BmpFile(fileInfo);
				if (le == ".tiff")
					image.SaveAs_TiffFile(fileInfo);
				if (le == ".wmp")
					image.SaveAs_WmpFile(fileInfo);
				return fileInfo;
			}
			return null;
		}
		private void WriteFile(FileInfo file, CsDbCodeNamespace codeNameSpace, FileTemplate content)
		{
			GeneratedFiles.Add(file.FullName);
			if (file.Exists && IsFileUnchanged(file, content.GetHash()))
			{
				return;
			}
			file.CreateDirectory_IfNotExists();
			codeNameSpace.Content = content.GetString(1);

			using (var wr = new StreamWriter(file.FullName, false, Encoding.Unicode))
			{
				wr.Write(codeNameSpace.GetString());
			}
		}
Beispiel #4
0
		static FileInfo CreateCacheFileInfo(PlayerMaterialType MaterialTyp, String materialNameId, String nameId, String extension)
			{
			String guidDirectory = $"{WPMediaLocalCacheRootDirectory}\\{ PlayerCache}\\{MaterialTyp}\\Dynamic";
			String FullFileName = (String.IsNullOrEmpty(nameId))
				? $"{guidDirectory}\\{materialNameId}.{extension}"
				: $"{guidDirectory}\\{materialNameId}_{ConvertToCorrectFileNameElement(nameId)}.{extension}";
			FileInfo result = new FileInfo(FullFileName);
			result.CreateDirectory_IfNotExists();
			return result;
			}
Beispiel #5
0
		public static String GetSenderPlaylistLogFileName(String senderName)
			{
			FileInfo fileInfo = new FileInfo(Path.Combine(WPMediaLocalCacheRootDirectory, $"{PlayerCache}\\", $"{senderName}\\{senderName}.PlayListDebug"));
			fileInfo.CreateDirectory_IfNotExists();
			return fileInfo.FullName;
			}
Beispiel #6
0
		public static FileInfo CreatePlayListCacheFileInfo(Guid playListId, String nameId)
			{
			String guidString = $"{playListId}";
			String guidDirectory = $"{WPMediaLocalCacheRootDirectory}\\{PlayerCache}\\{PlayerMaterialType.Playlists}" +
							$"\\{guidString.Substring(0, 2)}";
			String FullFileName = (String.IsNullOrEmpty(nameId))
				? $"{guidDirectory}\\{guidString}.PlayList"
				: $"{guidDirectory}\\{guidString}_{ConvertToCorrectFileNameElement(nameId.Replace(" ", "_"))}.PlayList";
			FileInfo result = new FileInfo(FullFileName);
			result.CreateDirectory_IfNotExists();
			return result;
			}
Beispiel #7
0
		public void CheckOldToNewConverter(String protokollFileName = null)
			{
			Data.DbServer3.AltErlaaInfo.LoadAll_IfHasNotBeenLoaded();
			Data.DbServer3.AltErlaaInfo.Timings.LoadAllTimings();
			Data.DbServer3.WPMedia.LoadAll_IfHasNotBeenLoaded();
			Data.DbServer3.WPMedia.Timings.Load_TimingsAfter();
			Data.DbServer3.WPMediaAddOnData.LoadAll_IfHasNotBeenLoaded();
			Data.DbServer3.WPMediaAddOnData.Timings.LoadAllTimings();
			Data.DbServer3.MultiMedia.LoadAll_IfHasNotBeenLoaded();
			Data.DbServer3.MultiMedia.MMUnitTimings.LoadAllTimings();
			Data.DbServer3.MultiMedia.MMUnits.Load_All_ShortData();
			Dictionary<Guid, List<TabellenBasics>> allWPMediaAddOnData
				= Data.DbServer3.WPMediaAddOnData.GetAllWPMediaAddOnData();
			Dictionary<Guid, Dictionary<DateTime, int>> allWPMediaAddOnDataWithDuplicateModifyTimeStamps
				= Data.DbServer3.WPMediaAddOnData.GetAllWPMediaAddOnDataWithDuplicateModifyTimeStamps();
			StreamWriter protokollFile = null;
			StreamWriter dataFile = null;
			if (!String.IsNullOrEmpty(protokollFileName))
				{
				FileInfo fileInfo = new FileInfo(protokollFileName);
				fileInfo.CreateDirectory_IfNotExists();
				fileInfo.DeleteFile_IfExists();
				protokollFile = new StreamWriter(protokollFileName);
				FileInfo dataFileInfo = new FileInfo(protokollFileName.Replace(".log", ".data"));
				dataFileInfo.CreateDirectory_IfNotExists();
				dataFileInfo.DeleteFile_IfExists();
				dataFile = new StreamWriter(dataFileInfo.FullName);
				protokollFile.WriteLine($"StartZeit = {DateTime.Now}");
				dataFile.WriteLine($"StartZeit = {DateTime.Now}");
				}

			CheckProcessConnectorenToWPMediaAddOnAnBeitraege(allWPMediaAddOnData, protokollFile, dataFile);
			CheckWPMediaAddOnAnBeitraegetoProcessConnectoren(allWPMediaAddOnData, protokollFile, dataFile);

			/*
						CheckWPMediaAddOnDataTimings(allWPMediaAddOnData, protokollFile, dataFile);
						CheckWPMediaAddOnData(allWPMediaAddOnData, allWPMediaAddOnDataWithDuplicateModifyTimeStamps,
							protokollFile, dataFile);
						CheckWPMedia(protokollFile, dataFile);
						CheckMMUnits(protokollFile, dataFile);
			*/
			if (protokollFile != null)
				{
				protokollFile.WriteLine($"EndZeit = {DateTime.Now}");
				dataFile.WriteLine($"EndZeit = {DateTime.Now}");
				protokollFile.Close();
				dataFile.Close();
				}
			}