这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
80994ce
Merge pull request #34 from dasgarner/hotfix/1.7.8-rev2
dasgarner Jun 27, 2016
cd612ab
Fix certificate store problem
dasgarner Jul 7, 2016
cc1734d
Additional logging for RS232 command execution.
dasgarner Jul 14, 2016
79f56e9
Create WatchDog in detached process
dasgarner Aug 17, 2016
275e8e0
Merge branch 'master' into develop
dasgarner Aug 17, 2016
0702126
Modifications to shell command to accept a duration and handle comman…
dasgarner Aug 17, 2016
6ef6153
Bumped version
dasgarner Aug 30, 2016
5f28d83
Fixed comparison of current layout schedules. Removed redundant layou…
dasgarner Aug 31, 2016
b5fa8e5
Update hardware key generation to also use mac address. detect system…
dasgarner Sep 1, 2016
c6ab884
Implement region loop
dasgarner Sep 1, 2016
09c0799
Only write status.json from the main thread. Improvements to remove f…
dasgarner Sep 6, 2016
c674091
Check agent threads are alive before writing status file and include …
dasgarner Sep 6, 2016
0b8da52
Set assembly version correctly.
dasgarner Sep 23, 2016
5353292
Do not check validity of current layout when ExpireModifiedLayouts is…
dasgarner Sep 26, 2016
23a3c8c
Merge pull request #38 from dasgarner/hotfix/1.7.9
dasgarner Oct 10, 2016
9971ae4
Race condition updating dependents.
dasgarner Oct 10, 2016
2d7e0e3
Final fix for dependents not being assessed correctly
dasgarner Oct 11, 2016
0543930
Set assembly version to something higher than it was before
dasgarner Oct 11, 2016
702200d
Combine schedule and rf agents into one synchronous call - so that th…
dasgarner Oct 11, 2016
4191e00
Merge branch 'hotfix/1.7.10' into develop
dasgarner Oct 31, 2016
66db22b
Fix merge commit
dasgarner Oct 31, 2016
e2fdedb
Adjust logging levels for default layout and fix caching issue throug…
dasgarner Oct 31, 2016
895a0c0
Tone down XMR subscribe error message
dasgarner Oct 31, 2016
e9ecb0d
Background image should be served over embedded server
dasgarner Oct 31, 2016
cb0d4cf
Send machine name with storage info
dasgarner Nov 1, 2016
f071e1b
Set main application name to product name.
dasgarner Nov 1, 2016
a903662
Bump version, build release, etc.
dasgarner Nov 1, 2016
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
3 changes: 3 additions & 0 deletions Action/Rs232Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public Rs232Command(Command command)

/// <summary>
/// Run the command
/// throws an exception if we cannot open or write to the port
/// </summary>
public string Run()
{
Expand All @@ -29,6 +30,8 @@ public string Run()
// Parse and configure the port
parse();

Trace.WriteLine(new LogMessage("Rs232Command - run", "Parsed command, will open port " + _port.PortName + " and write " + _toSend), LogType.Audit.ToString());

// try to open the COM port
if (!_port.IsOpen)
_port.Open();
Expand Down
2 changes: 1 addition & 1 deletion Action/XmrSubscriber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public void Run()
}
catch (Exception e)
{
Trace.WriteLine(new LogMessage("XmrSubscriber - Run", "Unable to Subscribe to XMR: " + e.Message), LogType.Error.ToString());
Trace.WriteLine(new LogMessage("XmrSubscriber - Run", "Unable to Subscribe to XMR: " + e.Message), LogType.Info.ToString());
_clientInfoForm.XmrSubscriberStatus = e.Message;
}
}
Expand Down
9 changes: 8 additions & 1 deletion Control/EmbeddedServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,14 @@ public void Run()

