protected virtual void Dispose(bool disposing) { if (!(_real is IDisposable)) return; ((IDisposable)_real).Dispose(); _real = null; }
private void _ingestSelectionToDir(IServerDirectory directory) { IMediaDirectory currentDir = _selectedDirectory?.Directory; if (currentDir is IIngestDirectory) { List <IConvertOperation> ingestList = new List <IConvertOperation>(); var selectedMedia = _getSelections(); ThreadPool.QueueUserWorkItem(o => { selectedMedia.ForEach(m => { if (!m.IsVerified) { m.Verify(); } }); }); foreach (IMedia sourceMedia in selectedMedia) { string destFileName = FileUtils.GetUniqueFileName(directory.Folder, $"{Path.GetFileNameWithoutExtension(sourceMedia.FileName)}{FileUtils.DefaultFileExtension(sourceMedia.MediaType)}"); IPersistentMediaProperties destMediaProperties = new PersistentMediaProxy { FileName = destFileName, MediaName = FileUtils.GetFileNameWithoutExtension(sourceMedia.FileName, sourceMedia.MediaType), MediaType = sourceMedia.MediaType == TMediaType.Unknown ? TMediaType.Movie : sourceMedia.MediaType, Duration = sourceMedia.Duration, DurationPlay = sourceMedia.DurationPlay, MediaGuid = sourceMedia.MediaGuid, MediaCategory = sourceMedia.MediaCategory }; ingestList.Add( FileManagerViewmodel.CreateConvertOperation( sourceMedia, destMediaProperties, directory, _mediaManager.VideoFormat, (sourceMedia.Directory is IIngestDirectory) ? ((IIngestDirectory)sourceMedia.Directory).AudioVolume : 0, (sourceMedia.Directory is IIngestDirectory) ? ((IIngestDirectory)sourceMedia.Directory).SourceFieldOrder : TFieldOrder.Unknown, (sourceMedia.Directory is IIngestDirectory) ? ((IIngestDirectory)sourceMedia.Directory).AspectConversion : TAspectConversion.NoConversion, (sourceMedia.Directory is IIngestDirectory) ? ((IIngestDirectory)sourceMedia.Directory).MediaLoudnessCheckAfterIngest : false )); } if (ingestList.Count != 0) { using (IngestEditViewmodel ievm = new IngestEditViewmodel(ingestList, _preview, _mediaManager)) { if (ievm.ShowDialog() == true) { foreach (var operationVm in ievm.OperationList) { _mediaManager.FileManager.Queue(operationVm.FileOperation, false); } } } } } }
protected virtual void Dispose(bool disposing) { if (!(_real is IDisposable)) { return; } ((IDisposable)_real).Dispose(); _real = null; }
private ListViewItem method_0(IServerDirectory iserverDirectory_0) { string[] items = new string[2]; string[] strArray2 = iserverDirectory_0.URL.Split(new char[] { '/' }); items[0] = strArray2[strArray2.Length - 1]; items[1] = iserverDirectory_0.Path; return(new ListViewItem(items) { Tag = iserverDirectory_0 }); }
public TIngestStatus GetIngestStatus(IServerDirectory directory) { if (!(directory is ServerDirectory sdir)) { return(TIngestStatus.Unknown); } var media = sdir.FindMediaByMediaGuid(MediaGuid); if (media != null && media.MediaStatus == TMediaStatus.Available) { return(TIngestStatus.Ready); } return(TIngestStatus.Unknown); }
internal void SaveServersToDirectory(IServerDirectory directory) { //NOTE: The server tree currently doesn't handle any of the "extended" server data, so we just abstract that part away //and only deal with it when we are saving the servers back to the directory. //Get all the entries from the directory. var serverDirectoryEntries = directory.GetServers(new GetServersRequest()).ServerEntries.ToList(); //Convert the tree items to data contracts (ApplicationEntity). var treeServers = RootServerGroup.GetAllServers().OfType <IServerTreeDicomServer>().Select(a => a.ToDataContract()).ToList(); //Figure out which entries have been deleted. IEnumerable <ServerDirectoryEntry> deletedEntries = from d in serverDirectoryEntries where !treeServers.Any(t => t.Name == d.Server.Name) select d; //Figure out which are new. IEnumerable <ApplicationEntity> addedServers = (from t in treeServers where !serverDirectoryEntries.Any(d => t.Name == d.Server.Name) select t); //Figure out which have changed. IEnumerable <ApplicationEntity> changedServers = (from t in treeServers where serverDirectoryEntries.Any(d => t.Name == d.Server.Name && !t.Equals(d.Server)) select t); //Most updates are done one server at a time, anyway, so we'll just do this. //Could implement bulk update methods on the service, too. foreach (var d in deletedEntries) { try { directory.DeleteServer(new DeleteServerRequest { ServerEntry = d }); } catch (Exception e) { Platform.Log(LogLevel.Warn, e, "Server being deleted ('{0}') does not exist in directory.", d.Server.Name); } } foreach (var c in changedServers) { //Find the corresponding entry and update IT because we don't want to lose the "extended" data. var changedEntry = serverDirectoryEntries.First(e => e.Server.Name == c.Name); changedEntry.Server = c; directory.UpdateServer(new UpdateServerRequest { ServerEntry = changedEntry }); } foreach (var a in addedServers) { directory.AddServer(new AddServerRequest { ServerEntry = new ServerDirectoryEntry(a) }); } }
public void CopyMediaToPlayout(IEnumerable <IMedia> mediaList, bool toTop) { foreach (IMedia sourceMedia in mediaList) { IServerDirectory destDir = MediaDirectoryPRI != null && MediaDirectoryPRI.DirectoryExists() ? MediaDirectoryPRI : MediaDirectoryPRV != null && MediaDirectoryPRV.DirectoryExists() ? MediaDirectoryPRV : null; if (sourceMedia is PersistentMedia && destDir != null && destDir != sourceMedia.Directory) { _fileManager.Queue(new FileOperation() { Kind = TFileOperationKind.Copy, SourceMedia = sourceMedia, DestDirectory = destDir }, toTop); } } }
private void cboDirectoryType_SelectedIndexChanged(object sender, EventArgs e) { IEnumServerDirectory serverDirectories = this.AGSServerConnectionAdmin.ServerObjectAdmin.GetServerDirectories(); serverDirectories.Reset(); IServerDirectory directory2 = serverDirectories.Next(); this.lstDir.Items.Clear(); while (directory2 != null) { if (this.cboDirectoryType.SelectedIndex == 0) { if ((directory2 as IServerDirectory2).Type == esriServerDirectoryType.esriSDTypeCache) { this.lstDir.Items.Add(this.method_0(directory2)); } } else if (this.cboDirectoryType.SelectedIndex == 1) { if ((directory2 as IServerDirectory2).Type == esriServerDirectoryType.esriSDTypeJobs) { this.lstDir.Items.Add(this.method_0(directory2)); } } else if (this.cboDirectoryType.SelectedIndex == 2) { if ((directory2 as IServerDirectory2).Type == esriServerDirectoryType.esriSDTypeOutput) { this.lstDir.Items.Add(this.method_0(directory2)); } } else if ((this.cboDirectoryType.SelectedIndex == 3) && ((directory2 as IServerDirectory2).Type == esriServerDirectoryType.esriSDTypeSystem)) { this.lstDir.Items.Add(this.method_0(directory2)); } directory2 = serverDirectories.Next(); } }
private void _ingestSelectedToServer(object o) { if (!_checkEditMediaSaved()) { return; } IServerDirectory pri = _mediaManager.MediaDirectoryPRI; IServerDirectory sec = _mediaManager.MediaDirectorySEC; IServerDirectory dir = pri != null && pri.DirectoryExists() ? pri : sec != null && sec.DirectoryExists() ? sec : null; if (dir != null) { if (_selectedDirectory.IsIngestDirectory) { _ingestSelectionToDir(dir); } else { _mediaManager.CopyMediaToPlayout(_getSelections(), true); } } }
internal void SaveServersToDirectory(IServerDirectory directory) { //NOTE: The server tree currently doesn't handle any of the "extended" server data, so we just abstract that part away //and only deal with it when we are saving the servers back to the directory. //Get all the entries from the directory. var serverDirectoryEntries = directory.GetServers(new GetServersRequest()).ServerEntries.ToList(); //Convert the tree items to data contracts (ApplicationEntity). var treeServers = RootServerGroup.GetAllServers().OfType<IServerTreeDicomServer>().Select(a => a.ToDataContract()).ToList(); //Figure out which entries have been deleted. IEnumerable<ServerDirectoryEntry> deletedEntries = from d in serverDirectoryEntries where !treeServers.Any(t => t.Name == d.Server.Name) select d; //Figure out which are new. IEnumerable<ApplicationEntity> addedServers = (from t in treeServers where !serverDirectoryEntries.Any(d => t.Name == d.Server.Name) select t); //Figure out which have changed. IEnumerable<ApplicationEntity> changedServers = (from t in treeServers where serverDirectoryEntries.Any(d => t.Name == d.Server.Name && !t.Equals(d.Server)) select t); //Most updates are done one server at a time, anyway, so we'll just do this. //Could implement bulk update methods on the service, too. foreach (var d in deletedEntries) { try { directory.DeleteServer(new DeleteServerRequest { ServerEntry = d }); } catch (Exception e) { Platform.Log(LogLevel.Warn, e, "Server being deleted ('{0}') does not exist in directory.", d.Server.Name); } } foreach (var c in changedServers) { //Find the corresponding entry and update IT because we don't want to lose the "extended" data. var changedEntry = serverDirectoryEntries.First(e => e.Server.Name == c.Name); changedEntry.Server = c; directory.UpdateServer(new UpdateServerRequest{ServerEntry = changedEntry}); } foreach (var a in addedServers) { directory.AddServer(new AddServerRequest { ServerEntry = new ServerDirectoryEntry(a) }); } }
public void ArchiveRestore(IArchiveMedia srcMedia, IServerDirectory destDirectory, bool toTop) { Invoke(parameters: new object[] { srcMedia, destDirectory, toTop }); }
public void ArchiveRestore(IArchiveMedia srcMedia, IServerDirectory destDirectory, bool toTop) { _archiveCopy((MediaBase)srcMedia, destDirectory, false, toTop); }
public ServerDirectoryProxy() { _real = new ServerDirectory(); }
public MediaManagerViewmodel(IMediaManager mediaManager, IPreview preview) { _mediaManager = mediaManager; _preview = preview; if (preview != null) { PreviewViewmodel = new PreviewViewmodel(preview); } MediaDirectories = new List <MediaDirectoryViewmodel>(); MediaDirectories.AddRange(mediaManager.IngestDirectories.Where(d => d.ContainsImport()).Select(d => new MediaDirectoryViewmodel(d, true))); IArchiveDirectory archiveDirectory = mediaManager.ArchiveDirectory; if (archiveDirectory != null) { MediaDirectories.Insert(0, new MediaDirectoryViewmodel(archiveDirectory)); } IAnimationDirectory animationDirectoryPRI = mediaManager.AnimationDirectoryPRI; if (animationDirectoryPRI != null) { MediaDirectories.Insert(0, new MediaDirectoryViewmodel(animationDirectoryPRI)); } IAnimationDirectory animationDirectorySEC = mediaManager.AnimationDirectorySEC; if (animationDirectorySEC != null) { MediaDirectories.Insert(0, new MediaDirectoryViewmodel(animationDirectorySEC)); } IServerDirectory serverDirectoryPRI = mediaManager.MediaDirectoryPRI; MediaDirectoryViewmodel serverDirectoryPRIVm = new MediaDirectoryViewmodel(serverDirectoryPRI); if (serverDirectoryPRI != null) { MediaDirectories.Insert(0, serverDirectoryPRIVm); } IServerDirectory serverDirectorySEC = mediaManager.MediaDirectorySEC; if (serverDirectorySEC != null && serverDirectorySEC != serverDirectoryPRI) { MediaDirectories.Insert(1, new MediaDirectoryViewmodel(serverDirectorySEC)); } _mediaCategory = MediaCategories.FirstOrDefault(); SelectedDirectory = serverDirectoryPRIVm; if (mediaManager.FileManager != null) { FileManagerViewmodel = new FileManagerViewmodel(mediaManager.FileManager); } RecordersViewmodel = new RecordersViewmodel(mediaManager.Recorders); RecordersViewmodel.PropertyChanged += _recordersViewmodel_PropertyChanged; _previewDisplay = true; ComposePlugins(); VideoPreview?.SetSource(RecordersViewmodel.Channel?.PreviewUrl); CommandSearch = new UICommand { ExecuteDelegate = _search, CanExecuteDelegate = _canSearch }; CommandClearFilters = new UICommand { ExecuteDelegate = _clearFilters, CanExecuteDelegate = _canClearFilters }; CommandDeleteSelected = new UICommand { ExecuteDelegate = _deleteSelected, CanExecuteDelegate = _isSomethingSelected }; CommandIngestSelectedToServer = new UICommand { ExecuteDelegate = _ingestSelectedToServer, CanExecuteDelegate = _canIngestSelectedToServer }; CommandMoveSelectedToArchive = new UICommand { ExecuteDelegate = _moveSelectedToArchive, CanExecuteDelegate = o => _selectedDirectory != null && _selectedDirectory.IsServerDirectory && _isSomethingSelected(o) }; CommandCopySelectedToArchive = new UICommand { ExecuteDelegate = _copySelectedToArchive, CanExecuteDelegate = o => _selectedDirectory != null && _selectedDirectory.IsServerDirectory && _isSomethingSelected(o) }; CommandSweepStaleMedia = new UICommand { ExecuteDelegate = _sweepStaleMedia }; CommandGetLoudness = new UICommand { ExecuteDelegate = _getLoudness, CanExecuteDelegate = _isSomethingSelected }; CommandExport = new UICommand { ExecuteDelegate = _export, CanExecuteDelegate = _canExport }; CommandRefresh = new UICommand { ExecuteDelegate = ob => _refreshMediaDirectory(_selectedDirectory?.Directory), CanExecuteDelegate = o => _selectedDirectory?.IsIngestDirectory == true }; CommandSyncPriToSec = new UICommand { ExecuteDelegate = _syncSecToPri, CanExecuteDelegate = o => _selectedDirectory.IsServerDirectory }; CommandCloneAnimation = new UICommand { ExecuteDelegate = _cloneAnimation, CanExecuteDelegate = _canCloneAnimation }; }
public MediaManagerViewmodel(IEngine engine, IPreview preview) { _mediaManager = engine.MediaManager; _engine = engine; _preview = preview; if (preview != null) { PreviewViewmodel = new PreviewViewmodel(engine, preview); } MediaDirectories = new List <MediaDirectoryViewmodel>(); MediaDirectories.AddRange(_mediaManager.IngestDirectories.Where(d => d.ContainsImport()).Select(d => new MediaDirectoryViewmodel(d, true))); IArchiveDirectory archiveDirectory = _mediaManager.ArchiveDirectory; if (archiveDirectory != null) { MediaDirectories.Insert(0, new MediaDirectoryViewmodel(archiveDirectory)); } IAnimationDirectory animationDirectoryPri = _mediaManager.AnimationDirectoryPRI; if (animationDirectoryPri != null) { MediaDirectories.Insert(0, new MediaDirectoryViewmodel(animationDirectoryPri)); } IAnimationDirectory animationDirectorySec = _mediaManager.AnimationDirectorySEC; if (animationDirectorySec != null) { MediaDirectories.Insert(0, new MediaDirectoryViewmodel(animationDirectorySec)); } IServerDirectory serverDirectoryPri = _mediaManager.MediaDirectoryPRI; if (serverDirectoryPri != null) { MediaDirectories.Insert(0, new MediaDirectoryViewmodel(serverDirectoryPri)); } IServerDirectory serverDirectorySec = _mediaManager.MediaDirectorySEC; if (serverDirectorySec != null && serverDirectorySec != serverDirectoryPri) { MediaDirectories.Insert(1, new MediaDirectoryViewmodel(serverDirectorySec)); } _mediaCategory = MediaCategories.FirstOrDefault(); SelectedDirectory = MediaDirectories.FirstOrDefault(); if (_mediaManager.FileManager != null) { FileManagerViewmodel = new FileManagerViewmodel(_mediaManager.FileManager); } RecordersViewmodel = new RecordersViewmodel(_engine, _mediaManager.Recorders); RecordersViewmodel.PropertyChanged += _recordersViewmodel_PropertyChanged; ComposePlugins(); VideoPreview?.SetSource(RecordersViewmodel.Channel?.PreviewUrl); CommandSearch = new UICommand { ExecuteDelegate = _search, CanExecuteDelegate = _canSearch }; CommandClearFilters = new UICommand { ExecuteDelegate = _clearFilters, CanExecuteDelegate = _canClearFilters }; CommandDeleteSelected = new UICommand { ExecuteDelegate = _deleteSelected, CanExecuteDelegate = o => _isSomethingSelected() && engine.HaveRight(EngineRight.MediaDelete) }; CommandIngestSelectedToServer = new UICommand { ExecuteDelegate = _ingestSelectedToServer, CanExecuteDelegate = _canIngestSelectedToServer }; CommandMoveSelectedToArchive = new UICommand { ExecuteDelegate = _moveSelectedToArchive, CanExecuteDelegate = o => _selectedDirectory != null && _selectedDirectory.IsServerDirectory && _isSomethingSelected() && engine.HaveRight(EngineRight.MediaArchive) && engine.HaveRight(EngineRight.MediaDelete) }; CommandCopySelectedToArchive = new UICommand { ExecuteDelegate = _copySelectedToArchive, CanExecuteDelegate = o => _selectedDirectory != null && _selectedDirectory.IsServerDirectory && _isSomethingSelected() && engine.HaveRight(EngineRight.MediaArchive) }; CommandSweepStaleMedia = new UICommand { ExecuteDelegate = _sweepStaleMedia, CanExecuteDelegate = o => CurrentUser.IsAdmin }; CommandGetLoudness = new UICommand { ExecuteDelegate = _getLoudness, CanExecuteDelegate = o => _isSomethingSelected() && engine.HaveRight(EngineRight.MediaEdit) }; CommandExport = new UICommand { ExecuteDelegate = _export, CanExecuteDelegate = _canExport }; CommandRefresh = new UICommand { ExecuteDelegate = ob => _refreshMediaDirectory(_selectedDirectory?.Directory), CanExecuteDelegate = _canRefresh }; CommandSyncPriToSec = new UICommand { ExecuteDelegate = _syncSecToPri, CanExecuteDelegate = o => _selectedDirectory.IsServerDirectory && CurrentUser.IsAdmin }; CommandCloneAnimation = new UICommand { ExecuteDelegate = _cloneAnimation, CanExecuteDelegate = _canCloneAnimation }; CommandTogglePropertiesPanel = new UICommand { ExecuteDelegate = o => IsPropertiesPanelVisible = !IsPropertiesPanelVisible }; }
public ServerDirectoryBridge(IServerDirectory serverDirectory) { Platform.CheckForNullReference(serverDirectory, "serverDirectory"); _real = serverDirectory; }
public void NotifyIngestStatus(IServerDirectory directory, TIngestStatus newStatus) { }
public TIngestStatus GetIngestStatus(IServerDirectory directory) { return(Query <TIngestStatus>(parameters: new object[] { directory })); }