From f886ab3ac24e2f11797db98ea85746ef88aa9f5e Mon Sep 17 00:00:00 2001 From: Armin Hafizovic Date: Sat, 20 Jan 2018 08:17:11 +0100 Subject: [PATCH] Removed the Controls and Hosts projects --- .../FlashTemplateHostControl.Designer.cs | 59 --- .../FlashTemplateHostControl.cs | 399 ------------------ .../FlashTemplateHostControl.resx | 120 ------ .../Properties/AssemblyInfo.cs | 36 -- .../ShockwaveFlashControl.Designer.cs | 62 --- .../ShockwaveFlashControl.cs | 20 - .../ShockwaveFlashControl.resx | 133 ------ .../Svt.Caspar.Controls.csproj | 168 -------- .../CasparChannelInformation.cs | 40 -- .../CasparChannelInformationList.cs | 10 - src/Svt.Caspar.Hosts/CasparHostsManager.cs | 336 --------------- .../Properties/AssemblyInfo.cs | 36 -- src/Svt.Caspar.Hosts/Svt.Caspar.Hosts.csproj | 83 ---- 13 files changed, 1502 deletions(-) delete mode 100644 src/Svt.Caspar.Controls/FlashTemplateHostControl.Designer.cs delete mode 100644 src/Svt.Caspar.Controls/FlashTemplateHostControl.cs delete mode 100644 src/Svt.Caspar.Controls/FlashTemplateHostControl.resx delete mode 100644 src/Svt.Caspar.Controls/Properties/AssemblyInfo.cs delete mode 100644 src/Svt.Caspar.Controls/ShockwaveFlashControl.Designer.cs delete mode 100644 src/Svt.Caspar.Controls/ShockwaveFlashControl.cs delete mode 100644 src/Svt.Caspar.Controls/ShockwaveFlashControl.resx delete mode 100644 src/Svt.Caspar.Controls/Svt.Caspar.Controls.csproj delete mode 100644 src/Svt.Caspar.Hosts/CasparChannelInformation.cs delete mode 100644 src/Svt.Caspar.Hosts/CasparChannelInformationList.cs delete mode 100644 src/Svt.Caspar.Hosts/CasparHostsManager.cs delete mode 100644 src/Svt.Caspar.Hosts/Properties/AssemblyInfo.cs delete mode 100644 src/Svt.Caspar.Hosts/Svt.Caspar.Hosts.csproj diff --git a/src/Svt.Caspar.Controls/FlashTemplateHostControl.Designer.cs b/src/Svt.Caspar.Controls/FlashTemplateHostControl.Designer.cs deleted file mode 100644 index 056f52a..0000000 --- a/src/Svt.Caspar.Controls/FlashTemplateHostControl.Designer.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System.Drawing; -namespace Svt.Caspar.Controls -{ - partial class FlashTemplateHostControl - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.shockwaveFlashControl1 = new Svt.Caspar.Controls.ShockwaveFlashControl(); - this.SuspendLayout(); - // - // shockwaveFlashControl1 - // - this.shockwaveFlashControl1.Location = new System.Drawing.Point(0, 0); - this.shockwaveFlashControl1.Name = "shockwaveFlashControl1"; - this.shockwaveFlashControl1.Size = new System.Drawing.Size(315, 254); - this.shockwaveFlashControl1.TabIndex = 0; - // - // FlashTemplateHostControl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.shockwaveFlashControl1); - this.Name = "FlashTemplateHostControl"; - this.Size = new System.Drawing.Size(315, 254); - this.SizeChanged += new System.EventHandler(this.control_Resize); - this.ResumeLayout(false); - - } - - #endregion - - private ShockwaveFlashControl shockwaveFlashControl1; - - } -} diff --git a/src/Svt.Caspar.Controls/FlashTemplateHostControl.cs b/src/Svt.Caspar.Controls/FlashTemplateHostControl.cs deleted file mode 100644 index 6b61e6c..0000000 --- a/src/Svt.Caspar.Controls/FlashTemplateHostControl.cs +++ /dev/null @@ -1,399 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; - -using System.Text; -using System.Windows.Forms; - -namespace Svt.Caspar.Controls -{ - - public partial class FlashTemplateHostControl : UserControl - { - //") << layer << TEXT("") << templateName << TEXT("") << (playOnLoad?TEXT(""):TEXT("")) << TEXT("") << label << TEXT(""); - private const string AddRequestTemplate = "$LAYER$$TEMPLATE$$MIXDURATION$$PLAY$$LABEL$ "; - private const string RemoveRequestTemplate = "$LAYER$"; - private const string PlayRequestTemplate = "$LAYER$"; - private const string StopRequestTemplate = "$LAYER$$MIXDURATION$"; - private const string NextRequestTemplate = "$LAYER$"; - private const string UpdateRequestTemplate = "$LAYER$"; - private const string GotoRequestTemplate = "$LAYER$$LABEL$"; - private const string InvokeRequestTemplate = "$LAYER$$METHOD$"; - - private const string AddRequestTemplate17 = "$LAYER$$TEMPLATE$$PLAY$$LABEL$ "; - private const string RemoveRequestTemplate17 = "$LAYER$"; - private const string PlayRequestTemplate17 = "$LAYER$"; - private const string StopRequestTemplate17 = "$LAYER$$MIXDURATION$"; - private const string NextRequestTemplate17 = "$LAYER$"; - private const string UpdateRequestTemplate17 = "$LAYER$"; - private const string GotoRequestTemplate17 = "$LAYER$$LABEL$"; - private const string InvokeRequestTemplate17 = "$LAYER$$METHOD$"; - - public FlashTemplateHostControl() - { - InitializeComponent(); - - PrepareNewFlash(); - - TemplateFolder = Environment.CurrentDirectory; - AspectControl = Aspects.Aspect169; - } - - Svt.Caspar.Controls.ShockwaveFlashControl newFlashControl = null; - public void PrepareNewFlash() - { - //this.shockwaveFlashControl1.Location = new System.Drawing.Point(25, 24); - //this.shockwaveFlashControl1.Size = new System.Drawing.Size(265, 202); - this.shockwaveFlashControl1.FlashActiveX.BackgroundColor = Color.FromArgb(0, bgColor).ToArgb(); - if (!string.IsNullOrEmpty(templateHost_) && System.IO.File.Exists(templateHost_)) - this.shockwaveFlashControl1.FlashActiveX.Movie = templateHost_; - - control_Resize(this, EventArgs.Empty); - } - - private Color bgColor; - public Color BackgroundColor - { - set { bgColor = value; shockwaveFlashControl1.FlashActiveX.BackgroundColor = Color.FromArgb(0, bgColor).ToArgb(); } - get { return bgColor; } - } - - string templateHost_ = string.Empty; - [Browsable(false)] - public string TemplateHost - { - get { return templateHost_; } - set - { - templateHost_ = value; - if (!string.IsNullOrEmpty(value) && System.IO.File.Exists(templateHost_)) - { - templateFolder_ = System.IO.Path.GetDirectoryName(templateHost_); - shockwaveFlashControl1.FlashActiveX.Movie = templateHost_; - - if(templateHost_.EndsWith("18")) - Version = Versions.Version18; - else if(templateHost_.EndsWith("17")) - Version = Versions.Version17; - else - Version = Versions.Version16; - - Valid = true; - } - else - Valid = false; - } - } - - string templateFolder_ = string.Empty; - [Browsable(false)] - public string TemplateFolder - { - get - { - return templateFolder_; - } - set - { - if (!string.IsNullOrEmpty(value)) - { - try - { - string[] files = System.IO.Directory.GetFiles(value, "cg.fth*"); - if (files != null && files.Length > 0) - { - for (int i = 0; i < files.Length; ++i) - files[i] = files[i].ToUpper(); - - Array.Sort(files); - - for (int i = files.Length - 1; i >= 0; --i) - { - if (System.IO.Path.GetFileName(files[i]).Length <= 9) - { - TemplateHost = files[i]; - break; - } - } - } - } - catch { } - } - } - } - - public void Clear() - { - PrepareNewFlash(); - } - - [Obsolete("use ICGDataContainer for CGData instead", false)] - public bool Add(Svt.Caspar.CasparCGItem item) - { - if(item != null) - return Add(item, item.Layer); - return false; - } - - [Obsolete("use ICGDataContainer for CGData instead", false)] - public bool Add(Svt.Caspar.CasparCGItem item, int layer) - { - if (item != null) - { - string fullFilename = System.IO.Path.GetFullPath(System.IO.Path.Combine(TemplateFolder, item.TemplateIdentifier)); - - if (System.IO.File.Exists(fullFilename + ".ft")) - { - string dataxml = Svt.Caspar.CGDataPair.ToXml(item.Data); - string template = (Version == Versions.Version18) ? (item.TemplateIdentifier) : fullFilename + ".ft"; - StringBuilder request = new StringBuilder((Version == Versions.Version17 || Version == Versions.Version18) ? AddRequestTemplate17 : AddRequestTemplate, dataxml.Length + AddRequestTemplate.Length); - request.Replace("$LAYER$", layer.ToString()); - request.Replace("$TEMPLATE$", template); - request.Replace("$MIXDURATION$", "0"); - request.Replace("$PLAY$", ""); - request.Replace("$LABEL$", string.Empty); - request.Replace("$DATA$", dataxml); - - InvokeFlashCall(request.ToString()); - return true; - } - } - return false; - } - public bool Add(int layer, string template) - { - return Add(layer, template, false, string.Empty); - } - public bool Add(int layer, string template, bool bPlayOnLoad) - { - return Add(layer, template, bPlayOnLoad, string.Empty); - } - public bool Add(int layer, string template, ICGDataContainer data) - { - return Add(layer, template, false, (data != null) ? data.ToXml() : string.Empty); - } - public bool Add(int layer, string template, bool bPlayOnLoad, ICGDataContainer data) - { - return Add(layer, template, bPlayOnLoad, (data != null) ? data.ToXml() : string.Empty); - } - public bool Add(int layer, string template, string data) - { - return Add(layer, template, false, data); - } - public bool Add(int layer, string template, bool bPlayOnLoad, string data) - { - string fullFilename = System.IO.Path.GetFullPath(System.IO.Path.Combine(TemplateFolder, template)); - - if (System.IO.File.Exists(fullFilename + ".ft")) - { - StringBuilder request = new StringBuilder((Version == Versions.Version17 || Version == Versions.Version18) ? AddRequestTemplate17 : AddRequestTemplate, data.Length + AddRequestTemplate.Length); - template = (Version == Versions.Version18) ? (template + ".ft") : fullFilename; - request.Replace("$LAYER$", layer.ToString()); - request.Replace("$TEMPLATE$", template); - request.Replace("$MIXDURATION$", "0"); - request.Replace("$PLAY$", ""); - request.Replace("$LABEL$", string.Empty); - request.Replace("$DATA$", data); - - InvokeFlashCall(request.ToString()); - return true; - } - return false; - } - - public void Remove(int layer) - { - StringBuilder request = new StringBuilder((Version == Versions.Version17 || Version == Versions.Version18) ? RemoveRequestTemplate17 : RemoveRequestTemplate); - request.Replace("$LAYER$", layer.ToString()); - - InvokeFlashCall(request.ToString()); - } - - public void Play(int layer) - { - StringBuilder request = new StringBuilder((Version == Versions.Version17 || Version == Versions.Version18) ? PlayRequestTemplate17 : PlayRequestTemplate); - request.Replace("$LAYER$", layer.ToString()); - - InvokeFlashCall(request.ToString()); - } - - public void Stop(int layer) - { - Stop(layer, 0); - } - - public void Stop(int layer, int mixDuration) - { - StringBuilder request = new StringBuilder((Version == Versions.Version17 || Version == Versions.Version18) ? StopRequestTemplate17 : StopRequestTemplate); - request.Replace("$LAYER$", layer.ToString()); - request.Replace("$MIXDURATION$", mixDuration.ToString()); - - InvokeFlashCall(request.ToString()); - } - - public void Next(int layer) - { - StringBuilder request = new StringBuilder((Version == Versions.Version17 || Version == Versions.Version18) ? NextRequestTemplate17 : NextRequestTemplate); - request.Replace("$LAYER$", layer.ToString()); - - InvokeFlashCall(request.ToString()); - } - - [Obsolete("use ICGDataContainer for CGData instead", false)] - public void Update(Svt.Caspar.CasparCGItem item) - { - if (item != null) - { - string dataxml = Svt.Caspar.CGDataPair.ToXml(item.Data); - StringBuilder request = new StringBuilder((Version == Versions.Version17 || Version == Versions.Version18) ? UpdateRequestTemplate17 : UpdateRequestTemplate, dataxml.Length + UpdateRequestTemplate.Length); - request.Replace("$LAYER$", item.Layer.ToString()); - request.Replace("$DATA$", dataxml); - - InvokeFlashCall(request.ToString()); - } - } - - public void Goto(int layer, string label) - { - StringBuilder request = new StringBuilder((Version == Versions.Version17 || Version == Versions.Version18) ? GotoRequestTemplate17 : GotoRequestTemplate); - request.Replace("$LAYER$", layer.ToString()); - request.Replace("$LABEL$", label); - - InvokeFlashCall(request.ToString()); - } - - public void InvokeMethod(int layer, string method) - { - StringBuilder request = new StringBuilder((Version == Versions.Version17 || Version == Versions.Version18) ? InvokeRequestTemplate17 : InvokeRequestTemplate); - request.Replace("$LAYER$", layer.ToString()); - request.Replace("$METHOD$", method); - - InvokeFlashCall(request.ToString()); - } - - public bool Valid { get; set; } - - private void InvokeFlashCall(string request) - { - try - { - if(Valid) - shockwaveFlashControl1.FlashActiveX.CallFunction(request); - } - catch (Exception e) - { - MessageBox.Show(e.Message); - } - } - - public Versions Version - { - get; - set; - } - - public static string GetVersionString(Versions v) - { - if(v == Versions.Version16) return "v1.6"; - if(v == Versions.Version17) return "v1.7"; - if(v == Versions.Version18) return "v1.8"; - return "unknown"; - } - - public enum Versions - { - Version16 = 0, - Version17, - Version18 - } - - public enum ScaleModes - { - FullScreen, - Unknown1, - Fit - } - - public ScaleModes ScaleMode - { - set - { - shockwaveFlashControl1.FlashActiveX.ScaleMode = (int)value; - } - - get - { - return (ScaleModes)shockwaveFlashControl1.FlashActiveX.ScaleMode; - } - } - - public enum Aspects - { - None, - Aspect169, - Aspect43 - } - - Aspects aspect; - public Aspects AspectControl - { - get { return aspect; } - set - { - aspect = value; - control_Resize(this, EventArgs.Empty); - } - } - - public Control FlashControl - { - get { return shockwaveFlashControl1; } - } - #region Aspectcontrol - - private void control_Resize(object sender, EventArgs e) - { - Control container = (Control)sender; - Size bounds = container.Size; - - Size finalSize = new Size(0, 0); - - //Calculate largest aspect-correct rect for the flashcontrol - if (AspectControl == Aspects.Aspect169) - finalSize = GetLargestAspectCorrectRect(bounds, new Size(16, 9)); - else if (AspectControl == Aspects.Aspect43) - finalSize = GetLargestAspectCorrectRect(bounds, new Size(4, 3)); - else - finalSize = bounds; - - //Position the control - Point position = new Point(); - position.X = bounds.Width / 2 - finalSize.Width / 2; - position.Y = bounds.Height / 2 - finalSize.Height / 2; - - shockwaveFlashControl1.Size = finalSize; - shockwaveFlashControl1.Location = position; - } - - private Size GetLargestAspectCorrectRect(Size bounds, Size aspect) - { - Size finalSize = new Size(); - if (bounds.Width / aspect.Width < bounds.Height / aspect.Height) - { - finalSize.Width = (bounds.Width / aspect.Width) * aspect.Width; - finalSize.Height = (bounds.Width / aspect.Width) * aspect.Height; - } - else - { - finalSize.Height = (bounds.Height / aspect.Height) * aspect.Height; - finalSize.Width = (bounds.Height / aspect.Height) * aspect.Width; - } - - return finalSize; - } - #endregion - - } -} diff --git a/src/Svt.Caspar.Controls/FlashTemplateHostControl.resx b/src/Svt.Caspar.Controls/FlashTemplateHostControl.resx deleted file mode 100644 index ff31a6d..0000000 --- a/src/Svt.Caspar.Controls/FlashTemplateHostControl.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/src/Svt.Caspar.Controls/Properties/AssemblyInfo.cs b/src/Svt.Caspar.Controls/Properties/AssemblyInfo.cs deleted file mode 100644 index f9e6513..0000000 --- a/src/Svt.Caspar.Controls/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Svt.Caspar.Controls")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Sveriges Television AB")] -[assembly: AssemblyProduct("Svt.Caspar.Controls")] -[assembly: AssemblyCopyright("Copyright © Sveriges Television AB 2008")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("39d6da6f-41d0-45c6-a898-b79601fc5b0c")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Svt.Caspar.Controls/ShockwaveFlashControl.Designer.cs b/src/Svt.Caspar.Controls/ShockwaveFlashControl.Designer.cs deleted file mode 100644 index 2bfbb12..0000000 --- a/src/Svt.Caspar.Controls/ShockwaveFlashControl.Designer.cs +++ /dev/null @@ -1,62 +0,0 @@ -namespace Svt.Caspar.Controls -{ - partial class ShockwaveFlashControl - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ShockwaveFlashControl)); - this.axShockwaveFlash1 = new AxShockwaveFlashObjects.AxShockwaveFlash(); - ((System.ComponentModel.ISupportInitialize)(this.axShockwaveFlash1)).BeginInit(); - this.SuspendLayout(); - // - // axShockwaveFlash1 - // - this.axShockwaveFlash1.Dock = System.Windows.Forms.DockStyle.Fill; - this.axShockwaveFlash1.Enabled = true; - this.axShockwaveFlash1.Location = new System.Drawing.Point(0, 0); - this.axShockwaveFlash1.Name = "axShockwaveFlash1"; - this.axShockwaveFlash1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axShockwaveFlash1.OcxState"))); - this.axShockwaveFlash1.Size = new System.Drawing.Size(311, 269); - this.axShockwaveFlash1.TabIndex = 0; - // - // ShockwaveFlashControl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.axShockwaveFlash1); - this.Name = "ShockwaveFlashControl"; - this.Size = new System.Drawing.Size(311, 269); - ((System.ComponentModel.ISupportInitialize)(this.axShockwaveFlash1)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private AxShockwaveFlashObjects.AxShockwaveFlash axShockwaveFlash1; - } -} diff --git a/src/Svt.Caspar.Controls/ShockwaveFlashControl.cs b/src/Svt.Caspar.Controls/ShockwaveFlashControl.cs deleted file mode 100644 index ad18c27..0000000 --- a/src/Svt.Caspar.Controls/ShockwaveFlashControl.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Text; -using System.Windows.Forms; - -namespace Svt.Caspar.Controls -{ - public partial class ShockwaveFlashControl : UserControl - { - public ShockwaveFlashControl() - { - InitializeComponent(); - } - - public AxShockwaveFlashObjects.AxShockwaveFlash FlashActiveX { get { return axShockwaveFlash1; } } - } -} diff --git a/src/Svt.Caspar.Controls/ShockwaveFlashControl.resx b/src/Svt.Caspar.Controls/ShockwaveFlashControl.resx deleted file mode 100644 index 6fc2fc7..0000000 --- a/src/Svt.Caspar.Controls/ShockwaveFlashControl.resx +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w - LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFTeXN0 - ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAALQEAAAIB - AAAAAQAAAAAAAAAAAAAAABgBAABnVWZVAAkAACUgAADNGwAACAACAAAAAAAIAAAAAAAIAAAAAAAIAA4A - AABXAGkAbgBkAG8AdwAAAAgABgAAAC0AMQAAAAgABgAAAC0AMQAAAAgACgAAAEgAaQBnAGgAAAAIAAIA - AAAAAAgABgAAAC0AMQAAAAgAAAAAAAgAAgAAAAAACAAQAAAAUwBoAG8AdwBBAGwAbAAAAAgABAAAADAA - AAAIAAQAAAAwAAAACAACAAAAAAAIAAAAAAAIAAIAAAAAAA0AAAAAAAAAAAAAAAAAAAAAAAgABAAAADEA - AAAIAAQAAAAwAAAACAAAAAAACAAEAAAAMAAAAAgACAAAAGEAbABsAAAACAAMAAAAZgBhAGwAcwBlAAAA - Cw== - - - \ No newline at end of file diff --git a/src/Svt.Caspar.Controls/Svt.Caspar.Controls.csproj b/src/Svt.Caspar.Controls/Svt.Caspar.Controls.csproj deleted file mode 100644 index 39ce77a..0000000 --- a/src/Svt.Caspar.Controls/Svt.Caspar.Controls.csproj +++ /dev/null @@ -1,168 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {D5CEE141-6C59-4837-A576-21BA098CC813} - Library - Properties - Svt.Caspar.Controls - Svt.Caspar.Controls - v3.5 - 512 - - - 3.5 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - true - bin\Develop\ - DEBUG;TRACE - full - AnyCPU - prompt - - - true - bin\x86\Debug\ - DEBUG;TRACE - full - x86 - prompt - true - true - false - - - bin\x86\Release\ - TRACE - true - pdbonly - x86 - prompt - false - false - false - - - true - bin\x86\Develop\ - DEBUG;TRACE - full - x86 - prompt - false - false - - - true - bin\x64\Debug\ - DEBUG;TRACE - full - x64 - prompt - true - true - false - - - bin\x64\Release\ - TRACE - true - pdbonly - x64 - prompt - false - false - false - - - true - bin\x64\Develop\ - DEBUG;TRACE - full - x64 - prompt - false - false - false - - - - ..\..\lib\AxInterop.ShockwaveFlashObjects.dll - - - ..\..\lib\Interop.ShockwaveFlashObjects.dll - True - - - - - - - - - - UserControl - - - FlashTemplateHostControl.cs - - - - UserControl - - - ShockwaveFlashControl.cs - - - - - - FlashTemplateHostControl.cs - Designer - - - ShockwaveFlashControl.cs - - - - - {9B56A150-ECE3-4099-AEA1-0F8E115DC374} - Svt.Caspar - - - - - - - - - \ No newline at end of file diff --git a/src/Svt.Caspar.Hosts/CasparChannelInformation.cs b/src/Svt.Caspar.Hosts/CasparChannelInformation.cs deleted file mode 100644 index 0ff74d5..0000000 --- a/src/Svt.Caspar.Hosts/CasparChannelInformation.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Svt.Caspar.Hosts -{ - public class CasparChannelInformation - { - public CasparChannelInformation() - { - Label = Hostname = string.Empty; - Port = 5250; - Channel = 1; - Online = false; - ArgbValue = 0; - } - - public CasparChannelInformation(string hostname, ushort port, ushort channel, string label, int argb) - { - Hostname = hostname; - Port = port; - Channel = channel; - Label = label; - Online = false; - ArgbValue = argb; - } - - public string Label { get; set; } - public string Hostname { get; set; } - public ushort Port { get; set; } - public ushort Channel { get; set; } - public bool Online { get; set; } - public int ArgbValue { get; set; } - - public override string ToString() - { - return Label + ": (" + Hostname + ":" + Port + ", channel " + Channel + ")"; - } - } -} diff --git a/src/Svt.Caspar.Hosts/CasparChannelInformationList.cs b/src/Svt.Caspar.Hosts/CasparChannelInformationList.cs deleted file mode 100644 index 11543d8..0000000 --- a/src/Svt.Caspar.Hosts/CasparChannelInformationList.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Svt.Caspar.Hosts -{ - public class CasparChannelInformationList : List - { - } -} \ No newline at end of file diff --git a/src/Svt.Caspar.Hosts/CasparHostsManager.cs b/src/Svt.Caspar.Hosts/CasparHostsManager.cs deleted file mode 100644 index 3218098..0000000 --- a/src/Svt.Caspar.Hosts/CasparHostsManager.cs +++ /dev/null @@ -1,336 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -using Svt.Caspar; - -namespace Svt.Caspar.Hosts -{ - public class CasparHostsManager - { - public event EventHandler UpdatedMediafiles; - public event EventHandler UpdatedTemplates; - - Dictionary devices_; - Dictionary channelInfos_; - - public void SetChannels(CasparChannelInformationList channels) - { - if (channels != null) - { - Dictionary newDevices = new Dictionary(); - Dictionary newChannelInfos = new Dictionary(); - foreach (CasparChannelInformation channelInfo in channels) - { - if (!newDevices.ContainsKey(channelInfo.Hostname)) - { - DeviceHolder device = null; - - //Get device from old collection or create new - if (devices_ != null && devices_.ContainsKey(channelInfo.Hostname)) - { - device = devices_[channelInfo.Hostname]; - devices_.Remove(channelInfo.Hostname); - - device.Channels.Clear(); - } - else - device = CreateDevice(channelInfo.Hostname, channelInfo.Port); - - //add device to new collection - if (device != null) - { - device.Channels.Add(channelInfo); - channelInfo.Online = device.HasValidConnection; - newDevices.Add(channelInfo.Hostname, device); - } - - } - else - { - newDevices[channelInfo.Hostname].Channels.Add(channelInfo); - channelInfo.Online = newDevices[channelInfo.Hostname].HasValidConnection; - } - - newChannelInfos.Add(channelInfo.Label, channelInfo); - } - - if (connected) - { - //disconnect from unused devices - if (devices_ != null) - { - foreach (DeviceHolder device in devices_.Values) - { - device.CasparDevice.Disconnect(); - } - } - - //connect to new devices - foreach (DeviceHolder device in newDevices.Values) - { - if (!device.CasparDevice.IsConnected) - device.CasparDevice.Connect(); - } - } - - //set new collection as current - System.Threading.Interlocked.Exchange>(ref devices_, newDevices); - System.Threading.Interlocked.Exchange>(ref channelInfos_, newChannelInfos); - - UpdateValidConnections(); - } - } - - bool connected = false; - public void Connect() - { - connected = true; - if (devices_ != null) - { - foreach (DeviceHolder device in devices_.Values) - device.CasparDevice.Connect(); - } - } - - public void Disconnect() - { - connected = false; - if (devices_ != null) - { - foreach (DeviceHolder device in devices_.Values) - device.CasparDevice.Disconnect(); - } - } - - public bool HasChannels { get { return channelInfos_.Count > 0; } } - - public IEnumerable ChannelInfos - { - get - { - return (channelInfos_ != null) ? channelInfos_.Values : null; - } - } - public CasparChannelInformation GetChannelInfo(string label) - { - return (channelInfos_ != null && channelInfos_.ContainsKey(label)) ? channelInfos_[label] : null; - } - public Channel GetChannel(string label) - { - if (channelInfos_ != null && channelInfos_.ContainsKey(label)) - { - CasparChannelInformation info = channelInfos_[label]; - if (devices_ != null && devices_.ContainsKey(info.Hostname)) - { - DeviceHolder device = devices_[info.Hostname]; - if ((device.CasparDevice.Channels.Count >= info.Channel) && (info.Channel > 0)) - return device.CasparDevice.Channels[info.Channel - 1]; - } - } - return null; - } - - public IEnumerable Devices - { - get - { - return (devices_ != null) ? devices_.Values : null; - } - } - public DeviceHolder GetDevice(string hostname) - { - return (devices_ != null && devices_.ContainsKey(hostname)) ? devices_[hostname] : null; - } - - private DeviceHolder CreateDevice(string hostname, int port) - { - CasparDevice casparDevice = new CasparDevice(); - casparDevice.Settings.Hostname = hostname; - casparDevice.Settings.Port = port; - casparDevice.Connected += new EventHandler(caspar_Connected); - casparDevice.Disconnected += new EventHandler(caspar_Disconnected); - casparDevice.FailedConnect += new EventHandler(caspar_FailedConnect); - casparDevice.OnAsyncException += new EventHandler(casparDevice_OnAsyncException); - casparDevice.UpdatedChannels += new EventHandler(caspar_UpdatedChannels); - casparDevice.UpdatedTemplates += new EventHandler(caspar_UpdatedTemplates); - casparDevice.UpdatedMediafiles += new EventHandler(caspar_UpdatedMediafiles); - - return new DeviceHolder(casparDevice); - } - - ValidHostsConnections hasValidConnections = ValidHostsConnections.None; - public ValidHostsConnections HasValidConnections - { - get { return hasValidConnections; } - } - void UpdateValidConnections() - { - if (devices_ != null) - { - bool bAllConnected = true, bAllDisconnected = true; - foreach (DeviceHolder device in devices_.Values) - { - if (device.HasValidConnection) - bAllDisconnected = false; - else - bAllConnected = false; - } - - if (bAllConnected) - hasValidConnections = ValidHostsConnections.All; - else if (bAllDisconnected) - hasValidConnections = ValidHostsConnections.None; - else - hasValidConnections = ValidHostsConnections.Some; - } - else - hasValidConnections = ValidHostsConnections.None; - } - - #region caspar events - void caspar_Connected(object sender, Svt.Network.NetworkEventArgs e) - { - CasparDevice casparDevice = (CasparDevice)sender; - casparDevice.RefreshMediafiles(); - } - - void caspar_FailedConnect(object sender, Svt.Network.NetworkEventArgs e) - { - CasparDevice casparDevice = (CasparDevice)sender; - if (casparDevice != null && devices_.ContainsKey(casparDevice.Settings.Hostname)) - { - devices_[casparDevice.Settings.Hostname].HasValidConnection = false; - UpdateValidConnections(); - } - } - - void casparDevice_OnAsyncException(object sender, Svt.Network.ExceptionEventArgs e) - { - CasparDevice casparDevice = (CasparDevice)sender; - if (casparDevice != null && devices_.ContainsKey(casparDevice.Settings.Hostname)) - { - devices_[casparDevice.Settings.Hostname].HasValidConnection = false; - UpdateValidConnections(); - } - } - - void caspar_Disconnected(object sender, Svt.Network.NetworkEventArgs e) - { - CasparDevice casparDevice = (CasparDevice)sender; - if (casparDevice != null && devices_.ContainsKey(casparDevice.Settings.Hostname)) - { - devices_[casparDevice.Settings.Hostname].HasValidConnection = false; - UpdateValidConnections(); - } - } - - void caspar_UpdatedChannels(object sender, EventArgs e) - { - CasparDevice casparDevice = (CasparDevice)sender; - if (casparDevice != null && devices_.ContainsKey(casparDevice.Settings.Hostname)) - { - devices_[casparDevice.Settings.Hostname].HasValidConnection = true; - UpdateValidConnections(); - } - } - - private void caspar_UpdatedMediafiles(object sender, EventArgs e) - { - try - { - CasparDevice casparDevice = (CasparDevice)sender; - if (devices_ != null && devices_.ContainsKey(casparDevice.Settings.Hostname)) - { - OnUpdatedMediafiles(devices_[casparDevice.Settings.Hostname]); - } - } - catch { } - } - private void caspar_UpdatedTemplates(object sender, EventArgs e) - { - try - { - CasparDevice casparDevice = (CasparDevice)sender; - if (devices_ != null && devices_.ContainsKey(casparDevice.Settings.Hostname)) - { - OnUpdatedTemplates(devices_[casparDevice.Settings.Hostname]); - } - } - catch { } - } - #endregion - - protected void OnUpdatedMediafiles(DeviceHolder device) - { - if (UpdatedMediafiles != null) - UpdatedMediafiles(this, new HostEventArgs(device)); - } - protected void OnUpdatedTemplates(DeviceHolder device) - { - if (UpdatedTemplates != null) - UpdatedTemplates(this, new HostEventArgs(device)); - } - } - - public class HostEventArgs : EventArgs - { - internal HostEventArgs(DeviceHolder device) - { - Device = device; - } - public DeviceHolder Device { get; set; } - } - - public enum ValidHostsConnections - { - None, - Some, - All - } - - public class DeviceHolder - { - public event EventHandler VaildConnectionChanged; - - public DeviceHolder(CasparDevice device) - { - CasparDevice = device; - Channels = new List(); - } - - internal CasparDevice CasparDevice { get; private set; } - public string Hostname { get { return CasparDevice.Settings.Hostname; } } - public List Files { get { return CasparDevice.Mediafiles; } } - public TemplatesCollection Templates { get { return CasparDevice.Templates; } } - public List Channels { get; private set; } - bool hasVaildConnection_ = false; - public bool HasValidConnection - { - get { return hasVaildConnection_; } - set - { - hasVaildConnection_ = value; - OnValidConnectionChanged(); - } - } - - protected void OnValidConnectionChanged() - { - foreach (CasparChannelInformation info in Channels) - info.Online = hasVaildConnection_; - - if (VaildConnectionChanged != null) - VaildConnectionChanged(this, EventArgs.Empty); - } - - public void RefreshTemplates() - { - CasparDevice.RefreshTemplates(); - } - public void RefreshMediafiles() - { - CasparDevice.RefreshMediafiles(); - } - } -} diff --git a/src/Svt.Caspar.Hosts/Properties/AssemblyInfo.cs b/src/Svt.Caspar.Hosts/Properties/AssemblyInfo.cs deleted file mode 100644 index 394b8a6..0000000 --- a/src/Svt.Caspar.Hosts/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Svt.Caspar.Hosts")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Sveriges Television AB")] -[assembly: AssemblyProduct("Svt.Caspar.Hosts")] -[assembly: AssemblyCopyright("Copyright © Sveriges Television AB 2009")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("17eaade6-61a3-41b5-b95f-81871b343869")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Svt.Caspar.Hosts/Svt.Caspar.Hosts.csproj b/src/Svt.Caspar.Hosts/Svt.Caspar.Hosts.csproj deleted file mode 100644 index 6d36c0b..0000000 --- a/src/Svt.Caspar.Hosts/Svt.Caspar.Hosts.csproj +++ /dev/null @@ -1,83 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {A3281EF0-A565-4CC5-8037-34FB1DDC2974} - Library - Properties - Svt.Caspar.Hosts - Svt.Caspar.Hosts - v3.5 - 512 - - - 3.5 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - true - bin\x86\Debug\ - DEBUG;TRACE - full - x86 - prompt - - - bin\x86\Release\ - TRACE - true - pdbonly - x86 - prompt - - - - - - - - - - - - - - - {9B56A150-ECE3-4099-AEA1-0F8E115DC374} - Svt.Caspar - - - {941ED6A5-C8DF-459D-BFCE-5C6ED9AC0492} - Svt.Network - - - - - \ No newline at end of file