using (WebServer server = new WebServer(ApplicationSettings.Default.EmbeddedServerAddress))
{
server.RegisterModule(new StaticFilesModule(ApplicationSettings.Default.LibraryPath));
Dictionary<string, string> headers = new Dictionary<string, string>()
{
{ Constants.HeaderCacheControl, "no-cache, no-store, must-revalidate" },
{ Constants.HeaderPragma, "no-cache" },
{ Constants.HeaderExpires, "0" }
};

server.RegisterModule(new StaticFilesModule(ApplicationSettings.Default.LibraryPath, headers));
server.Module<StaticFilesModule>().UseRamCache = true;
server.Module<StaticFilesModule>().DefaultExtension = ".html";

Expand Down
64 changes: 41 additions & 23 deletions Control/Region.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Xibo - Digitial Signage - http://www.xibo.org.uk
* Copyright (C) 2006-2015 Daniel Garner
* Copyright (C) 2006-2016 Daniel Garner
*
* This file is part of Xibo.
*
Expand Down Expand Up @@ -171,18 +171,26 @@ private void EvalOptions()
if (!SetNextMediaNodeInOptions())
{
// For some reason we cannot set a media node... so we need this region to become invalid
_hasExpired = true;

if (DurationElapsedEvent != null)
DurationElapsedEvent();
return;
throw new InvalidOperationException("Unable to set any region media nodes.");
}

// If the sequence hasnt been changed, OR the layout has been expired
// there has been no change to the sequence, therefore the media we have already created is still valid
// or this media has actually been destroyed and we are working out way out the call stack
if (_layoutExpired || (_currentSequence == temp))
if (_layoutExpired)
{
return;
}
else if (_currentSequence == temp)
{
// Media has not changed, we are likely the only valid media item in the region
// the layout has not yet expired, so depending on whether we loop or not, we either
// reload the same media item again
// or do nothing (return)
// This could be made more succinct, but is clearer written as an elseif.
if (!_options.RegionLoop)
return;
}

// Store the Current Index
_options.CurrentIndex = _currentSequence;
Expand All @@ -199,7 +207,7 @@ private void EvalOptions()
// Try the next node
startSuccessful = false;
continue;
}
}

