这是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
46 changes: 25 additions & 21 deletions App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected override void OnStartup(StartupEventArgs e)
}
catch (Exception ex)
{
HandleUnhandledException(ex);
HandleUnhandledException(ex, false);
}

// Always flush at the end
Expand Down Expand Up @@ -124,59 +124,63 @@ private static void RunClient(bool screenSaver)
#region Exception Handlers
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
HandleUnhandledException(e.Exception);
HandleUnhandledException(e.Exception, true);
}

static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
HandleUnhandledException(e.ExceptionObject);
HandleUnhandledException(e.ExceptionObject, true);
}

static void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
{
HandleUnhandledException(e.Exception);
HandleUnhandledException(e.Exception, false);
}

/// <summary>
/// Event for unhandled exceptions
/// </summary>
/// <param name="o"></param>
static void HandleUnhandledException(Object o)
static void HandleUnhandledException(Object o, bool quit)
{
Exception e = o as Exception;

// What happens if we cannot start?
Trace.WriteLine(new LogMessage("Main", "Unhandled Exception: " + e.Message), LogType.Error.ToString());
Trace.WriteLine(new LogMessage("Main", "Stack Trace: " + e.StackTrace), LogType.Audit.ToString());

try
// Should we quit or continue
if (quit)
{
string productName = ApplicationSettings.GetProductNameFromAssembly();

// Also write to the event log
try
{
if (!EventLog.SourceExists(productName))
string productName = ApplicationSettings.GetProductNameFromAssembly();

// Also write to the event log
try
{
if (!EventLog.SourceExists(productName))
{
EventLog.CreateEventSource(productName, "Xibo");
}

EventLog.WriteEntry(productName, e.ToString(), EventLogEntryType.Error);
}
catch (Exception ex)
{
EventLog.CreateEventSource(productName, "Xibo");
Trace.WriteLine(new LogMessage("Main", "Couldn't write to event log: " + ex.Message), LogType.Info.ToString());
}

EventLog.WriteEntry(productName, e.ToString(), EventLogEntryType.Error);
Trace.Flush();
}
catch (Exception ex)
{
Trace.WriteLine(new LogMessage("Main", "Couldn't write to event log: " + ex.Message), LogType.Info.ToString());
Trace.WriteLine(new LogMessage("Main", "Unable to write to event log " + ex.Message), LogType.Info.ToString());
}

Trace.Flush();
}
catch (Exception ex)
{
Trace.WriteLine(new LogMessage("Main", "Unable to write to event log " + ex.Message), LogType.Info.ToString());
// Exit the application and allow it to be restarted by the Watchdog.
Environment.Exit(0);
}

// Exit the application and allow it to be restarted by the Watchdog.
Environment.Exit(0);
}

