diff --git a/.gitignore b/.gitignore index 985e5b80..1c8ad5ff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,205 @@ -obj/ -bin/Debug/ \ No newline at end of file +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +build/ +bld/ +[Bb]in/ +[Oo]bj/ + +# Visual Studio 2015 cache/options directory +.vs/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config + +# Windows Azure Build Output +csx/ +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt \ No newline at end of file diff --git a/Logic/ApplicationSettings.cs b/Logic/ApplicationSettings.cs index bd1cd789..52a06a0a 100644 --- a/Logic/ApplicationSettings.cs +++ b/Logic/ApplicationSettings.cs @@ -37,15 +37,15 @@ public class ApplicationSettings private static string _default = "default"; // Application Specific Settings we want to protect - private string _clientVersion = "1.7.4"; + private string _clientVersion = "1.7.5"; private string _version = "4"; - private int _clientCodeVersion = 108; + private int _clientCodeVersion = 109; public string ClientVersion { get { return _clientVersion; } } public string Version { get { return _version; } } public int ClientCodeVersion { get { return _clientCodeVersion; } } - private static readonly DateTime unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); + private static readonly DateTime unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Local); public static ApplicationSettings Default { @@ -121,6 +121,7 @@ public object this[string propertyName] } public int XmdsResetTimeout { get; set; } + public double CmsTimeOffset { get; set; } public decimal SizeX { get; set; } public decimal SizeY { get; set; } @@ -173,9 +174,14 @@ public DateTime DownloadStartWindowTime // Get the local time now and add our Unix timestamp to it. // We know that the DownloadStartWindow is saved in UTC (GMT to be precise, but no biggie) DateTime now = DateTime.Now; + DateTime start = unixEpoch.AddMilliseconds(DownloadStartWindow); // start is now UTC download window start. - DateTime start = unixEpoch.AddMilliseconds(DownloadStartWindow); + if (CmsTimeOffset != null && CmsTimeOffset != 0) + { + // Adjust for the timezone + start = start.AddHours(CmsTimeOffset); + } // Reset to local time, using the H:m:i from the Unix Time. // This gives us a local time @@ -191,6 +197,12 @@ public DateTime DownloadEndWindowTime DateTime now = DateTime.Now; DateTime end = unixEpoch.AddMilliseconds(DownloadEndWindow); + if (CmsTimeOffset != null && CmsTimeOffset != 0) + { + // Adjust for the timezone + end = end.AddHours(CmsTimeOffset); + } + // Reset to today return new DateTime(now.Year, now.Month, now.Day, end.Hour, end.Minute, end.Second, DateTimeKind.Local); } diff --git a/Logic/CacheManager.cs b/Logic/CacheManager.cs index 0df062c4..53e0d3f2 100644 --- a/Logic/CacheManager.cs +++ b/Logic/CacheManager.cs @@ -265,7 +265,7 @@ public bool IsValidLayout(string layoutFile) case "video": case "image": case "flash": - case "ppt": + case "powerpoint": // Get the path and see if its if (!IsValidPath(GetUri(media))) diff --git a/Logic/ScheduleManager.cs b/Logic/ScheduleManager.cs index a5ddddd4..fbaf791b 100644 --- a/Logic/ScheduleManager.cs +++ b/Logic/ScheduleManager.cs @@ -288,6 +288,16 @@ private Collection LoadNewSchdule() continue; } + // Check dependents + foreach (string dependent in layout.Dependents) + { + if (!_cacheManager.IsValidPath(dependent)) + { + Trace.WriteLine(new LogMessage("ScheduleManager - LoadNewSchedule", "Layout has invalid dependent: " + dependent), LogType.Info.ToString()); + continue; + } + } + // If this is the default, skip it if (layout.NodeName == "default") { @@ -388,6 +398,15 @@ private void LoadScheduleFromFile() // Add it to the layout schedule if (scheduleId != "") temp.scheduleid = int.Parse(scheduleId); + + // Dependents + if (attributes["dependents"] != null) + { + foreach (string dependent in attributes["dependents"].Value.Split(',')) + { + temp.Dependents.Add(dependent); + } + } } _layoutSchedule.Add(temp); @@ -522,7 +541,7 @@ private string LayoutsInSchedule() /// A LayoutSchedule /// [Serializable] - public struct LayoutSchedule + public class LayoutSchedule { public string NodeName; public string layoutFile; @@ -533,5 +552,7 @@ public struct LayoutSchedule public DateTime FromDt; public DateTime ToDt; + + public List Dependents = new List(); } } diff --git a/MainForm.cs b/MainForm.cs index 5327dbb6..f3853d15 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -323,17 +323,28 @@ private void MainForm_FormClosing(object sender, FormClosingEventArgs e) // We want to tidy up some stuff as this form closes. Trace.Listeners.Remove("ClientInfo TraceListener"); - // Close the client info screen - _clientInfoForm.Hide(); + try + { + // Close the client info screen + if (_clientInfoForm != null) + _clientInfoForm.Hide(); - // Stop the schedule object - _schedule.Stop(); + // Stop the schedule object + if (_schedule != null) + _schedule.Stop(); - // Flush the stats - _statLog.Flush(); + // Flush the stats + if (_statLog != null) + _statLog.Flush(); - // Write the CacheManager to disk - _cacheManager.WriteCacheManager(); + // Write the CacheManager to disk + if (_cacheManager != null) + _cacheManager.WriteCacheManager(); + } + catch (NullReferenceException) + { + // Stopped before we really started, nothing to do + } // Flush the logs Trace.Flush(); diff --git a/Media/CefWebMedia.cs b/Media/CefWebMedia.cs index 869c3105..659a12ff 100644 --- a/Media/CefWebMedia.cs +++ b/Media/CefWebMedia.cs @@ -28,8 +28,20 @@ public CefWebMedia(RegionOptions options) // and store them in member variables. _options = options; - // Set the file path - _filePath = ApplicationSettings.Default.LibraryPath + @"\" + _options.mediaid + ".htm"; + // Check to see if the mode option is present. + string modeId = options.Dictionary.Get("modeid"); + bool nativeOpen = modeId != string.Empty && modeId == "1"; + + if (nativeOpen) + { + // If we are modeid == 1, then just open the webpage without adjusting the file path + _filePath = Uri.UnescapeDataString(options.uri).Replace('+', ' '); + } + else + { + // Set the file path + _filePath = ApplicationSettings.Default.LibraryPath + @"\" + _options.mediaid + ".htm"; + } Color backgroundColor = ColorTranslator.FromHtml(_options.backgroundColor); @@ -45,16 +57,23 @@ public CefWebMedia(RegionOptions options) _webView.Size = Size; // Check to see if the HTML is ready for us. - if (HtmlReady()) + if (nativeOpen) { - // Write to temporary file - ReadControlMeta(); - _startWhenReady = true; } else { - RefreshFromXmds(); + if (HtmlReady()) + { + // Write to temporary file + ReadControlMeta(); + + _startWhenReady = true; + } + else + { + RefreshFromXmds(); + } } // We need to come up with a way of setting this control to Visible = false here and still kicking diff --git a/Media/IeWebMedia.cs b/Media/IeWebMedia.cs index e8a971ae..e3a3a7de 100644 --- a/Media/IeWebMedia.cs +++ b/Media/IeWebMedia.cs @@ -45,8 +45,20 @@ public IeWebMedia(RegionOptions options) // and store them in member variables. _options = options; - // Set the file path - _filePath = ApplicationSettings.Default.LibraryPath + @"\" + _options.mediaid + ".htm"; + // Check to see if the mode option is present. + string modeId = options.Dictionary.Get("modeid"); + bool nativeOpen = modeId != string.Empty && modeId == "1"; + + if (nativeOpen) + { + // If we are modeid == 1, then just open the webpage without adjusting the file path + _filePath = Uri.UnescapeDataString(options.uri).Replace('+', ' '); + } + else + { + // Set the file path + _filePath = ApplicationSettings.Default.LibraryPath + @"\" + _options.mediaid + ".htm"; + } // Create the web view we will use _webBrowser = new WebBrowser(); @@ -56,18 +68,26 @@ public IeWebMedia(RegionOptions options) _webBrowser.ScriptErrorsSuppressed = true; _webBrowser.Visible = false; - // Check to see if the HTML is ready for us. - if (HtmlReady()) + if (nativeOpen) { - // Write to temporary file - ReadControlMeta(); - - // Navigate to temp file + // Nativate directly _webBrowser.Navigate(_filePath); } else { - RefreshFromXmds(); + // Check to see if the HTML is ready for us. + if (HtmlReady()) + { + // Write to temporary file + ReadControlMeta(); + + // Navigate to temp file + _webBrowser.Navigate(_filePath); + } + else + { + RefreshFromXmds(); + } } Controls.Add(_webBrowser); diff --git a/Media/PowerPoint.cs b/Media/PowerPoint.cs index d41ae1fa..654eea95 100644 --- a/Media/PowerPoint.cs +++ b/Media/PowerPoint.cs @@ -23,6 +23,7 @@ using System.Windows.Forms; using System.Diagnostics; using System.Globalization; +using System.IO; namespace XiboClient { @@ -45,6 +46,7 @@ public PowerPoint(RegionOptions options) layoutId = options.layoutId; mediaId = options.mediaid; type = options.type; + _filePath = Uri.UnescapeDataString(options.uri).Replace('+', ' '); webBrowser = new WebBrowser(); webBrowser.Size = this.Size; @@ -63,23 +65,12 @@ public PowerPoint(RegionOptions options) { try { - // Try to make a URI out of the file path - try - { - _filePath = Uri.UnescapeDataString(options.uri).Replace('+', ' '); - } - catch (Exception ex) - { - Trace.WriteLine(new LogMessage("WebContent", "Unable to get a URI with exception: " + ex.Message), LogType.Audit.ToString()); - } - webBrowser.Navigate(_filePath); } catch (Exception ex) { - webBrowser.DocumentText = "

