public EffectCover(object cEffect) { oEffect = cEffect; (new Logger()).WriteDebug2("effect:cover:create [hc:" + GetHashCode() + "][effect:" + nEffectHashCode + "][type:" + cEffect.GetType() + "]"); oEventsLocker = new object(); oContainerEventsLocker = new object(); oLock = new object(); bDisposed = false; if (cEffect is BTL.Play.Effect) { if (cEffect is BTL.Play.Animation) { this.sType = "animation"; this.sInfo = ((BTL.Play.Animation)cEffect).sFolder; } else if (cEffect is BTL.Play.Audio) { this.sType = "audio"; this.sInfo = ((BTL.Play.Audio)cEffect).sFile; } else if (cEffect is BTL.Play.Clock) { this.sType = "clock"; this.sInfo = ((BTL.Play.Clock)cEffect).sText; } else if (cEffect is BTL.Play.Text) { this.sType = "text"; this.sInfo = ((BTL.Play.Text)cEffect).sText; } else if (cEffect is BTL.Play.Video) { this.sType = "video"; this.sInfo = ((BTL.Play.Video)cEffect).sFile; } else if (cEffect is BTL.Play.Composite) { this.sType = "composite"; this.sInfo = "x=" + ((BTL.Play.Composite)cEffect).stArea.nLeft + ", y=" + ((BTL.Play.Composite)cEffect).stArea.nTop; } else if (cEffect is BTL.Play.Playlist) { this.sType = "playlist"; this.sInfo = "x=" + ((BTL.Play.Playlist)cEffect).cDock.cOffset.nLeft + ", y=" + ((BTL.Play.Playlist)cEffect).cDock.cOffset.nTop; } else if (cEffect is BTL.Play.Roll) { this.sType = "roll"; this.sInfo = "x=" + ((BTL.Play.Roll)cEffect).stArea.nLeft + ", y=" + ((BTL.Play.Roll)cEffect).stArea.nTop; } BTL.Play.Effect cEffectBTL = (BTL.Play.Effect)cEffect; cEffectBTL.Prepared += new BTL.Play.Effect.EventDelegate(OnEffectPrepared); cEffectBTL.Started += new BTL.Play.Effect.EventDelegate(OnEffectStarted); cEffectBTL.Stopped += new BTL.Play.Effect.EventDelegate(OnEffectStopped); cEffectBTL.Failed += new BTL.Play.Effect.EventDelegate(OnEffectFailed); if (cEffectBTL.bContainer) { if (cEffectBTL is BTL.Play.Roll) //UNDONE временное условие - нужно roll наследовать от container, но только после того, как уберем разделение на IAudio и IVideo { BTL.Play.Roll cContainer = (BTL.Play.Roll)cEffectBTL; cContainer.EffectAdded += OnContainerEffectAdded; cContainer.EffectPrepared += OnContainerEffectPrepared; cContainer.EffectStarted += OnContainerEffectStarted; cContainer.EffectStopped += OnContainerEffectStopped; cContainer.EffectIsOnScreen += OnContainerEffectIsOnScreen; cContainer.EffectIsOffScreen += OnContainerEffectIsOffScreen; cContainer.EffectFailed += OnContainerEffectFailed; } else { BTL.Play.ContainerVideoAudio cContainer = (BTL.Play.ContainerVideoAudio)cEffectBTL; cContainer.EffectAdded += OnContainerEffectAdded; cContainer.EffectPrepared += OnContainerEffectPrepared; cContainer.EffectStarted += OnContainerEffectStarted; cContainer.EffectStopped += OnContainerEffectStopped; cContainer.EffectIsOnScreen += OnContainerEffectIsOnScreen; cContainer.EffectIsOffScreen += OnContainerEffectIsOffScreen; cContainer.EffectFailed += OnContainerEffectFailed; } } } else if (cEffect is Plugin) { Plugin cPlugin = (Plugin)cEffect; this.sType = "Plugin"; this.sInfo = cPlugin.sFile; cPlugin.Prepared += new plugins.EventDelegate(OnEffectPrepared); cPlugin.Started += new plugins.EventDelegate(OnEffectStarted); cPlugin.Stopped += new plugins.EventDelegate(OnEffectStopped); } else { throw new Exception("ec: неизвестный тип эффекта [hc:" + cEffect.GetHashCode() + "]"); //TODO LANG } (new Logger()).WriteNotice("effect created: [hc:" + this.GetHashCode() + "][name:" + this.sType + "][info:" + this.sInfo + "][status:" + this.eStatus + "]"); }
public void Dispose() { lock (oLock) { if (bDisposed) { return; } bDisposed = true; } if (null == oEffect) { (new Logger()).WriteNotice("program.cs:EffectCover:Dispose [hash this: " + this.GetHashCode() + "]"); return; } //(new Logger()).WriteNotice("program.cs:EffectCover:Dispose: part1 [hash this: " + nHash + "]"); if (oEffect is BTL.Play.Effect) { //(new Logger()).WriteNotice("program.cs:EffectCover:Dispose: part2 [hash this: " + nHash + "]"); BTL.Play.Effect cEffectBTL = (BTL.Play.Effect)oEffect; //(new Logger()).WriteNotice("program.cs:EffectCover:Dispose: part3 [hash this: " + nHash + "]"); if (cEffectBTL.bContainer) { //(new Logger()).WriteNotice("program.cs:EffectCover:Dispose: part4 [hash this: " + nHash + "]"); if (cEffectBTL is BTL.Play.Roll) //UNDONE временное условие - нужно roll наследовать от container, но только после того, как уберем разделение на IAudio и IVideo { //(new Logger()).WriteNotice("program.cs:EffectCover:Dispose: part5 [hash this: " + nHash + "]"); BTL.Play.Roll cContainer = (BTL.Play.Roll)cEffectBTL; cContainer.EffectAdded -= OnContainerEffectAdded; cContainer.EffectPrepared -= OnContainerEffectPrepared; cContainer.EffectStarted -= OnContainerEffectStarted; cContainer.EffectStopped -= OnContainerEffectStopped; cContainer.EffectIsOnScreen -= OnContainerEffectIsOnScreen; cContainer.EffectIsOffScreen -= OnContainerEffectIsOffScreen; cContainer.EffectFailed -= OnContainerEffectFailed; } else { //(new Logger()).WriteNotice("program.cs:EffectCover:Dispose: part6 [hash this: " + nHash + "]"); BTL.Play.ContainerVideoAudio cContainer = (BTL.Play.ContainerVideoAudio)cEffectBTL; cContainer.EffectAdded -= OnContainerEffectAdded; cContainer.EffectPrepared -= OnContainerEffectPrepared; cContainer.EffectStarted -= OnContainerEffectStarted; cContainer.EffectStopped -= OnContainerEffectStopped; cContainer.EffectIsOnScreen -= OnContainerEffectIsOnScreen; cContainer.EffectIsOffScreen -= OnContainerEffectIsOffScreen; cContainer.EffectFailed -= OnContainerEffectFailed; } } cEffectBTL.Prepared -= OnEffectPrepared; cEffectBTL.Started -= OnEffectStarted; cEffectBTL.Stopped -= OnEffectStopped; cEffectBTL.Failed -= OnEffectFailed; cEffectBTL.Dispose(); } //(new Logger()).WriteNotice("program.cs:EffectCover:Dispose: part7 [hash this: " + nHash + "]"); if (oEffect is Plugin) { //(new Logger()).WriteNotice("program.cs:EffectCover:Dispose: part8 [hash this: " + nHash + "]"); Plugin cPlugin = (Plugin)oEffect; //(new Logger()).WriteNotice("program.cs:EffectCover:Dispose: part81 [hash this: " + nHash + "]"); cPlugin.Prepared -= new plugins.EventDelegate(OnEffectPrepared); //(new Logger()).WriteNotice("program.cs:EffectCover:Dispose: part82 [hash this: " + nHash + "]"); cPlugin.Started -= new plugins.EventDelegate(OnEffectStarted); //(new Logger()).WriteNotice("program.cs:EffectCover:Dispose: part83 [hash this: " + nHash + "]"); cPlugin.Stopped -= new plugins.EventDelegate(OnEffectStopped); //(new Logger()).WriteNotice("program.cs:EffectCover:Dispose: part84 [hash this: " + nHash + "]"); cPlugin.Dispose(); } //(new Logger()).WriteNotice("program.cs:EffectCover:Dispose: part9 [hash this: " + nHash + "]"); (new Logger()).WriteNotice("effect disposed: [hc:" + this.GetHashCode() + "][name:" + this.sType + "][info:" + this.sInfo + "][status:" + this.eStatus + "]"); }