internal static class NativeMethods
Expand Down
2 changes: 1 addition & 1 deletion Log/ClientInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void UpdateStatusMarkerFile()
{
try
{
using (FileStream file = new FileStream(Path.Combine(ApplicationSettings.Default.LibraryPath, "status.json"), FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite))
using (FileStream file = new FileStream(Path.Combine(ApplicationSettings.Default.LibraryPath, "status.json"), FileMode.Create, FileAccess.Write, FileShare.Read))
{
using (StreamWriter sw = new StreamWriter(file))
{
Expand Down
3 changes: 2 additions & 1 deletion Log/LogMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Globalization;
using System.Security;
using System.Threading;
using System.Xml;
Expand Down Expand Up @@ -95,7 +96,7 @@ public override string ToString()
// Just do this with a string builder rather than an XML builder.
String theMessage;

theMessage = String.Format("<logdate>{0}</logdate>", LogDate.ToString("yyyy-MM-dd HH:mm:ss"));
theMessage = String.Format("<logdate>{0}</logdate>", LogDate.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture));
theMessage += String.Format("<thread>{0}</thread>", _thread);
theMessage += String.Format("<method>{0}</method>", _method);
theMessage += String.Format("<message>{0}</message>", SecurityElement.Escape(_message));
Expand Down
3 changes: 2 additions & 1 deletion Log/XiboTraceListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using System;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Text;

Expand Down Expand Up @@ -94,7 +95,7 @@ private void AddToCollection(string message, string category)
_traceMessages.Add(new TraceMessage
{
category = category,
dateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
dateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture),
message = message
});

Expand Down
4 changes: 2 additions & 2 deletions Logic/ApplicationSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ private static readonly Lazy<ApplicationSettings>
/// </summary>
private List<string> ExcludedProperties;

public string ClientVersion { get; } = "2 R253.3";
public string ClientVersion { get; } = "2 R254.1";
public string Version { get; } = "5";
public int ClientCodeVersion { get; } = 253;
public int ClientCodeVersion { get; } = 254;

private ApplicationSettings()
{
Expand Down
20 changes: 13 additions & 7 deletions Logic/ScheduleManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1494,18 +1494,18 @@ private void InterruptInitState()
{
this._interruptState = JsonConvert.DeserializeObject<InterruptState>(File.ReadAllText(ApplicationSettings.Default.LibraryPath + @"\interrupt.json"));
}
else
{
// Create a new empty object
this._interruptState = InterruptState.EmptyState();
}
}
catch (Exception e)
{
this._interruptState = InterruptState.EmptyState();

Trace.WriteLine(new LogMessage("ScheduleManager", "InterruptInitState: Failed to read interrupt file. e = " + e.Message), LogType.Error.ToString());
}

// If we are still empty after loading, we should create an empty object
if (this._interruptState == null)
{
// Create a new empty object
this._interruptState = InterruptState.EmptyState();
}
}
}

Expand All @@ -1514,6 +1514,12 @@ private void InterruptInitState()
/// </summary>
private void InterruptPersistState()
{
// If the interrupt state is null for whatever reason, don't persist it to file
if (this._interruptState == null)
{
return;
}

try
{
lock (_locker)
Expand Down
4 changes: 2 additions & 2 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1088,8 +1088,8 @@ private void SetMainWindowSize()

Width = sizeX;
Height = sizeY;
Top = (double)ApplicationSettings.Default.OffsetX;
Left = (double)ApplicationSettings.Default.OffsetY;
Left = (double)ApplicationSettings.Default.OffsetX;
Top = (double)ApplicationSettings.Default.OffsetY;
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@
// 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("2.253.3.0")]
[assembly: AssemblyFileVersion("2.253.3.0")]
[assembly: AssemblyVersion("2.254.1.0")]
[assembly: AssemblyFileVersion("2.254.1.0")]
[assembly: Guid("3bd467a4-4ef9-466a-b156-a79c13a863f7")]
6 changes: 4 additions & 2 deletions Rendering/WebMedia.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ private bool IsUpdated(string path, DateTime lastModified)
string flag = File.ReadAllText(path);
DateTime updated = DateTime.Parse(flag);

return updated > lastModified;
Debug.WriteLine("Last time we extracted: " + updated.ToString() + ", ZIP file last modified: " + lastModified.ToString());

return updated < lastModified;
}
catch (Exception e)
{
Expand Down Expand Up @@ -382,7 +384,7 @@ private void UpdateCacheIfNecessary()

// Compare the cached dimensions in the file with the dimensions now, and
// regenerate if they are different.
if (cachedFile.Contains("[[ViewPortWidth]]") || !ReadCachedViewPort(cachedFile).Equals(Width.ToString() + "x" + Height.ToString()))
if (cachedFile.Contains("[[ViewPortWidth]]") || !ReadCachedViewPort(cachedFile).Equals(WidthIntended.ToString() + "x" + HeightIntended.ToString()))
{
// Regex out the existing replacement if present
cachedFile = Regex.Replace(cachedFile, "<!--START_STYLE_ADJUST-->(.*)<!--END_STYLE_ADJUST-->", "");
Expand Down
Loading