这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions Control/Region.cs
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,22 @@ private void ParseOptionsForMediaNode(XmlNode mediaNode, XmlAttributeCollection
}
}

// Media Types without an update interval should be set to something rather high
// Media Types without an update interval should have a sensible default (xibosignage/xibo#404)
// This means that items which do not provide an update interval will still refresh.
if (!updateIntervalProvided)
_options.updateInterval = int.MaxValue;
{
// Special handling for text/webpages because we know they should never have a default update interval applied
if (_options.type == "webpage" || _options.type == "text")
{
// Very high (will expire eventually, but shouldn't cause a routine request for a new resource
_options.updateInterval = int.MaxValue;
}
else
{
// Default to 5 minutes for those items that do not provide an update interval
_options.updateInterval = 5;
}
}
}

/// <summary>
Expand Down Expand Up @@ -662,6 +675,7 @@ protected override void Dispose(bool disposing)
{
try
{
_media.DurationElapsedEvent -= media_DurationElapsedEvent;
_media.Dispose();
_media = null;

Expand Down
16 changes: 0 additions & 16 deletions Forms/OptionForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,6 @@ public OptionForm()

// XMDS completed event
xmds1.RegisterDisplayCompleted += new XiboClient.xmds.RegisterDisplayCompletedEventHandler(xmds1_RegisterDisplayCompleted);

// Library Path
if (ApplicationSettings.Default.LibraryPath == "DEFAULT")
{
Debug.WriteLine("Getting the Library Path", "OptionForm");
ApplicationSettings.Default.LibraryPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Xibo Library";
ApplicationSettings.Default.Save();
}

// Computer name if the display name hasnt been set yet
if (ApplicationSettings.Default.DisplayName == "COMPUTERNAME")
{
Debug.WriteLine("Getting the display Name", "OptionForm");
ApplicationSettings.Default.DisplayName = Environment.MachineName;
ApplicationSettings.Default.Save();
}

// Set global proxy information
OptionForm.SetGlobalProxy();
Expand Down
78 changes: 0 additions & 78 deletions Log/StatLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,6 @@ public void Flush()
// Flush to File
FlushToFile();

// See if there are any records to flush to XMDS
Thread logSubmit = new Thread(new ThreadStart(ProcessQueueToXmds));
logSubmit.Start();

Debug.WriteLine(new LogMessage("Flush", String.Format("OUT")), LogType.Audit.ToString());
}

Expand Down Expand Up @@ -189,80 +185,6 @@ private void FlushToFile()

Debug.WriteLine(new LogMessage("FlushToFile", String.Format("OUT")), LogType.Audit.ToString());
}

/// <summary>
/// Send the Stats to XMDS
/// </summary>
private void ProcessQueueToXmds()
{
try
{
// If we haven't had a successful connection recently, then don't log
if (ApplicationSettings.Default.XmdsLastConnection.AddSeconds((int)ApplicationSettings.Default.CollectInterval) < DateTime.Now)
return;

lock (_locker)
{
// Get a list of all the log files waiting to be sent to XMDS.
string[] logFiles = Directory.GetFiles(ApplicationSettings.Default.LibraryPath, "*" + ApplicationSettings.Default.StatsLogFile + "*");

// Track processed files
int filesProcessed = 0;

// Loop through each file
foreach (string fileName in logFiles)
{
// Only process as many files in one go as configured
if (filesProcessed >= ApplicationSettings.Default.MaxLogFileUploads)
break;

// If we have some, create an XMDS object
using (xmds.xmds logtoXmds = new xmds.xmds())
{
logtoXmds.Url = ApplicationSettings.Default.XiboClient_xmds_xmds;

// construct the log message
StringBuilder builder = new StringBuilder();
builder.Append("<log>");

foreach (string entry in File.ReadAllLines(fileName))
builder.Append(entry);

builder.Append("</log>");

try
{
logtoXmds.SubmitStats(ApplicationSettings.Default.ServerKey, _hardwareKey.Key, builder.ToString());

// Delete the file we are on
File.Delete(fileName);
}
catch (WebException webEx)
{
// Increment the quantity of XMDS failures and bail out
ApplicationSettings.Default.IncrementXmdsErrorCount();

// Log this message, but dont abort the thread
Trace.WriteLine(new LogMessage("ProcessQueueToXmds", "WebException: " + webEx.Message), LogType.Error.ToString());

// Drop out the loop
break;
}
catch (Exception e)
{
Trace.WriteLine(new LogMessage("FlushToXmds", string.Format("Exception when submitting to XMDS: {0}", e.Message)), LogType.Error.ToString());
}

filesProcessed++;
}
}
}
}
catch (Exception e)
{
Trace.WriteLine(new LogMessage("FlushToXmds", string.Format("Unknown Exception: {0}", e.Message)), LogType.Error.ToString());
}
}
}

