public static bool CreateOrModifyAsStandBildLayout (String FileNameToImport) { CVM.GraphicsHandling GraphicsHandler = new GraphicsHandling(Basics.GetLocalWPMediaRoot ()); Object Pkg = GraphicsHandler.GetInstatiatedPackage (FileNameToImport); String TableName = GraphicsHandler.ActuallTableName; System.Guid ID = System.Guid.Parse (GraphicsHandler.ActuallReadableContentRow ["ID"].ToString ()); String NameID = GraphicsHandler.ActuallReadableContentRow ["NameID"].ToString (); GraphicsHandler.Close (); return CreateOrModifyAsStandBildLayout (TableName, ID, NameID); }
private void FillGraphicsHandlerElements (TreeView Elemente) { TreeViewItem RootItem = new TreeViewItem (); Elemente.Items.Add (RootItem); GraphicsHandler = new GraphicsHandling(WMB.Basics.GetLocalWPMediaRoot ()); GraphicsHandler.GetInstatiatedPackage (PackageFileName, false); RootItem.Header = GraphicsHandler.ActuallTableName + "/" + GraphicsHandler.ActuallReadableContentRow ["NameID"].ToString (); CVM.DataSetViewer DataSetViewerInstance = new CVM.DataSetViewer (); Elemente.Items.Add (DataSetViewerInstance.CreateDataSetStartTreeViewItem (GraphicsHandler.FrameDataDataSetReader, "FrameData in PKG")); /* TreeViewItem SenderNameItem = new TreeViewItem (); Elemente.Items.Add (SenderNameItem); SenderNameItem.Header = ProgrammManagement.ProgrammData.SenderName; Elemente.Items.Add (DataSetViewerInstance.CreateDataSetStartTreeViewItem (ProgrammManagement.ProgrammData.SchedulingDataSet, "SchedulingDataSet")); Elemente.Items.Add (DataSetViewerInstance.CreateDataSetStartTreeViewItem (ProgrammManagement.ProgrammData.FutureSchedulingDataSet, "FutureSchedulingDataSet")); Elemente.Items.Add (DataSetViewerInstance.CreateDataTableStartTreeViewItem (ProgrammManagement.ProgrammData.OrderedTableOfProgrammBlocks, "OrderedTableOfProgrammBlocks")); TreeViewItem FullBeitragsListItem = new TreeViewItem (); FullBeitragsListItem.Header = "FullBeitragsList"; Elemente.Items.Add (FullBeitragsListItem); foreach (String BeitragID in ProgrammManagement.ProgrammData.FullBeitragList.Keys) { DataSet FullBeitragDataSet = ProgrammManagement.ProgrammData.FullBeitragList [BeitragID]; String BeitragName = BeitragID; if ((FullBeitragDataSet.Tables ["Beitraege"] != null) && (FullBeitragDataSet.Tables ["Beitraege"].Rows.Count == 1)) BeitragName = FullBeitragDataSet.Tables ["Beitraege"].Rows [0] ["Name"].ToString (); FullBeitragsListItem.Items.Add (DataSetViewerInstance.CreateDataSetStartTreeViewItem (FullBeitragDataSet, BeitragName)); } */ }
void BulkImport_Click (object sender, RoutedEventArgs e) { MenuItem ActivatedEntry = sender as MenuItem; if (ActivatedEntry == null) return; String TableNameToProcess = ActivatedEntry.Tag as String; OpenFileDialog OFD = new OpenFileDialog (); OFD.Filter = "Alle Bilder|*.jpg;*.png;*.tiff;*.bmp"; OFD.Title = "Bitte selektieren Sie Bilder für \"" + TableNameToProcess + "\""; OFD.Multiselect = true; if (OFD.ShowDialog () != true) { return; } if (OFD.FileNames.Length == 0) return; CVM.IFullTimingsInterface FullManagedTimingsInterface = new ManagedTimingsWindow () as CVM.IFullTimingsInterface ; DataSet TimingsTemplateDataSet = m_DataBase.GetCommonMultiDataSet (new string [] { "Select * from Timings where ConnectedID = '" + System.Guid.NewGuid ().ToString () + "'", "Select * from TimingTypen order by ProcessingOrder" }); FullManagedTimingsInterface.TimingsTemplateDataSet = TimingsTemplateDataSet; FullManagedTimingsInterface.WindowsHeadLine = "Bitte geben sie die zu generierenden Timings ein"; FullManagedTimingsInterface.FillStoreableTimingsDataSetViaUI (TableNameToProcess); Cursor = Cursors.Wait; Window ProgressWindow = new Window (); ProgressWindow.Height = 50; ProgressWindow.Width = 700; ProgressBar ProgressControl = new ProgressBar (); ProgressWindow.Content = ProgressControl; ProgressControl.Minimum = 0; ProgressControl.Maximum = OFD.FileNames.Length; ProgressWindow.Title = "Upload wird vorbereitet"; ProgressWindow.Show (); ManagedFileHandling.FileHandlingModell FileHandlingModellInstance = new FileHandlingModell (); //CommonDataBase.CommonBasics CopyInstance = new CommonBasics (); //CopyInstance.SendFileBlockEventCall += new SendFileBlockEvent (CopyInstance_SendFileBlockEventCall); //CopyInstance.CopyToServerListFinishedCall +=new CopyToServerListFinished(CopyInstance_CopyToServerListFinishedCall); String InsertSqlStatement = m_DataBase.GetTableDefinitionEntry (TableNameToProcess, WCFStandardsNS.WCFStandardClientSchema.SQL_TABLE_PROPERTY_SQL_INSERT); if (String.IsNullOrEmpty (InsertSqlStatement)) InsertSqlStatement = "Insert into " + TableNameToProcess + " (ID, NameID, Titel) values ('{0}', '{1}', '{2}')"; int LoopCounter = 0; foreach (String PictureFileName in OFD.FileNames) { String NewID = System.Guid.NewGuid ().ToString (); String NewEntryName = Path.GetFileName (Path.GetDirectoryName (PictureFileName)) + ":" + Path.GetFileNameWithoutExtension (PictureFileName); if (ProgressWindow.IsLoaded == false) break; ProgressControl.Value = LoopCounter++; ProgressWindow.Title = "Upload von " + PictureFileName; WMB.Basics.DoEvents (); String FinalInsertSqlStatement = String.Format (InsertSqlStatement, NewID, NewEntryName, ""); m_DataBase.RunSQLBatch (FinalInsertSqlStatement); DataSet StoredEntry = m_DataBase.GetCommonDataSet ("Select * from " + TableNameToProcess + " where ID = '" + NewID + "'"); StoredEntry.Tables [0].Rows [0] ["ModifyTimeStamp"] = DateTime.Now; StoredEntry.Tables [0].Rows [0] ["ProcessingStatus"] = CVM.CommonValues.TABLE_PROCESSING_STATUS_INTERNET_PUBLISHING_PENDING + ";" + CVM.CommonValues.TABLE_PROCESSING_STATUS_TV_PUBLISHING_PENDING; m_DataBase.SetCommonDataSet (StoredEntry); DataSet StoreableTimingsDataSet = FullManagedTimingsInterface.GetStoreableTimingsDataSet (NewID); m_DataBase.SetCommonDataSet (StoreableTimingsDataSet); CVM.GraphicsHandling GraphicHandler = new GraphicsHandling (CommonDataBase.DataBase.GetLocalWPMediaRoot ()); GraphicHandler.RemoteWPMediaRoot = CommonDataBase.DataBase.GetRemoteWPMediaRoot (); Object Pkg = GraphicHandler.GetInstatiatedPackage (m_DataBase, TableNameToProcess, NewID); String Extension = Path.GetExtension (PictureFileName); GraphicHandler.AddFileFromElementname ("BackGround" + Extension, PictureFileName); String LocalFileName = GraphicHandler.Close (); String RemoteFileName = CommonDataBase.DataBase.GetRemoteArchivFileNameFromLocalFileName (LocalFileName); FileInfo FInfo = new FileInfo (LocalFileName); FileHandlingModellInstance.DoCentralFileUpdateCall(TableNameToProcess, LocalFileName, RemoteFileName); //CopyInfoBlock CopyBlock = new CopyInfoBlock (LocalFileName, RemoteFileName, FInfo.LastWriteTime); //CopyInstance.CopyToServer (new List<CopyInfoBlock> {CopyBlock}, true); } ProgressWindow.Close (); Cursor = Cursors.Arrow; }
public List<BitmapSource> GetPicturesFromPackage (String originalPackageFileName, Size TargetSize, bool FullAndThumbMixed = false) { String packageFileName = GetCorrectPackageFileName(originalPackageFileName); if (String.IsNullOrEmpty(packageFileName)) { return new List<BitmapSource>() ; } GraphicsHandling GraphicsHandler = new GraphicsHandling(); GraphicsHandler.GetInstatiatedPackage(packageFileName, false); GraphicsHandler.CreateAndStoreFinalPictures(); List<BitmapSource> Result = GraphicsHandler.GetResizedPictures(GraphicsHandler.FinalPictures, TargetSize, FullAndThumbMixed); GraphicsHandler.Close(); return Result; }
public BitmapSource GetPictureFromPackage (String PackageFileName, int PageIndex, int TargetHeight = -1) { PackageFileName = GetCorrectPackageFileName (PackageFileName); if (String.IsNullOrEmpty (PackageFileName)) return null; GraphicsHandling GraphicsHandler = new GraphicsHandling (); GraphicsHandler.GetInstatiatedPackage (PackageFileName, false); BitmapSource Result = GraphicsHandler.GetCreatedFrameBitmapSource (PageIndex); GraphicsHandler.Close(); if (TargetHeight == -1) return Result; return Basics.ResizeBitmapSourceToNewHeight(Result, TargetHeight); }
public static GraphicsHandling GetHandlerForServerData (String TableName, String TableID, ref bool DoNotClose) { if ((GraphicsSingleton.Instance.GraphicsHandler != null) && (GraphicsSingleton.Instance.GraphicsHandler.ActuallTableName == TableName) && (GraphicsSingleton.Instance.GraphicsHandler.ActuallReadableContentRow ["ID"].ToString () == TableID)) { DoNotClose = true; if (GraphicsSingleton.Instance.GraphicsHandler.ActuallReadableContentRow.Table.Columns ["NumberOfPages"] != null) GraphicsSingleton.Instance.GraphicsHandler.ActuallReadableContentRow["NumberOfPages"] = GraphicsSingleton.Instance.GraphicsHandler.CalculatePagesToPlayAndTheirDurations(); return GraphicsSingleton.Instance.GraphicsHandler; } String TableSourceDirectory = Path.Combine (Path.Combine( WPMediaRootServer, Basics.XML_AUTO_CONTENT_OLD_SOURCE), TableName); String PackageFileName = GetCorrectPackageFileName (Path.Combine( TableSourceDirectory, TableID + ".pkg")); if (String.IsNullOrEmpty(PackageFileName)) return null; GraphicsHandling GraphicsHandler = new GraphicsHandling (); GraphicsHandler.GetInstatiatedPackage (PackageFileName, false); DoNotClose = false; return GraphicsHandler; }
void CreatePkgIfNotExist (String TableName, DataRow RowToProcess) { String ID = RowToProcess ["ID"].ToString (); GraphicsHandling GraphicHandler = new GraphicsHandling (WPMediaRoot); GraphicHandler.DoCentralStreamDownloadCall += new DoCentralStreamDownloadEvent (GraphicHandler_DoCentralStreamDownloadCall); GraphicHandler.RemoteWPMediaRoot = CommonDataBase.DataBase.GetRemoteWPMediaRoot (); String ActuallPackageName = GraphicHandler.GetPackageName (TableName, ID); String ArchivedPackageName = ActuallPackageName.Replace ("\\" + CVM.CommonValues.XML_AUTO_CONTENT_SOURCE + "\\", "\\" + CVM.CommonValues.XML_AUTO_CONTENT_OLD_SOURCE + "\\"); if (File.Exists (ActuallPackageName)) return; if (File.Exists (ArchivedPackageName)) return; Object ResultedPackage = GraphicHandler.GetInstatiatedPackage (m_DataBase, TableName, ID); if (ResultedPackage == null) { WMB.Basics.ReportErrorToEventViewer ("CreateStandbildTVUnits.CreatePkgIfNotExist", "Bei der Tabelle \"" + TableName + "\" mit der ID \"" + ID + "\" (" + RowToProcess ["NameID"].ToString () + ") kam null beim ResultedPackage zurück"); return; } GraphicHandler.Close (); }
private void TestDefaultFilling () { GraphicsHandling GraphicsHandler = new GraphicsHandling (CommonDataBase.DataBase.GetLocalWPMediaRoot ()); GraphicsHandler.RemoteWPMediaRoot = CommonDataBase.DataBase.GetRemoteWPMediaRoot (); Object Pkg = GraphicsHandler.GetInstatiatedPackage ( "D:\\Temp\\Paketieren\\Source\\KaufParkMieter\\697db05f-9269-4b8f-8ad0-331b24626e72.pkg"); GraphicsHandler.InsertDefaultPackageMaterials (DataAccess, Pkg); }
private String CreateLocalPackage (String TableName, String TableID, out int NumberOfPlayablePages) { GraphicsHandling PackageHandler = new GraphicsHandling (Basics.GetLocalWPMediaRoot ()); PackageHandler.RemoteWPMediaRoot = Basics.GetRemoteWPMediaRoot (); PackageHandler.DoSQLBatchCall += new DoSQLBatchEvent (LayoutHandler_DoSQLBatchCall); WCFStandards DataBase = new WCFStandards (); DataBase.DefaultConnectionStringName = "WPMediaAddOnDataConnectionString"; PackageHandler.GetInstatiatedPackage (DataBase, TableName, TableID); NumberOfPlayablePages = PackageHandler.PageDurations.Count; return PackageHandler.Close (); }
private bool CheckAndDoPictureImportIfRequired (DataRow CreatedTableRow, List<String> MaterialElementeForThisInformation) { GraphicsHandling LayoutHandler = new GraphicsHandling (Basics.GetLocalWPMediaRoot ()); LayoutHandler.RemoteWPMediaRoot = Basics.GetRemoteWPMediaRoot (); LayoutHandler.DoSQLBatchCall += new DoSQLBatchEvent (LayoutHandler_DoSQLBatchCall); WCFStandards DataBase = new WCFStandards (); DataBase.DefaultConnectionStringName = "WPMediaAddOnDataConnectionString"; String TableName = CreatedTableRow.Table.TableName; String ID = CreatedTableRow ["ID"].ToString (); LayoutHandler.GetInstatiatedPackage (DataBase, TableName, ID); foreach (String MaterialEntry in MaterialElementeForThisInformation) { if (MaterialEntry.IndexOf ("StandBildPicture") == 0) { String MaterialLink = MaterialEntry.Replace ("StandBildPicture", "").Trim ('(').Trim (')'); Byte [] PictureContent = GetMaterialElementContent (MaterialLink); if ((PictureContent == null) || (PictureContent.Length == 0)) continue; String[] Controller = MaterialLink.Split (','); String PackageElementName = Controller [(int) WMB.DataWrapper.MaterialElementIndex.UsedSubEntryID]; LayoutHandler.AddFileFromStream (new MemoryStream (PictureContent), PackageElementName); } if (MaterialEntry.IndexOf ("_Bild1") != -1) { String MaterialLink = MaterialEntry.Replace ("BackGround", "").Trim ('(').Trim (')'); Byte [] PictureContent = GetMaterialElementContent (MaterialLink); if ((PictureContent == null) || (PictureContent.Length == 0)) continue; String [] Controller = MaterialLink.Split (','); String PackageElementName = Controller [(int) WMB.DataWrapper.MaterialElementIndex.UsedSubEntryID]; LayoutHandler.AddFileFromStream (new MemoryStream (PictureContent), PackageElementName + "." + Controller [(int)WMB.DataWrapper.MaterialElementIndex.UsedType]); } } LayoutHandler.CheckPackageConsistence (); String CreatedPackageFileName = LayoutHandler.Close (); return true; }
/* public void CreateGalleriePlayingData (String PictureElementsFileRootDirectory, String TableName, DataRow TableTableRow) { CVM.CommonValues m_CVM = new CVM.CommonValues (); XAMLHandling m_XAMLHandling = new XAMLHandling (m_CVM); LocalWPMediaRoot = CommonDataBase.DataBase.GetLocalWPMediaRoot (); String TableDirectory = Path.Combine (PictureElementsFileRootDirectory, TableName); List<FileInfo> ExistingFiles = WMB.Basics.GetFileInfoEntriesFromDirectory (TableDirectory, new string [] { ControlFileExtension }, 1); return; } */ public void CreateStandbildPlayingData (String WPMediaServerRootDirectory, String PackageFilesRootDirectory, String TableName, DataRow tableDefinitionRow) { if (WMB.Basics.IsTestRun) { int NumberOfFiles = WMB.Basics.GetFilesFromDirectory (Path.Combine(PackageFilesRootDirectory, TableName), new string[] { "*.pkg" }, 1).Count; WMB.Basics.ReportInformationToEventViewer("WPMediaCentralServices.CreateStandbildPlayingData", "PackageFilesRootDirectory =\r\n\"" + PackageFilesRootDirectory + "\" Tabelle =\r\n\"" + TableName + "\" " + Convert.ToString(NumberOfFiles) + " Files"); } DateTime DateTimeToHandle = DateTime.Now; CVM.CommonValues m_CVM = new CVM.CommonValues(); XAMLHandling m_XAMLHandling = new XAMLHandling (m_CVM); LocalWPMediaRoot = CommonDataBase.DataBase.GetLocalWPMediaRoot (); String TableDirectory = Path.Combine (PackageFilesRootDirectory, TableName); List<FileInfo> ExistingFiles = WMB.Basics.GetFileInfoEntriesFromDirectory (TableDirectory, new string [] { ControlFileExtension }, 1); if (ExistingFiles == null) return; WPMediaStandbildPlayingData Description = new WPMediaStandbildPlayingData(); //ToDo Checking for IsActive on this day - new Implementation List<MMUnitUsageData> PossibleDataFromDataBase = Data.DbServer3.WPMediaAddOnData.GetWPMediaAddOnDataStandBildUsagePerTabelle (TableName, Data.DbServer3.WPMediaAddOnData.Timings .GetPossiblyInvolvedConnectedIds(DateTimeToHandle)[TableName]); Dictionary<DateTime, List<MMUnitUsageData>> AvtiveThisDayParameter = new Dictionary<DateTime, List<MMUnitUsageData>>() { { DateTimeToHandle, GetDayMMUnitUsageData (PossibleDataFromDataBase, DateTimeToHandle) } }; //TODO //MMUnitUsageTreeEntry Root = MMUnitUsageTreeEntry.GetUsageTree (null, null, null, null); //int WeekDay = (int) DateTime.Now.DayOfWeek; //List<MMUnitUsageData> DownloadEntriesStandBildUsageData = Root.Childs[MMUnitUsageTreeEntry.ALL_ACTIVE_ENTRIES].ContentList; // MMUnitUsageTreeEntry RootsChilds = Root.Childs [MMUnitUsageTreeEntry.ALL_ACTIVE_ENTRIES]; //List<MMUnitUsageData> AllDayUsageData = RootsChilds.Childs[MMUnitUsageTreeEntry.ALL_DAY_ENTRIES].ContentList; //List<MMUnitUsageData> ThisWeekDayUsageData = RootsChilds.Childs[WMB.Basics.ShortWeekDayNames[WeekDay]].ContentList; //Description.NamesOfLocalToDownloadDescriptions = new List<string> (); //foreach (MMUnitUsageData UsageData in DownloadEntriesStandBildUsageData) // { // Description.NamesOfLocalToDownloadDescriptions.Add(UsageData.PackageFileNamePart); // } //foreach (MMUnitUsageData UsageData in AllDayUsageData) // { // Description.NamesOfTodayActiveDescriptions.Add(UsageData.PackageFileNamePart); // } //foreach (MMUnitUsageData UsageData in ThisWeekDayUsageData) // { // Description.NamesOfTodayActiveDescriptions.Add(UsageData.PackageFileNamePart); // } Description.NamesOfTodayActiveDescriptions = new List<string>(); foreach (MMUnitUsageData UsageData in AvtiveThisDayParameter[DateTimeToHandle]) { Description.NamesOfTodayActiveDescriptions.Add(UsageData.PackageFileNamePart); } foreach (String PackageFileName in Description.NamesOfTodayActiveDescriptions) { bool Found = false; foreach (FileInfo FInfo in ExistingFiles) { if (FInfo.Name.ToLower () == Path.GetFileName (PackageFileName).ToLower ()) Found = true; } if (!Found) { WMB.Basics.ReportErrorToEventViewer("WPMediaCentralService.CreateStandbildPlayingData", "Der PackageFile \"" + PackageFileName + "\" fehlt"); } } int SkipLength = PackageFilesRootDirectory.Length + 1 - "Source\\".Length; if (WMB.Basics.IsTestRun) WMB.Basics.ReportInformationToEventViewer ("WPMediaCentralServices.CreateStandbildPlayingData", "NamesOfLocalToDownloadDescriptions = " + Convert.ToString (Description.NamesOfLocalToDownloadDescriptions.Count) + "\r\nNamesOfTodayActiveDescriptions = " + Convert.ToString (Description.NamesOfTodayActiveDescriptions.Count)); String EntryTimingType = tableDefinitionRow[CVM.CommonValues.WPMEDIA_ENTRY_TIMING_TYPE].ToString(); String PlayingOrder = tableDefinitionRow [CVM.CommonValues.WPMEDIA_ENTRY_PLAYING_ORDER].ToString (); double EntryDuration = 8; if (tableDefinitionRow [CVM.CommonValues.WPMEDIA_ENTRY_ENTRY_DURATION] != null) { if (!String.IsNullOrEmpty (tableDefinitionRow [CVM.CommonValues.WPMEDIA_ENTRY_ENTRY_DURATION].ToString ())) EntryDuration = Convert.ToDouble (tableDefinitionRow [CVM.CommonValues.WPMEDIA_ENTRY_ENTRY_DURATION]); } double OutsideSetDuration = -1; if (tableDefinitionRow [CVM.CommonValues.WPMEDIA_OUTSIDE_SET_DURATION] != null) { if (!String.IsNullOrEmpty (tableDefinitionRow [CVM.CommonValues.WPMEDIA_OUTSIDE_SET_DURATION].ToString ())) OutsideSetDuration = Convert.ToDouble (tableDefinitionRow [CVM.CommonValues.WPMEDIA_OUTSIDE_SET_DURATION]); } String MeaningOfOutsideSetDuration = tableDefinitionRow [CVM.CommonValues.WPMEDIA_MEANING_OF_OUTSIDE_SET_DURATION].ToString (); Description.TableName = TableName; Description.TableDefinitionTable = tableDefinitionRow.Table.Clone (); DataRow TableDefinitionRow = Description.TableDefinitionTable.NewRow (); TableDefinitionRow.ItemArray = tableDefinitionRow.ItemArray; Description.TableDefinitionTable.Rows.Add (TableDefinitionRow); Description.NameOfProcessingModule = tableDefinitionRow ["Type"].ToString (); Description.NamesOfActiveDescriptions = new List<string> (); Description.SortFields = new List<string> (); Description.LastWriteTimesOfNamesOfActiveDescriptions = new List<DateTime> (); Description.PlayLengthOfEachDescription = new List<TimeSpan> (); Description.NumberOfPagesOfEachDescription = new List<int> (); Description.NameOfPlayingDataDescription = TableName; Description.OverallPlayLength = 0; int OverallNumberOfPictures = 0; String TableType = tableDefinitionRow [CVM.CommonValues.WPMEDIA_ENTRY_TYPE_OF_TABLE].ToString (); ManagedTimingsControl TimingsCheckerClass = new ManagedTimingsControl (); CVM.ITimingsInterface TimingsCheckerInterface = TimingsCheckerClass as ITimingsInterface; TimingsCheckerInterface.m_TimingsTypenDataSet = m_DataBase.GetCommonDataSet ("Select * from TimingTypen"); foreach (String PackageFileName in Description.NamesOfTodayActiveDescriptions) { FileInfo Entry = new FileInfo(Path.Combine(PackageFilesRootDirectory, PackageFileName)); String ID = Path.GetFileNameWithoutExtension (Entry.FullName); DataTable UsedTimings; if (TimingsCheckerInterface.IsActive (ID, out UsedTimings) == false) continue; int NumberOfPages = 0; String SortField = PlayingOrder; TimeSpan PlayLengthForThisEntry = TimeSpan.Zero; List <double> PageDurations = new List<double> (); GraphicsHandling GraphicsHandler = new GraphicsHandling (LocalWPMediaRoot); if (GraphicsHandler.GetInstatiatedPackage (Entry.FullName) == null) { WMB.Basics.ReportErrorToEventViewer("WPMediaCentralServices.CreateStandbildPlayingData", "Der File\r\n\"" + Entry.FullName + "\"\r\nkonnte nicht als gültiges Package aufgelöst werden.\r\n" + "In der Folge werden damit Fehler auftreten"); continue; } List<TimeSpan> DurationForEachPage = new List<TimeSpan> (); foreach (double PageDuration in GraphicsHandler.PageDurations) { PlayLengthForThisEntry += TimeSpan.FromSeconds(PageDuration); DurationForEachPage.Add(TimeSpan.FromSeconds(PageDuration)); } SortField = GraphicsHandler.GetFilledSortField (SortField); NumberOfPages = GraphicsHandler.PageDurations.Count; GraphicsHandler.Close (); Description.StandBildTVVersion = "PKG_Version"; Description.DurationOfEachPageInEachDescription.Add (DurationForEachPage); Description.FillTimingsForEachDescription (ID, UsedTimings); if ((NumberOfPages == 0) || (PlayLengthForThisEntry == TimeSpan.Zero)) { WMB.Basics.ReportErrorToEventViewer ("WPMediaCentralServices.CreateStandbildPlayingData", Entry.FullName + " in der Table \"" + TableName + "\" hat eine PlayLength von 0"); continue; } Description.NamesOfActiveDescriptions.Add (Entry.FullName.Substring (SkipLength)); if (String.IsNullOrEmpty(Description.SubDirectoryWhereTheDescriptionsAreLocated)) { Description.SubDirectoryWhereTheDescriptionsAreLocated = Path.GetDirectoryName (Entry.FullName.Substring (SkipLength)); } Description.LastWriteTimesOfNamesOfActiveDescriptions.Add (Entry.LastWriteTime); Description.SortFields.Add (SortField); Description.NumberOfPagesOfEachDescription.Add (NumberOfPages); OverallNumberOfPictures += NumberOfPages; Description.OverallPlayLength += PlayLengthForThisEntry.TotalSeconds; Description.PlayLengthOfEachDescription.Add (PlayLengthForThisEntry); } if (OutsideSetDuration > 0) { if (MeaningOfOutsideSetDuration == CVM.CommonValues.WPMEDIA_MEANING_OF_OUTSIDE_SET_DURATION_MAX) if (OutsideSetDuration < Description.OverallPlayLength) Description.OverallPlayLength = OutsideSetDuration; if (MeaningOfOutsideSetDuration == CVM.CommonValues.WPMEDIA_MEANING_OF_OUTSIDE_SET_DURATION_FIX) Description.OverallPlayLength = OutsideSetDuration; } Description.OverallNumberOfPicturesToShow = OverallNumberOfPictures; String ControlFileName = Description.TableName; if (tableDefinitionRow ["DefinitionNameToCreate"] != Convert.DBNull) if (!String.IsNullOrEmpty (tableDefinitionRow ["DefinitionNameToCreate"].ToString ())) ControlFileName = tableDefinitionRow ["DefinitionNameToCreate"].ToString (); //TODO String PlayingDataDirectory = Path.Combine(LocalWPMediaRoot, XML_SENDER_AUTO_CONTROL_DIRECTORY); String PlayingDataDirectory = Path.Combine(WPMediaServerRootDirectory, XML_SENDER_AUTO_CONTROL_DIRECTORY); if (!Directory.Exists (PlayingDataDirectory)) Directory.CreateDirectory (PlayingDataDirectory); String FileName = Path.Combine (PlayingDataDirectory, ControlFileName + AUTO_CONTROL_FILE_EXT_EXTENSION_SHORT); Description.FillIndexIndizess (); WPMediaStandbildPlayingData EarlierDescription = GetWPMediaStandbildPlayingDataFromAssembledFile (FileName); // EarlierDescription.ClearAllRandomElements(); if (PlayingDataObjectsAreEqual(EarlierDescription, Description)) return; MemoryStream ContentOfPlayingData = AssembleContentOfPlayingData(Description, Convert.ToString(Description.OverallPlayLength), Description.TableName, "StandbildTV"); bool CorrectDeleted = true; if (File.Exists (FileName)) { CorrectDeleted = CommonDataBase.CommonBasics.SecureFileDelete (FileName, null); } if (CorrectDeleted) { FileStream TargetFile = File.Open (FileName, FileMode.Create, FileAccess.Write); ContentOfPlayingData.WriteTo(TargetFile); TargetFile.Close (); } ContentOfPlayingData.Close (); }
public static bool CreateOrModifyAsStandBildLayout (String TableName, System.Guid ID, String StandBildLayoutNameID) { WCFStandardsNS.WCFStandards DataAccess = new WCFStandards (); DataAccess.DefaultConnectionStringName = "WPMediaAddOnDataConnectionString"; CVM.GraphicsHandling GraphicsHandler = new GraphicsHandling(Basics.GetLocalWPMediaRoot ()); Object Pkg = GraphicsHandler.GetInstatiatedPackage (TableName, ID.ToString ()); List<BitmapSource> CreatedPictures = GraphicsHandler.GetFinalPictures (); int SubEntryIndex = 0; DataSet ExistingMaterials = DataAccess.GetCommonDataSet ("Select " + MATERIALIEN_ITEM_LIST + " from Materialien " + "where Tabelle = '" + TableName + "' and TabelleID = '" + ID.ToString () + "' order by SubEntryID"); if (ExistingMaterials.Tables ["Materialien"].Rows.Count > 0) { int PictureIndex = 0; List<DataRow> RowsToDelete = new List<DataRow> (); foreach (DataRow Existing in ExistingMaterials.Tables ["Materialien"].Rows) { PictureIndex = Convert.ToInt32 (Existing ["SubEntryID"].ToString ().Replace (LAYOUT_PICTURE_PREFIX, "")); if ((PictureIndex - 1) < CreatedPictures.Count) { Byte [] JpegContent = GetJpgByteArrayFromBitmapSource (CreatedPictures [PictureIndex - 1]); String UpdateStatement = String.Format ("Update Materialien " + "set NameID = '{0}', Tabelle = '{1}', TabelleID = '{2}', Typ = '{3}', SubEntryID = '{4}', " + "BlobLength = {5}, BlobContent = @BlobParam, " + "ModifyTimeStamp = '{6}', ProcessingStatus = '{7}', CreatedBy = '{8}' where ID = '{9}'", StandBildLayoutNameID, TableName, ID.ToString (), "", String.Format (LAYOUT_PICTURE_PREFIX_FORMAT, PictureIndex), JpegContent.Length, DateTime.Now.ToString (Basics.ISO_DATE_TIME_FORMAT), "", WMB.WPMediaApplicationState.Instance.Properties ["UserName"].ToString (), Existing ["ID"].ToString ()); DataAccess.SetCommonBlob (UpdateStatement, JpegContent); } else { RowsToDelete.Add (Existing); } } foreach (DataRow ToDelete in RowsToDelete) { String DeleteStatement = "Delete Materialien where ID = '" + ToDelete ["ID"].ToString () + "'"; DataAccess.RunSQLBatch (DeleteStatement); } while ((PictureIndex) < CreatedPictures.Count) { System.Guid PictureID = System.Guid.NewGuid (); Byte [] JpegContent = GetJpgByteArrayFromBitmapSource (CreatedPictures [PictureIndex]); String InsertStatement = String.Format ("Insert into Materialien " + "(ID, NameID, Tabelle, TabelleID, Typ, SubEntryID, BlobLength, BlobContent, ModifyTimeStamp, ProcessingStatus, CreatedBy) " + "Values ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', {6}, @BlobParam, '{7}', '{8}', '{9}')", PictureID.ToString (), StandBildLayoutNameID, TableName, ID.ToString (), "", String.Format (LAYOUT_PICTURE_PREFIX_FORMAT, PictureIndex), JpegContent.Length, DateTime.Now.ToString (Basics.ISO_DATE_TIME_FORMAT), "", WMB.WPMediaApplicationState.Instance.Properties ["UserName"].ToString ()); DataAccess.SetCommonBlob (InsertStatement, JpegContent); PictureIndex++; } } else { foreach (BitmapSource Picture in CreatedPictures) { System.Guid PictureID = System.Guid.NewGuid (); Byte [] JpegContent = GetJpgByteArrayFromBitmapSource (Picture); String InsertStatement = String.Format ("Insert into Materialien " + "(ID, NameID, Tabelle, TabelleID, Typ, SubEntryID, BlobLength, BlobContent, ModifyTimeStamp, ProcessingStatus, CreatedBy) Values (" + "'{0}', '{1}', '{2}', '{3}', '{4}', '{5}', {6}, @BlobParam, '{7}', '{8}', '{9}')", PictureID.ToString (), StandBildLayoutNameID, TableName, ID.ToString (), "", String.Format (LAYOUT_PICTURE_PREFIX_FORMAT, SubEntryIndex + 1), JpegContent.Length, DateTime.Now.ToString (Basics.ISO_DATE_TIME_FORMAT), "", WMB.WPMediaApplicationState.Instance.Properties ["UserName"].ToString ()); DataAccess.SetCommonBlob (InsertStatement, JpegContent); SubEntryIndex++; } } return true; }
public bool DoTemplating (Object Sender, String FileNameToTemplate, String TemplateTableName, String TemplateTableID) { String TemplateFileName = CheckLoadAndGetFileNameOfTemplate (TemplateTableName, TemplateTableID); CVM.GraphicsHandling ToTemplateGraphicsHandler = new GraphicsHandling (Basics.GetLocalWPMediaRoot ()); ToTemplateGraphicsHandler.GetInstatiatedPackage (FileNameToTemplate); ToTemplateGraphicsHandler.Close (); Basics.SecureFileDelete (FileNameToTemplate); File.Copy (TemplateFileName, FileNameToTemplate); CVM.GraphicsHandling TemplateGraphicsHandler = new GraphicsHandling (Basics.GetLocalWPMediaRoot ()); Object TemplatePkg = TemplateGraphicsHandler.GetInstatiatedPackage (FileNameToTemplate, true); DataRow ToTemplateFrameContentRow = ToTemplateGraphicsHandler.ActuallReadableContentRow; DataRow TemplateFrameContentRow = TemplateGraphicsHandler.ActuallReadableContentRow; Basics.ReplaceTableInDataSet (TemplateGraphicsHandler.FrameDataDataSetReader, TemplateFrameContentRow.Table, ToTemplateFrameContentRow.Table); Basics.CopyDataRowToDataRow (ToTemplateGraphicsHandler.FrameDataDataSetReader.Tables ["TableDefinitions"].Rows [0], TemplateGraphicsHandler.FrameDataDataSetReader.Tables ["TableDefinitions"].Rows [0]); TemplateGraphicsHandler.RenewFrameDataSet (); TemplateGraphicsHandler.Close (); return true; }
void CheckAllEntries (List<String> PackageList) { DataSet PageEntriesDataSet = m_DataBase.GetCommonDataSet ( "Select * from Pages where NameID > 'DefaultKarteiPage01' and NameID < 'DefaultKarteiPage10'"); if (PageEntriesDataSet.Tables ["Pages"].Rows.Count != 8) throw new Exception ("Alles im Eimer bei \"PageEntriesDataSet\""); foreach (String PackageName in PackageList) { GraphicsHandling Handler = new GraphicsHandling (); Handler.GetInstatiatedPackage (PackageName, true); DataSet FrameDataSet = Handler.FrameDataDataSetReader; if (FrameDataSet.Tables ["FrameContent"].Select( "FormattingTemplate = 'DefaultKartei'").Length == 0) continue; bool UpdateRequired = false; foreach (DataRow PageRow in PageEntriesDataSet.Tables ["Pages"].Rows) { String PageID = PageRow ["ID"].ToString (); if (FrameDataSet.Tables ["Pages"].Select ("ID = '" + PageID + "'").Length == 0) { FrameDataSet.Tables ["Pages"].ImportRow (PageRow); UpdateRequired = true; } } String IDForOldEntry = FrameDataSet.Tables ["Pages"].Select ("NameID = 'DefaultKarteiPage01'") [0] ["ID"].ToString (); int PageIndex = 2; while (PageIndex < 10) { String PageSearchString = "DefaultKarteiPage0" + Convert.ToString (PageIndex); String IDForNewEntry = FrameDataSet.Tables ["Pages"].Select ("NameID = '" + PageSearchString + "'") [0] ["ID"].ToString (); foreach (DataRow ContentRow in FrameDataSet.Tables ["FrameContent"].Select ("PageID = '" + IDForOldEntry + "' and MultiPageIndex = " + Convert.ToString (PageIndex), "FrameOrder")) { String NameID = ContentRow ["NameID"].ToString (); String ItemName = ContentRow ["ItemName"].ToString (); ContentRow ["PageID"] = IDForNewEntry; UpdateRequired = true; } PageIndex++; } if (UpdateRequired == true) { Handler.RenewFrameDataSet (FrameDataSet); Handler.Close (); } WMB.Basics.DoEvents (); } }
private GraphicsHandling LoadAndInstatiatePkgData () { String ControlFileName = Path.Combine (WPMediaRoot, m_StandBildPlayingData.NameOfActiveDescription () ); GraphicsHandling GraphicsHandler = null; if (String.Compare (Path.GetExtension (ControlFileName).ToUpper (), ".PKG") != 0) { ControlFileName = Path.Combine (Path.GetDirectoryName (ControlFileName), Path.GetFileNameWithoutExtension (ControlFileName) + ".pkg"); } if (IsDoubleClickRunMethode ()) { ControlFileName = GetDoubleClickRunMethodeControlFile (); } if (!File.Exists (ControlFileName)) { WMB.Basics.ReportErrorToEventViewer (m_MessageDescriptionID + ".LoadAndInstatiatePkgData", "Der File \"" + ControlFileName + "\" aus der Tabelle \"" + m_StandBildPlayingData.TableName + "\" fehlt"); return null; } try { GraphicsHandler = new GraphicsHandling (WPMediaRoot); String IDToProcess = Path.GetFileNameWithoutExtension (ControlFileName); if (WMB.Basics.IsTestRun) WMB.Basics.ReportInformationToEventViewer ("StandBildTV.LoadAndInstatiatePkgData", "NewPackageID = " + IDToProcess + "\r\nwird gestartet"); if (GraphicsHandler.GetInstatiatedPackage (ControlFileName) == null) { if (IsDoubleClickRunMethode()) MessageBox.Show ("Fehler in der Definition der Tabelle\r\n\"" + m_StandBildPlayingData.TableName + "\"\r\nes konnte kein Package erzeugt werden - Abbruch"); CloseRequestedCall (this, "Format Fehler bei \"" + m_StandBildPlayingData.TableName + "\""); return null; } if (GraphicsHandler.CheckPackageConsistence () != true) { if (IsDoubleClickRunMethode()) MessageBox.Show("Fehler in der zugeordneten ID der Tabelle\r\nbei Filename \"" + ControlFileName + "\"bei der Tabelle \"" + m_StandBildPlayingData.TableName + "\"\r\nund der ID \"" + GraphicsHandler.ActuallReadableContentRow ["ID"].ToString () + "\"\r\nwar der Filename ungleich der internen ID - Abbruch"); else { WMB.Basics.ReportErrorToEventViewer("Fehler in der zugeordneten ID der Tabelle\r\nbei Filename \"" + ControlFileName + "\"bei der Tabelle \"" + m_StandBildPlayingData.TableName + "\"\r\nund der ID \"" + GraphicsHandler.ActuallReadableContentRow["ID"].ToString() + "\"\r\nwar der Filename ungleich der internen ID - Abbruch"); } return null; } GraphicsHandler.CreateAndStoreFinalPictures (); //GraphicsHandler.Close (); List<String> DisplayHelpList = new List<String> (); foreach (double PlayLength in GraphicsHandler.PageDurations) DisplayHelpList.Add (Convert.ToString (PlayLength)); if (WMB.Basics.IsTestRun) WMB.Basics.ReportInformationToEventViewer ("StandBildTV.LoadAndInstatiatePkgData", "NewPackageID = " + IDToProcess + " ist gestartet worden\r\n" + "NameID = " + GraphicsHandler.ActuallReadableContentRow ["NameID"].ToString () + "\r\nDurations per Page = " + String.Join (", ",DisplayHelpList.ToArray ())); this.Width = m_HostCVM.VideoWidth; this.Height = m_HostCVM.VideoHeight; } catch (Exception Excp) { WMB.Basics.ReportErrorToEventViewer (m_MessageDescriptionID + ".FillData", "Folgender Fehler trat beim ControlFile \"" + ControlFileName + "\":\r\n" + Excp.ToString()); return null; } return GraphicsHandler; }
void CorrectThisEntry (String PackageName) { GraphicsHandling Handler = new GraphicsHandling (); Handler.GetInstatiatedPackage (PackageName, true); DataSet FrameDataSet = Handler.FrameDataDataSetReader; bool UpdateRequired = false; foreach (DataRow ContentRow in FrameDataSet.Tables ["FrameContent"].Select ("", "FrameOrder")) { String FrameContentID = "421156b1-f009-47c7-a6c6-913d7ab7dbd7"; if (ContentRow ["ID"].ToString () == FrameContentID) UpdateRequired = true; if (!UpdateRequired) continue; String NameID = ContentRow ["NameID"].ToString (); String ItemName = ContentRow ["ItemName"].ToString (); if ((NameID == "KurzText") && (ItemName == "LangTextSeite1")) { ContentRow ["NameID"] = "LangTextSeite1"; ContentRow ["ItemName"] = "LangTextSeite1"; continue; } if ((NameID == "LangtextSeite1") && (ItemName == "LangTextSeite2")) { ContentRow ["NameID"] = "LangTextSeite2"; continue; } if ((NameID == "LangtextSeite2") && (ItemName == "LangTextSeite3")) { ContentRow ["NameID"] = "LangTextSeite3"; continue; } if ((NameID == "LangtextSeite3") && (ItemName == "LangTextSeite4")) { ContentRow ["NameID"] = "LangTextSeite4"; continue; } if ((NameID == "LangtextSeite4") && (ItemName == "LangTextSeite4")) { ContentRow ["NameID"] = "LangTextSeite5"; ContentRow ["ItemName"] = "LangTextSeite5"; continue; } String PictureName = ContentRow ["PictureName"].ToString (); } if (UpdateRequired == true) { Handler.RenewFrameDataSet (FrameDataSet); } Handler.Close (); }
String GetReadableNameFromDefinition (String WPMediaRootToUse, String PackageName) { if (!Path.IsPathRooted (PackageName)) PackageName = Path.Combine (WPMediaRootToUse, PackageName); if (!File.Exists (PackageName)) return "File \"" + PackageName + "\" not exists"; GraphicsHandling Handler = new GraphicsHandling (); if (Handler.GetInstatiatedPackage (PackageName) == null) return "\"" + PackageName + "\" is not valid Package"; return Handler.ActuallReadableContentRow ["NameID"].ToString (); }
private bool CopyPkgEntrysFormat (String TableName, String OldID, String NewID) { String OldPkgFileName = GraphicsSingleton.Instance.GraphicsHandler.GetPackageName (TableName, OldID); String NewPkgFileName = Path.Combine (Path.GetDirectoryName (OldPkgFileName), NewID + Path.GetExtension (OldPkgFileName)); File.Copy (OldPkgFileName, NewPkgFileName); GraphicsHandling NewHandler = new GraphicsHandling (WMB.Basics.GetLocalWPMediaRoot ()); NewHandler.RemoteWPMediaRoot = WMB.Basics.GetRemoteWPMediaRoot (); NewHandler.DoSQLBatchCall += new DoSQLBatchEvent (LocalGraphicsHandling_DoSQLBatchCall); NewHandler.GetInstatiatedPackage (TableToProcess, NewID); NewHandler.ActualizeInstanceDataIntoFrameDataSet (m_DataBase, TableToProcess, NewID); NewHandler.Close (); String RemoteFileName = WMB.Basics.GetRemoteFileNameFromLocalFileName(NewPkgFileName); DoCentralFileUpdate(NewPkgFileName, RemoteFileName); NewHandler.GetInstatiatedPackage (NewPkgFileName); return true; }
private int ReActivateStandBildsEntry (List<String> OldFiles, String TableName, DataRow RowToProcess) { String ID = RowToProcess ["ID"].ToString (); //GraphicsHandling GraphicHandler = new GraphicsHandling(WPMediaRoot); GraphicsHandling GraphicHandler = new GraphicsHandling(CommonDataBase.DataBase.GetRemoteWPMediaRoot()); GraphicHandler.DoCentralStreamDownloadCall += new DoCentralStreamDownloadEvent (GraphicHandler_DoCentralStreamDownloadCall); GraphicHandler.RemoteWPMediaRoot = CommonDataBase.DataBase.GetRemoteWPMediaRoot (); String ActuallPackageName = GraphicHandler.GetPackageName (TableName, ID); String ArchivedPackageName = ActuallPackageName.Replace ("\\" + CVM.CommonValues.XML_AUTO_CONTENT_SOURCE + "\\", "\\" + CVM.CommonValues.XML_AUTO_CONTENT_OLD_SOURCE + "\\"); if (!File.Exists (ActuallPackageName)) { if (File.Exists (ArchivedPackageName)) File.Move (ArchivedPackageName, ActuallPackageName); //else // { // WMB.Basics.ReportErrorToEventViewer ("CreateStandbildTVUnits.Create", // "Bei der Tabelle \"" + TableName + "\" bei der ID\r\n\"" // + ID + "\" gab es keinen Package File\r\nund keinen ArchivedPackageFile\r\n\"" // + ArchivedPackageName + "\""); // return 0; // } } Object ResultedPackage = GraphicHandler.GetInstatiatedPackage (m_DataBase, TableName, ID); if (ResultedPackage == null) { WMB.Basics.ReportErrorToEventViewer ("CreateStandbildTVUnits.Create", "Bei der Tabelle \"" + TableName + "\" kam null beim ResultedPackage zurück"); return 0; } RemoveControlFileFromFileList (OldFiles, ID); GraphicHandler.Close (); return 1; }