Пример #1
0
		private int CopyAllFilesInDirectoryToDirectory(String sourceDirectory, String targetDirectory)
			{
			try
				{
				DirectoryInfo targetDirectoryInfo = new DirectoryInfo(targetDirectory);
				targetDirectoryInfo.Create_If_NotExists();

				}
			catch (Exception Excp)
				{
				return -1;
				}
			DirectoryInfo sourceDirectoryInfo = new DirectoryInfo(sourceDirectory);
			int numberOfProcessedFiles = 0;
			foreach (FileInfo enumerateFile in sourceDirectoryInfo.EnumerateFiles())
				{
				try
					{
					String targetFile = Path.Combine(targetDirectory, Path.GetFileName(enumerateFile.FullName));
					if (File.Exists(targetFile))
						File.Delete(targetFile);
					enumerateFile.CopyTo(targetFile);
					numberOfProcessedFiles++;
					}
				catch (Exception Excp)
					{
					ProtokollList.Add($"{Excp}");
					return -1;
					}
				}
			return numberOfProcessedFiles;
			}
Пример #2
0
		public void CreatePPTPictureWorkingDirectories()
			{
			DirectoryInfo pptDir = new DirectoryInfo(RootDirectoryForPPTWorkingPictures);
			pptDir.Create_If_NotExists();
			foreach (Projekt projekt in Data.DbServer3.WordUp.Projekte.Find_PhasenCorrectProjekte("Planungen")
				.OrderBy(ord => ord.NumericProjektId))
				{
				DirectoryInfo pptSubDir = new DirectoryInfo(Path.Combine(pptDir.FullName, projekt.SubDirectoryForPPTWorkingPictures));
				pptSubDir.Create_If_NotExists();
				}
			}
Пример #3
0
		public void ImportPicturesFromPPTWorkingDirectories()
			{
			DirectoryInfo pptDir = new DirectoryInfo(RootDirectoryForPPTWorkingPictures);
			pptDir.Create_If_NotExists();
			String projektNumberPrefix = $"{Data.DbServer3.WordUp.ActuallWordUpYear.Substring(0, 2)}0";
			/*
			 * 			if (targetProjekt != WordUpProjekteModellInstance.SelectedProjekt)
							return;
						if (!ConnectedMaterialHandlerModell.IsValidPictureDropSource(e))
							return;
						ConnectedMaterialHandlerModell MaterialHandlerModell = new ConnectedMaterialHandlerModell();
						MaterialHandlerModell.ProjekteModellInstance = WordUpProjekteModellInstance;
						//MaterialHandlerModell.WordUpOrteHandlerModelInstance = WordUpOrteHandlerModelInstance;
						MaterialJPGForeignKeyConnectorenTyp TargetForeignTyp = Data.DbServer3.Blob.MaterialJPGForeignKeyConnectorenTypen
							.Find_MaterialJPGTypViaName((String)source.Tag);
						String[] FilesToImport = ConnectedMaterialHandlerModell.GetPictureFileDropSource(e);
						MaterialJPGTyp TargetMaterialTyp = Data.DbServer3.Blob.MaterialJPGTypen.Find(MaterialienTypen.OrtsBild);
						if (MaterialHandlerModell.ImportData(FilesToImport, targetProjekt.Ort, TargetMaterialTyp,
							FilesToImport.Length > 1, targetProjekt.Id, TargetForeignTyp) == null)
							{
							MessageBox.Show("Es trat ein Fehler auf");
							return;
							}

			 * */

			foreach (DirectoryInfo ortsTeilDirectory in pptDir.EnumerateDirectories())
				{
				foreach (DirectoryInfo subDirectory in ortsTeilDirectory.EnumerateDirectories())
					{
					String numericProjektId = projektNumberPrefix + subDirectory.Name.Substring(0, 3);
					Projekt projekt = Data.DbServer3.WordUp.Projekte.GetProjektViaNumericProjektID(numericProjektId);
					if (projekt == null)
						throw new Exception($"Kein Projekt für Id {numericProjektId}");
					foreach (FileInfo pictureFile in subDirectory.EnumerateFiles())
						{
						
						}
					}

				}
			}