// First thing we do is stop the current stat record
if (!initialMedia)
Expand Down Expand Up @@ -449,23 +457,26 @@ private void ParseOptionsForMediaNode(XmlNode mediaNode, XmlAttributeCollection
// And some stuff on Raw nodes
XmlNode rawNode = mediaNode.SelectSingleNode("raw");

foreach (XmlNode raw in rawNode.ChildNodes)
if (rawNode != null)
{
if (raw.Name == "text")
{
_options.text = raw.InnerText;
}
else if (raw.Name == "template")
{
_options.documentTemplate = raw.InnerText;
}
else if (raw.Name == "embedHtml")
foreach (XmlNode raw in rawNode.ChildNodes)
{
_options.text = raw.InnerText;
}
else if (raw.Name == "embedScript")
{
_options.javaScript = raw.InnerText;
if (raw.Name == "text")
{
_options.text = raw.InnerText;
}
else if (raw.Name == "template")
{
_options.documentTemplate = raw.InnerText;
}
else if (raw.Name == "embedHtml")
{
_options.text = raw.InnerText;
}
else if (raw.Name == "embedScript")
{
_options.javaScript = raw.InnerText;
}
}
}

Expand Down Expand Up @@ -539,6 +550,8 @@ private Media CreateNextMediaNode(RegionOptions options)
}
else
{
// We've set our next media node in options already
// this includes checking that file based media is valid.
switch (options.type)
{
case "image":
Expand Down Expand Up @@ -775,11 +788,16 @@ private void media_DurationElapsedEvent(int filesPlayed)

/// <summary>
/// Clears the Region of anything that it shouldnt still have...
/// called when Destroying a Layout and when Removing an Overlay
/// </summary>
public void Clear()
{
try
{
// Stop the current media item
if (_media != null)
StopMedia(_media);

// What happens if we are disposing this region but we have not yet completed the stat event?
if (string.IsNullOrEmpty(_stat.toDate))
{
Expand Down
13 changes: 12 additions & 1 deletion Control/WatchDogManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class WatchDogManager
public static void Start()
{
// Check to see if the WatchDog EXE exists where we expect it to be
// Uncomment to test local watchdog install.
//string path = @"C:\Program Files (x86)\Xibo Player\watchdog\x86\XiboClientWatchdog.exe";
string path = Path.GetDirectoryName(Application.ExecutablePath) + @"\watchdog\x86\XiboClientWatchdog.exe";
string args = "-p \"" + Application.ExecutablePath + "\" -l \"" + ApplicationSettings.Default.LibraryPath + "\"";

Expand All @@ -21,7 +23,16 @@ public static void Start()
{
try
{
Process.Start(path, args);
Process process = new Process();
ProcessStartInfo info = new ProcessStartInfo();

info.CreateNoWindow = true;
info.WindowStyle = ProcessWindowStyle.Hidden;
info.FileName = "cmd.exe";
info.Arguments = "/c start \"watchdog\" \"" + path + "\" " + args;

process.StartInfo = info;
process.Start();
}
catch (Exception e)
{
Expand Down
12 changes: 12 additions & 0 deletions Error/DefaultLayoutException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace XiboClient.Error
{
class DefaultLayoutException : Exception
{
}
}
27 changes: 27 additions & 0 deletions Log/ClientInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ public partial class ClientInfo : Form
public delegate void StatusDelegate(string status);
public delegate void AddLogMessage(string message, LogType logType);

// Delegate for updating the status file
public delegate void UpdateStatusFile();

/// <summary>
/// Set the schedule status
/// </summary>
Expand Down Expand Up @@ -298,5 +301,29 @@ private void saveFileDialog_FileOk(object sender, CancelEventArgs e)

MessageBox.Show("Log saved as " + saveFileDialog.FileName, "Log Saved");
}

/// <summary>
/// Update Status Marker File
/// </summary>
public void UpdateStatusMarkerFile()
{
if (InvokeRequired)
{
BeginInvoke(new UpdateStatusFile(updateStatusFile));
}
else
{
updateStatusFile();
}
}

/// <summary>
/// Update status file
/// </summary>
private void updateStatusFile()
{
File.WriteAllText(Path.Combine(ApplicationSettings.Default.LibraryPath, "status.json"),
"{\"lastActivity\":\"" + DateTime.Now.ToString() + "\",\"state\":\"" + Thread.State.ToString() + "\",\"xmdsLastActivity\":\"" + ApplicationSettings.Default.XmdsLastConnection.ToString() + "\",\"xmdsCollectInterval\":\"" + ApplicationSettings.Default.CollectInterval.ToString() + "\"}");
}
}
}
4 changes: 2 additions & 2 deletions Logic/ApplicationSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public class ApplicationSettings
private static string _default = "default";

// Application Specific Settings we want to protect
private string _clientVersion = "1.8.0-beta";
private string _clientVersion = "1.8.0-rc1";
private string _version = "5";
private int _clientCodeVersion = 122;
private int _clientCodeVersion = 124;

public string ClientVersion { get { return _clientVersion; } }
public string Version { get { return _version; } }
Expand Down
89 changes: 1 addition & 88 deletions Logic/CacheManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public bool IsValidPath(String path)
{
// If we cached it over 2 minutes ago, then check the GetLastWriteTime
if (file.cacheDate > DateTime.Now.AddMinutes(-2))
return true;
return File.Exists(ApplicationSettings.Default.LibraryPath + @"\" + path);

try
{
Expand Down Expand Up @@ -231,93 +231,6 @@ public bool IsValidPath(String path)
}
}

/// <summary>
/// Is the provided layout file a valid layout (has all media)
/// </summary>
/// <param name="layoutFile"></param>
/// <returns></returns>
public bool IsValidLayout(string layoutFile)
{
lock (_locker)
{
Debug.WriteLine("Checking if Layout " + layoutFile + " is valid");

if (!IsValidPath(layoutFile))
return false;


// Load the XLF, get all media ID's
XmlDocument layoutXml = new XmlDocument();
layoutXml.Load(ApplicationSettings.Default.LibraryPath + @"\" + layoutFile);

try
{
XmlNodeList mediaNodes = layoutXml.SelectNodes("//media");

// Store some information about the validity of local video to decide if this layout should be valid or not.
int countInvalidLocalVideo = 0;

foreach (XmlNode media in mediaNodes)
{
// Is this a stored media type?
switch (media.Attributes["type"].Value)
{
case "video":
case "image":
case "flash":
case "powerpoint":

// Get the path and see if its
if (!IsValidPath(GetUri(media)))
{
Trace.WriteLine(new LogMessage("CacheManager - IsValidLayout", "Invalid Media: " + media.Attributes["id"].Value.ToString()), LogType.Audit.ToString());
return false;
}

break;

default:
continue;
}
}

// If the number of invalid local video elements is equal to the number of elements on the layout, then don't show
if (countInvalidLocalVideo == mediaNodes.Count)
return false;
}
catch (Exception ex)
{
Trace.WriteLine(new LogMessage("CacheManager - IsValidLayout", "Exception checking media. " + ex.Message), LogType.Audit.ToString());
return false;
}

// Also check to see if there is a background image that needs to be downloaded
try
{
XmlNode layoutNode = layoutXml.SelectSingleNode("/layout");
XmlAttributeCollection layoutAttributes = layoutNode.Attributes;

if (layoutAttributes["background"] != null && !string.IsNullOrEmpty(layoutAttributes["background"].Value))
{
if (!IsValidPath(layoutAttributes["background"].Value))
{
Debug.WriteLine("Invalid background: " + layoutAttributes["background"].Value);
return false;
}
}
}
catch
{
// We dont want a missing background attribute to stop this process
return true;
}

Debug.WriteLine("Layout " + layoutFile + " is valid");

return true;
}
}

/// <summary>
/// Get the URI of this media item
/// </summary>
Expand Down
Loading