Unable to show this web location - invalid address.

"; - Trace.WriteLine(new LogMessage("WebContent", "Unable to show webpage. Exception: " + ex.Message, scheduleId, layoutId), LogType.Error.ToString()); + throw new InvalidOperationException("Cannot navigate to PowerPoint file"); } } diff --git a/Media/VideoPlayer.cs b/Media/VideoPlayer.cs index a4f0c589..74a81649 100644 --- a/Media/VideoPlayer.cs +++ b/Media/VideoPlayer.cs @@ -77,7 +77,10 @@ public void SetLooping(bool looping) public void SetMute(bool mute) { if (mute) + { + axWindowsMediaPlayer1.settings.volume = 0; axWindowsMediaPlayer1.settings.mute = true; + } else axWindowsMediaPlayer1.settings.volume = 100; } diff --git a/XiboClient.v11.suo b/XiboClient.v11.suo index 912970f8..a098a0bc 100644 Binary files a/XiboClient.v11.suo and b/XiboClient.v11.suo differ diff --git a/XmdsAgents/RegisterAgent.cs b/XmdsAgents/RegisterAgent.cs index 40431ffc..622a0b21 100644 --- a/XmdsAgents/RegisterAgent.cs +++ b/XmdsAgents/RegisterAgent.cs @@ -128,6 +128,17 @@ public static string ProcessRegisterXml(string xml) // Test the XML if (result.DocumentElement.Attributes["code"].Value == "READY") { + // Pull the CMS time and store it + try + { + DateTime cmsTime = DateTime.Parse(result.DocumentElement.Attributes["date"].Value); + ApplicationSettings.Default.CmsTimeOffset = (cmsTime - DateTime.Now).TotalHours; + } + catch + { + Trace.WriteLine(new LogMessage("Register", "CMS Date parse error"), LogType.Info.ToString()); + } + // Get the config element if (result.DocumentElement.ChildNodes.Count <= 0) throw new Exception("Configuration not set for this display"); diff --git a/XmdsAgents/RequiredFilesAgent.cs b/XmdsAgents/RequiredFilesAgent.cs index 1792a94d..63a8d9af 100644 --- a/XmdsAgents/RequiredFilesAgent.cs +++ b/XmdsAgents/RequiredFilesAgent.cs @@ -27,6 +27,7 @@ using XiboClient.Log; using System.Net; using System.Globalization; +using System.IO; /// 17/02/12 Dan Created /// 20/02/12 Dan Added ClientInfo @@ -199,6 +200,9 @@ public void Run() // Write the Cache Manager to Disk _cacheManager.WriteCacheManager(); + // Report the storage usage + reportStorage(); + // Set the status on the client info screen if (threadsToStart.Count == 0) _clientInfoForm.RequiredFilesStatus = "Sleeping (inside download window)"; @@ -296,5 +300,27 @@ void fileAgent_OnComplete(int fileId, string fileType) OnComplete(rf.Path); } } + + private void reportStorage() + { + // Use Drive Info + foreach (DriveInfo drive in DriveInfo.GetDrives()) + { + if (drive.IsReady && ApplicationSettings.Default.LibraryPath.Contains(drive.RootDirectory.FullName)) + { + using (xmds.xmds xmds = new xmds.xmds()) + { + string status = "{\"availableSpace\":\"" + drive.TotalFreeSpace + "\", \"totalSpace\":\"" + drive.TotalSize + "\"}"; + + xmds.Credentials = null; + xmds.Url = ApplicationSettings.Default.XiboClient_xmds_xmds; + xmds.UseDefaultCredentials = false; + xmds.NotifyStatusAsync(ApplicationSettings.Default.ServerKey, ApplicationSettings.Default.HardwareKey, status); + } + + break; + } + } + } } } diff --git a/bin/x86/Release/AxInterop.WMPLib.dll b/bin/x86/Release/AxInterop.WMPLib.dll deleted file mode 100644 index fde59187..00000000 Binary files a/bin/x86/Release/AxInterop.WMPLib.dll and /dev/null differ diff --git a/bin/x86/Release/Interop.WMPLib.dll b/bin/x86/Release/Interop.WMPLib.dll deleted file mode 100644 index 1673babc..00000000 Binary files a/bin/x86/Release/Interop.WMPLib.dll and /dev/null differ diff --git a/bin/x86/Release/Xibo.scr b/bin/x86/Release/Xibo.scr index cbe2cbeb..f6ec0aab 100644 Binary files a/bin/x86/Release/Xibo.scr and b/bin/x86/Release/Xibo.scr differ diff --git a/bin/x86/Release/XiboClient.XmlSerializers.dll b/bin/x86/Release/XiboClient.XmlSerializers.dll deleted file mode 100644 index 02fb435c..00000000 Binary files a/bin/x86/Release/XiboClient.XmlSerializers.dll and /dev/null differ diff --git a/bin/x86/Release/XiboClient.exe b/bin/x86/Release/XiboClient.exe deleted file mode 100644 index f6ec0aab..00000000 Binary files a/bin/x86/Release/XiboClient.exe and /dev/null differ diff --git a/bin/x86/Release/XiboClient.exe.config b/bin/x86/Release/XiboClient.exe.config deleted file mode 100644 index b21fe50b..00000000 --- a/bin/x86/Release/XiboClient.exe.config +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/bin/x86/Release/XiboClient.pdb b/bin/x86/Release/XiboClient.pdb deleted file mode 100644 index 851029cd..00000000 Binary files a/bin/x86/Release/XiboClient.pdb and /dev/null differ diff --git a/bin/x86/Release/Xilium.CefGlue.WindowsForms.dll b/bin/x86/Release/Xilium.CefGlue.WindowsForms.dll deleted file mode 100644 index 541d4cfd..00000000 Binary files a/bin/x86/Release/Xilium.CefGlue.WindowsForms.dll and /dev/null differ diff --git a/bin/x86/Release/Xilium.CefGlue.dll b/bin/x86/Release/Xilium.CefGlue.dll deleted file mode 100644 index 6d0718ff..00000000 Binary files a/bin/x86/Release/Xilium.CefGlue.dll and /dev/null differ diff --git a/bin/x86/Release/default.config.xml b/bin/x86/Release/default.config.xml deleted file mode 100644 index cd468504..00000000 --- a/bin/x86/Release/default.config.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - 900 - 0 - 0 - 0 - 0 - 10 - true - 2 - schedule.xml - log.xml - stats.xml - cacheManager.xml - requiredFiles.xml - WindowsMediaPlayer - DEFAULT - http://localhost/xibo/1.7/server-170-alpha/server/xmds.php - yourserverkey - COMPUTERNAME - http://localhost/xibo - - - - - blacklist.xml - - error - - - - Bottom Right - I - 0 - 10 - 900 - 5 - 4 - false - true - true - false - true - false - true - false - 0001-01-01T00:00:00 - false - false - false - 0 - 0 - 0 - \ No newline at end of file