class Stat
Expand Down
79 changes: 0 additions & 79 deletions Log/XiboTraceListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,81 +142,6 @@ private void FlushToFile()
}
}

/// <summary>
/// Flush the log to XMDS
/// </summary>
public void ProcessQueueToXmds()
{
try
{
// If we haven't had a successful connection recently, then don't log
if (ApplicationSettings.Default.XmdsLastConnection.AddSeconds((int)ApplicationSettings.Default.CollectInterval) < DateTime.Now)
return;

lock (_locker)
{
// Get a list of all the log files waiting to be sent to XMDS.
string[] logFiles = Directory.GetFiles(ApplicationSettings.Default.LibraryPath, "*" + ApplicationSettings.Default.LogLocation + "*");

// Track processed files
int filesProcessed = 0;

// Loop through each file
foreach (string fileName in logFiles)
{
// Only process as many files in one go as configured
if (filesProcessed >= ApplicationSettings.Default.MaxLogFileUploads)
break;

// If we have some, create an XMDS object
using (xmds.xmds logtoXmds = new xmds.xmds())
{
logtoXmds.Url = ApplicationSettings.Default.XiboClient_xmds_xmds;

// construct the log message
StringBuilder builder = new StringBuilder();
builder.Append("<log>");

foreach (string entry in File.ReadAllLines(fileName))
builder.Append(entry);

builder.Append("</log>");

try
{
logtoXmds.SubmitLog(ApplicationSettings.Default.ServerKey, _hardwareKey.Key, builder.ToString());

// Delete the file we are on
File.Delete(fileName);
}
catch (WebException webEx)
{
// Increment the quantity of XMDS failures and bail out
ApplicationSettings.Default.IncrementXmdsErrorCount();

// Log this message, but dont abort the thread
Trace.WriteLine(new LogMessage("ProcessQueueToXmds", "WebException: " + webEx.Message), LogType.Error.ToString());

// Drop out the loop
break;
}
catch (Exception e)
{
Trace.WriteLine(new LogMessage("ProcessQueueToXmds", string.Format("Exception when submitting to XMDS: {0}", e.Message)), LogType.Error.ToString());
}

filesProcessed++;
}
}
}
}
catch (Exception e)
{
// Do nothing - we just have an unknown exception in logging
Trace.WriteLine(new LogMessage("ProcessQueueToXmds", string.Format("Unknown Exception: {0}", e.Message)), LogType.Error.ToString());
}
}

public override void Write(string message)
{
AddToCollection(message, LogType.Audit.ToString());
Expand Down Expand Up @@ -296,10 +221,6 @@ public override void Flush()
return;

FlushToFile();

// See if there are any records to flush to XMDS
Thread logSubmit = new Thread(new ThreadStart(ProcessQueueToXmds));
logSubmit.Start();
}
}

Expand Down
77 changes: 74 additions & 3 deletions Logic/ApplicationSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
Expand All @@ -44,6 +45,8 @@ public class ApplicationSettings
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);

public static ApplicationSettings Default
{
get
Expand Down Expand Up @@ -136,10 +139,14 @@ public object this[string propertyName]
public string RequiredFilesFile { get; set; }
public string VideoRenderingEngine { get; set; }

public string LibraryPath { get; set; }
private string _libraryPath;
public string LibraryPath { get { return (_libraryPath == "DEFAULT") ? (Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\" + Application.ProductName + " Library") : _libraryPath; } set { _libraryPath = value; } }
public string XiboClient_xmds_xmds { get; set; }
public string ServerKey { get; set; }
public string DisplayName { get; set; }

private string _displayName;
public string DisplayName { get { return (_displayName == "COMPUTERNAME") ? Environment.MachineName : _displayName; } set { _displayName = value; } }

public string ServerUri { get; set; }
public string ProxyUser { get; set; }
public string ProxyPassword { get; set; }
Expand All @@ -154,6 +161,56 @@ public object this[string propertyName]
public string CursorStartPosition { get; set; }
public string ClientInformationKeyCode { get; set; }

// Download window

public long DownloadStartWindow { get; set; }
public long DownloadEndWindow { get; set; }

public DateTime DownloadStartWindowTime
{
get
{
DateTime now = DateTime.Now;
DateTime start = unixEpoch.AddMilliseconds(DownloadStartWindow);

// Reset to today
return new DateTime(now.Year, now.Month, now.Day, start.Hour, start.Minute, start.Second);
}
}

public DateTime DownloadEndWindowTime
{
get
{
DateTime now = DateTime.Now;
DateTime end = unixEpoch.AddMilliseconds(DownloadEndWindow);

// Reset to today
return new DateTime(now.Year, now.Month, now.Day, end.Hour, end.Minute, end.Second);
}
}

/// <summary>
/// Is the player in the download window
/// </summary>
public bool InDownloadWindow
{
get
{
try
{
if (DownloadStartWindow == 0 && DownloadEndWindow == 0)
return true;

return (DownloadStartWindowTime <= DateTime.Now && DownloadEndWindowTime >= DateTime.Now);
}
catch
{
return true;
}
}
}

public int Licensed { get; set; }
public int StatsFlushCount { get; set; }
public int CollectInterval { get; set; }
Expand All @@ -173,7 +230,21 @@ public object this[string propertyName]
public bool ClientInfomationCtrlKey { get; set; }
public bool UseCefWebBrowser { get; set; }
public bool SendCurrentLayoutAsStatusUpdate { get; set; }
public bool ScreenShotRequested { get; set; }

private bool _screenShotRequested = false;
public bool ScreenShotRequested
{
get
{
return _screenShotRequested;
}
set
{
_screenShotRequested = value;
// Reset the Hash so that the next update is taken into account.
Hash = "0";
}
}

// XMDS Status Flags
private DateTime _xmdsLastConnection;
Expand Down
8 changes: 8 additions & 0 deletions Logic/KeyStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ class KeyStore : IMessageFilter
private bool _shift = false;
private bool _control = false;

// The screensaver setting
public bool ScreenSaver { get; set; }

// The definitions
private Dictionary<Keys, string> _definitions;

Expand Down Expand Up @@ -103,6 +106,11 @@ private bool HandleDefinedKey(Keys key)

handled = true;
}
else if (ScreenSaver)
{
OnKeyPress("ScreenSaver");
handled = true;
}
return handled;
}

Expand Down
2 changes: 0 additions & 2 deletions Logic/RequiredFiles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,6 @@ private void SetRequiredFiles()
rf.Md5 = attributes["md5"].Value;
rf.Size = int.Parse(attributes["size"].Value);

Trace.WriteLine(new LogMessage("RequiredFiles - SetRequiredFiles", "Building required file node for " + rf.Id.ToString()), LogType.Audit.ToString());

// Does this file already exist in the RF node? We might receive duplicates.
bool found = false;

Expand Down
Loading