convert HostApplication from static class to interface implemented by EditorApplication (a subclass of UIApplication)

This commit is contained in:
Michael Becker 2021-01-02 00:30:28 -05:00
parent 5d394baf48
commit 9ecb3e3692
No known key found for this signature in database
GPG Key ID: 98C333A81F18C22C
25 changed files with 111 additions and 82 deletions

View File

@ -46,7 +46,7 @@ namespace UniversalEditor.Compression.Modules.Deflate
{
// This is the ONLY line in the entire code that
// references UniversalEditor.UserInterface...
// HostApplication.Messages.Add(HostApplicationMessageSeverity.Warning, ex.GetType().Name + ": " + ex.Message);
// (Application.Instance as IHostApplication).Messages.Add(HostApplicationMessageSeverity.Warning, ex.GetType().Name + ": " + ex.Message);
break;
}
outputStream.Write(buffer, 0, read);

View File

@ -1,4 +1,4 @@
//
//
// ZIPDataFormat.cs - provides a DataFormat for manipulating archives in the standardized PKWARE ZIP format
//
// Author:
@ -773,7 +773,7 @@ namespace UniversalEditor.DataFormats.FileSystem.ZIP
if (unpackedData.Length != unpackedFileLength)
{
// HostApplication.Messages.Add(HostApplicationMessageSeverity.Error, "File size mismatch, source archive may be corrupted", fileName);
// (Application.Instance as IHostApplication).Messages.Add(HostApplicationMessageSeverity.Error, "File size mismatch, source archive may be corrupted", fileName);
}
File f = fsom.AddFile(fileName);

View File

@ -20,6 +20,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using MBS.Framework;
using MBS.Framework.Logic.Conditional;
using MBS.Framework.UserInterface;
using MBS.Framework.UserInterface.Controls;
@ -148,12 +149,12 @@ namespace UniversalEditor.UserInterface.Dialogs
CriteriaResult result = e.Row.GetExtraData<CriteriaResult>("result");
if (result == null) return;
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
Editor editor = (Application.Instance as IHostApplication).CurrentWindow.GetCurrentEditor();
if (editor == null) return;
editor.Selections.Add(editor.CreateSelection(result.Value));
HostApplication.CurrentWindow.Present(DateTime.Now);
(Application.Instance as IHostApplication).CurrentWindow.Present(DateTime.Now);
}
protected override void OnKeyDown(KeyEventArgs e)

View File

@ -0,0 +1,21 @@

using MBS.Framework.UserInterface;
namespace UniversalEditor.UserInterface
{
public class EditorApplication : UIApplication, IHostApplication
{
/// <summary>
/// Gets or sets the current window of the host application.
/// </summary>
public IHostApplicationWindow CurrentWindow { get { return UniversalEditor.UserInterface.Engine.CurrentEngine.LastWindow; } set { UniversalEditor.UserInterface.Engine.CurrentEngine.LastWindow = value; } }
/// <summary>
/// Gets or sets the output window of the host application, where other plugins can read from and write to.
/// </summary>
public HostApplicationOutputWindow OutputWindow { get; set; } = new HostApplicationOutputWindow();
/// <summary>
/// A collection of messages to display in the Error List panel.
/// </summary>
public HostApplicationMessage.HostApplicationMessageCollection Messages { get; } = new HostApplicationMessage.HostApplicationMessageCollection();
}
}

View File

@ -19,6 +19,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using MBS.Framework;
using MBS.Framework.UserInterface.Controls;
using MBS.Framework.UserInterface.Controls.ListView;
@ -38,7 +39,7 @@ namespace UniversalEditor.UserInterface
{
get
{
ListViewControl lv = ((MainWindow)HostApplication.CurrentWindow).DocumentExplorerPanel.ListView;
ListViewControl lv = ((MainWindow)(Application.Instance as IHostApplication).CurrentWindow).DocumentExplorerPanel.ListView;
if (lv.SelectedRows.Count > 0)
{
return lv.SelectedRows[0].GetExtraData<EditorDocumentExplorerNode>("node");

View File

@ -200,7 +200,7 @@ namespace UniversalEditor.Editors.Database.Views
d.IsSaved = false;
d.IsChanged = true;
d.Title = "New Query";
HostApplication.CurrentWindow.OpenFile(new Document[]
(Application.Instance as IHostApplication).CurrentWindow.OpenFile(new Document[]
{
d
});

View File

@ -122,7 +122,7 @@ namespace UniversalEditor.Editors.FileSystem
if (fsom == null)
return;
Document d = HostApplication.CurrentWindow.NewFile();
Document d = (Application.Instance as IHostApplication).CurrentWindow.NewFile();
if (d != null)
{
BeginEdit();
@ -240,7 +240,7 @@ namespace UniversalEditor.Editors.FileSystem
EmbeddedFileAccessor ma = new EmbeddedFileAccessor(f);
Document doc = new Document(ma);
doc.Saved += doc_Saved;
HostApplication.CurrentWindow.OpenFile(doc);
(Application.Instance as IHostApplication).CurrentWindow.OpenFile(doc);
}
}
}

View File

@ -470,50 +470,50 @@ namespace UniversalEditor.UserInterface
#region Perspective
Application.Instance.AttachCommandEventHandler("ViewPerspective1", delegate(object sender, EventArgs e)
{
HostApplication.CurrentWindow.SwitchPerspective(1);
(Application.Instance as IHostApplication).CurrentWindow.SwitchPerspective(1);
});
Application.Instance.AttachCommandEventHandler("ViewPerspective2", delegate(object sender, EventArgs e)
{
HostApplication.CurrentWindow.SwitchPerspective(2);
(Application.Instance as IHostApplication).CurrentWindow.SwitchPerspective(2);
});
Application.Instance.AttachCommandEventHandler("ViewPerspective3", delegate(object sender, EventArgs e)
{
HostApplication.CurrentWindow.SwitchPerspective(3);
(Application.Instance as IHostApplication).CurrentWindow.SwitchPerspective(3);
});
Application.Instance.AttachCommandEventHandler("ViewPerspective4", delegate(object sender, EventArgs e)
{
HostApplication.CurrentWindow.SwitchPerspective(4);
(Application.Instance as IHostApplication).CurrentWindow.SwitchPerspective(4);
});
Application.Instance.AttachCommandEventHandler("ViewPerspective5", delegate(object sender, EventArgs e)
{
HostApplication.CurrentWindow.SwitchPerspective(5);
(Application.Instance as IHostApplication).CurrentWindow.SwitchPerspective(5);
});
Application.Instance.AttachCommandEventHandler("ViewPerspective6", delegate(object sender, EventArgs e)
{
HostApplication.CurrentWindow.SwitchPerspective(6);
(Application.Instance as IHostApplication).CurrentWindow.SwitchPerspective(6);
});
Application.Instance.AttachCommandEventHandler("ViewPerspective7", delegate(object sender, EventArgs e)
{
HostApplication.CurrentWindow.SwitchPerspective(7);
(Application.Instance as IHostApplication).CurrentWindow.SwitchPerspective(7);
});
Application.Instance.AttachCommandEventHandler("ViewPerspective8", delegate(object sender, EventArgs e)
{
HostApplication.CurrentWindow.SwitchPerspective(8);
(Application.Instance as IHostApplication).CurrentWindow.SwitchPerspective(8);
});
Application.Instance.AttachCommandEventHandler("ViewPerspective9", delegate(object sender, EventArgs e)
{
HostApplication.CurrentWindow.SwitchPerspective(9);
(Application.Instance as IHostApplication).CurrentWindow.SwitchPerspective(9);
});
#endregion
Application.Instance.AttachCommandEventHandler("ViewStartPage", delegate(object sender, EventArgs e)
{
HostApplication.CurrentWindow.ShowStartPage();
(Application.Instance as IHostApplication).CurrentWindow.ShowStartPage();
});
Application.Instance.AttachCommandEventHandler("ViewStatusBar", delegate (object sender, EventArgs e)
{
HostApplication.CurrentWindow.StatusBar.Visible = !HostApplication.CurrentWindow.StatusBar.Visible;
Application.Instance.Commands["ViewStatusBar"].Checked = HostApplication.CurrentWindow.StatusBar.Visible;
(Application.Instance as IHostApplication).CurrentWindow.StatusBar.Visible = !(Application.Instance as IHostApplication).CurrentWindow.StatusBar.Visible;
Application.Instance.Commands["ViewStatusBar"].Checked = (Application.Instance as IHostApplication).CurrentWindow.StatusBar.Visible;
});
#endregion
@ -707,7 +707,7 @@ namespace UniversalEditor.UserInterface
cmdLanguage.Title = lang.Title;
cmdLanguage.Executed += delegate (object sender, EventArgs e)
{
HostApplication.Messages.Add(HostApplicationMessageSeverity.Notice, "Clicked language " + lang.ID);
(Application.Instance as IHostApplication).Messages.Add(HostApplicationMessageSeverity.Notice, "Clicked language " + lang.ID);
};
Application.Instance.Commands.Add(cmdLanguage);
@ -1042,7 +1042,7 @@ namespace UniversalEditor.UserInterface
public void StartApplication()
{
Application.Instance = new UIApplication();
Application.Instance = new EditorApplication();
Application.Instance.Title = "Universal Editor";
mvarRunning = true;

View File

@ -1,27 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace UniversalEditor.UserInterface
{
public static class HostApplication
{
/// <summary>
/// Gets or sets the current window of the host application.
/// </summary>
public static IHostApplicationWindow CurrentWindow { get { return Engine.CurrentEngine.LastWindow; } set { Engine.CurrentEngine.LastWindow = value; } }
private static HostApplicationOutputWindow mvarOutputWindow = new HostApplicationOutputWindow();
/// <summary>
/// Gets or sets the output window of the host application, where other plugins can read from and write to.
/// </summary>
public static HostApplicationOutputWindow OutputWindow { get { return mvarOutputWindow; } set { mvarOutputWindow = value; } }
private static HostApplicationMessage.HostApplicationMessageCollection mvarMessages = new HostApplicationMessage.HostApplicationMessageCollection();
/// <summary>
/// A collection of messages to display in the Error List panel.
/// </summary>
public static HostApplicationMessage.HostApplicationMessageCollection Messages { get { return mvarMessages; } }
}
}

View File

@ -0,0 +1,18 @@
namespace UniversalEditor.UserInterface
{
public interface IHostApplication
{
/// <summary>
/// Gets or sets the current window of the host application.
/// </summary>
IHostApplicationWindow CurrentWindow { get; set; }
/// <summary>
/// Gets or sets the output window of the host application, where other plugins can read from and write to.
/// </summary>
HostApplicationOutputWindow OutputWindow { get; set; }
/// <summary>
/// A collection of messages to display in the Error List panel.
/// </summary>
HostApplicationMessage.HostApplicationMessageCollection Messages { get; }
}
}

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using MBS.Framework;
namespace UniversalEditor.UserInterface
{
@ -126,7 +127,7 @@ namespace UniversalEditor.UserInterface
mvarEnabled = value;
foreach (object NativeControl in mvarNativeControls)
{
HostApplication.CurrentWindow.RefreshCommand(NativeControl);
(Application.Instance as IHostApplication).CurrentWindow.RefreshCommand(NativeControl);
}
}
}
@ -138,7 +139,7 @@ namespace UniversalEditor.UserInterface
mvarVisible = value;
foreach (object NativeControl in mvarNativeControls)
{
HostApplication.CurrentWindow.RefreshCommand(NativeControl);
(Application.Instance as IHostApplication).CurrentWindow.RefreshCommand(NativeControl);
}
}
}

View File

@ -19,6 +19,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using MBS.Framework;
using MBS.Framework.UserInterface;
using MBS.Framework.UserInterface.Controls;
using MBS.Framework.UserInterface.Controls.ListView;
@ -59,7 +60,7 @@ namespace UniversalEditor.UserInterface.Panels
tvErrorList.Columns.Add(new ListViewColumnText(tm.Columns[4], "Path"));
tvErrorList.Columns.Add(new ListViewColumnText(tm.Columns[5], "Category"));
HostApplication.Messages.MessageAdded += (sender, e) =>
(Application.Instance as IHostApplication).Messages.MessageAdded += (sender, e) =>
{
HostApplicationMessage message = e.Message;
tm.Rows.Add(new TreeModelRow(new TreeModelRowColumn[]
@ -72,7 +73,7 @@ namespace UniversalEditor.UserInterface.Panels
new TreeModelRowColumn(tm.Columns[5], message.Severity)
}));
};
HostApplication.Messages.MessageRemoved += (sender, e) =>
(Application.Instance as IHostApplication).Messages.MessageRemoved += (sender, e) =>
{
};
@ -93,7 +94,7 @@ namespace UniversalEditor.UserInterface.Panels
{
tm.Rows.Clear();
foreach (HostApplicationMessage message in HostApplication.Messages)
foreach (HostApplicationMessage message in (Application.Instance as IHostApplication).Messages)
{
tm.Rows.Add(new TreeModelRow(new TreeModelRowColumn[]
{

View File

@ -301,7 +301,7 @@ namespace UniversalEditor.UserInterface.Panels
Accessors.MemoryAccessor ma = new Accessors.MemoryAccessor(new byte[0], String.Format("{0} Properties", project.Title));
Document d = new Document(project, null, ma);
d.Title = String.Format("{0} Properties", project.Title);
HostApplication.CurrentWindow.OpenFile(d);
(Application.Instance as IHostApplication).CurrentWindow.OpenFile(d);
}
else if (file != null)
{

View File

@ -62,11 +62,11 @@ namespace UniversalEditor.UserInterface.Panels
private void cmdCreateNewProject_Click(object sender, EventArgs e)
{
HostApplication.CurrentWindow?.NewProject();
(Application.Instance as IHostApplication).CurrentWindow?.NewProject();
}
private void cmdOpenExistingProject_Click(object sender, EventArgs e)
{
HostApplication.CurrentWindow?.OpenProject();
(Application.Instance as IHostApplication).CurrentWindow?.OpenProject();
}
}
}

View File

@ -62,7 +62,6 @@
<Compile Include="CustomOptionDialogType.cs" />
<Compile Include="EditorReference.cs" />
<Compile Include="Engine.cs" />
<Compile Include="HostApplication.cs" />
<Compile Include="HostApplicationMessage.cs" />
<Compile Include="HostApplicationOutputWindow.cs" />
<Compile Include="Editor.cs" />
@ -136,6 +135,8 @@
<Compile Include="Dialogs\BatchFindReplaceWindow.cs" />
<Compile Include="PrintHandlers\FileSystemPrintHandler.cs" />
<Compile Include="IDocumentPropertiesProvider.cs" />
<Compile Include="EditorApplication.cs" />
<Compile Include="IHostApplication.cs" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">

View File

@ -20,6 +20,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Collections.Generic;
using MBS.Framework;
using MBS.Framework.Drawing;
using MBS.Framework.UserInterface;
using MBS.Framework.UserInterface.Dialogs;
@ -38,7 +39,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration
Context = new UIContext(new Guid("{262a622c-c9e3-458b-8fbb-49cf9258b05d}"), "Multimedia Collaboration Plugin");
Context.AttachCommandEventHandler("Collaboration_Tracking_Track", delegate (object sender, EventArgs e)
{
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
Editor editor = (Application.Instance as IHostApplication).CurrentWindow.GetCurrentEditor();
Document d = editor?.Document;
if (d != null)
{
@ -73,7 +74,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration
});
Context.AttachCommandEventHandler("Collaboration_Tracking_PreviousChange", delegate (object sender, EventArgs e)
{
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
Editor editor = (Application.Instance as IHostApplication).CurrentWindow.GetCurrentEditor();
Document d = editor?.Document;
if (d == null)
return;
@ -112,7 +113,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration
});
Context.AttachCommandEventHandler("Collaboration_Tracking_NextChange", delegate (object sender, EventArgs e)
{
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
Editor editor = (Application.Instance as IHostApplication).CurrentWindow.GetCurrentEditor();
Document d = editor?.Document;
if (d == null)
return;
@ -153,7 +154,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration
private SynthesizedAudioCommandChange.SynthesizedAudioCommandChangeCollection GetChangedCommandsList()
{
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
Editor editor = (Application.Instance as IHostApplication).CurrentWindow.GetCurrentEditor();
Document d = editor?.Document;
if (d == null)
return null;
@ -171,7 +172,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration
private void ed_PianoRoll_NoteInserted(object sender, NoteEventArgs e)
{
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
Editor editor = (Application.Instance as IHostApplication).CurrentWindow.GetCurrentEditor();
Document d = editor?.Document;
CollaborationPlugin plugin = (UserInterfacePlugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
CollaborationSettings collab = plugin.GetCollaborationSettings(d);
@ -188,7 +189,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration
private void ed_PianoRoll_NoteDeleted(object sender, NoteEventArgs e)
{
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
Editor editor = (Application.Instance as IHostApplication).CurrentWindow.GetCurrentEditor();
Document d = editor?.Document;
CollaborationPlugin plugin = (UserInterfacePlugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
CollaborationSettings collab = plugin.GetCollaborationSettings(d);
@ -214,7 +215,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration
{
get
{
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
Editor editor = (Application.Instance as IHostApplication).CurrentWindow.GetCurrentEditor();
Document d = editor?.Document;
CollaborationPlugin plugin = (UserInterfacePlugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
CollaborationSettings collab = plugin.GetCollaborationSettings(d);
@ -222,7 +223,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration
}
set
{
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
Editor editor = (Application.Instance as IHostApplication).CurrentWindow.GetCurrentEditor();
Document d = editor?.Document;
CollaborationPlugin plugin = (UserInterfacePlugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
CollaborationSettings collab = plugin.GetCollaborationSettings(d);
@ -233,7 +234,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration
private void ed_PianoRoll_Paint(object sender, PaintEventArgs e)
{
// painting is handled by PianoRoll._vp, not PianoRollView!!!
SynthesizedAudioEditor editor = HostApplication.CurrentWindow.GetCurrentEditor() as SynthesizedAudioEditor;
SynthesizedAudioEditor editor = (Application.Instance as IHostApplication).CurrentWindow.GetCurrentEditor() as SynthesizedAudioEditor;
CollaborationPlugin plugin = (UserInterfacePlugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
CollaborationSettings collab = plugin.GetCollaborationSettings();
@ -253,7 +254,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration
private void ed_PianoRoll_NoteRendered(object sender, NoteRenderedEventArgs e)
{
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
Editor editor = (Application.Instance as IHostApplication).CurrentWindow.GetCurrentEditor();
Document d = editor?.Document;
CollaborationPlugin plugin = (UserInterfacePlugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
CollaborationSettings collab = plugin.GetCollaborationSettings(d);

View File

@ -23,7 +23,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using MBS.Framework;
using MBS.Framework.UserInterface;
using MBS.Framework.UserInterface.Controls;
using MBS.Framework.UserInterface.Controls.ListView;
@ -408,11 +408,11 @@ namespace UniversalEditor.Plugins.RavenSoftware.UserInterface.Editors.Icarus
private void LogOutputWindow(string text)
{
HostApplication.OutputWindow.WriteLine(text);
(Application.Instance as IHostApplication).OutputWindow.WriteLine(text);
}
private void ClearOutputWindow()
{
HostApplication.OutputWindow.Clear();
(Application.Instance as IHostApplication).OutputWindow.Clear();
}
private Dictionary<IcarusCommand, TreeModelRow> treeNodesForCommands = new Dictionary<IcarusCommand, TreeModelRow>();

View File

@ -19,6 +19,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using MBS.Framework;
using UniversalEditor.Accessors;
using UniversalEditor.IO;
using UniversalEditor.ObjectModels.FileSystem;
@ -75,7 +76,7 @@ namespace UniversalEditor.Plugins.Amiga.DataFormats.FileSystem.ADF
uint checksumVerify = CalculateChecksum(diskType, flags, rootblock, bootblock);
if (checksumVerify != checksum)
{
HostApplication.Messages.Add(HostApplicationMessageSeverity.Warning, "boot block checksum mismatch", Accessor.GetFileName());
(Application.Instance as IHostApplication).Messages.Add(HostApplicationMessageSeverity.Warning, "boot block checksum mismatch", Accessor.GetFileName());
}
reader.Seek(CalculateSectorOffset(rootblock), SeekOrigin.Begin);

View File

@ -34,7 +34,7 @@ namespace UniversalEditor.Plugins.Collaboration
{
if (document == null)
{
document = HostApplication.CurrentWindow?.GetCurrentEditor()?.Document;
document = (Application.Instance as IHostApplication).CurrentWindow?.GetCurrentEditor()?.Document;
}
if (!_CollaborationSettings.ContainsKey(document))
@ -50,7 +50,7 @@ namespace UniversalEditor.Plugins.Collaboration
Context = new UIContext(ID, "Collaboration Plugin");
Context.AttachCommandEventHandler("Collaboration_Tracking_Track", delegate (object sender, EventArgs e)
{
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
Editor editor = (Application.Instance as IHostApplication).CurrentWindow.GetCurrentEditor();
Document d = editor?.Document;
if (d != null)
{

View File

@ -20,9 +20,11 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.Collections.Generic;
using MBS.Framework;
using UniversalEditor.DataFormats.FileSystem.WinRAR.Blocks;
using UniversalEditor.IO;
using UniversalEditor.ObjectModels.FileSystem;
using UniversalEditor.UserInterface;
namespace UniversalEditor.DataFormats.FileSystem.WinRAR
{
@ -114,7 +116,7 @@ namespace UniversalEditor.DataFormats.FileSystem.WinRAR
if (!endOfArchiveReached)
{
UserInterface.HostApplication.Messages.Add(UserInterface.HostApplicationMessageSeverity.Warning, "end of file reached before end of archive marker", Accessor.GetFileName());
(Application.Instance as IHostApplication).Messages.Add(HostApplicationMessageSeverity.Warning, "end of file reached before end of archive marker", Accessor.GetFileName());
}
}

View File

@ -31,6 +31,7 @@ using UniversalEditor.ObjectModels.Project;
using UniversalEditor.DataFormats.Project.Microsoft.VisualStudio;
using System.Linq;
using System.Collections.Generic;
using MBS.Framework;
namespace UniversalEditor.DataFormats.Solution.Microsoft.VisualStudio
{
@ -96,7 +97,7 @@ namespace UniversalEditor.DataFormats.Solution.Microsoft.VisualStudio
{
if (!line.Contains("="))
{
HostApplication.Messages.Add(HostApplicationMessageSeverity.Warning, "Invalid Project declaration in solution file");
(Application.Instance as IHostApplication).Messages.Add(HostApplicationMessageSeverity.Warning, "Invalid Project declaration in solution file");
continue;
}
@ -151,7 +152,7 @@ namespace UniversalEditor.DataFormats.Solution.Microsoft.VisualStudio
}
else
{
HostApplication.Messages.Add(HostApplicationMessageSeverity.Warning, "Ignoring unknown solution directive \"" + line + "\"");
(Application.Instance as IHostApplication).Messages.Add(HostApplicationMessageSeverity.Warning, "Ignoring unknown solution directive \"" + line + "\"");
continue;
}
}

View File

@ -20,6 +20,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using MBS.Framework;
using UniversalEditor.IO;
using UniversalEditor.ObjectModels.PropertyList;
using UniversalEditor.UserInterface;
@ -65,7 +66,7 @@ namespace UniversalEditor.DataFormats.PropertyList.Registry
if (primarySequenceNumber != secondarySequenceNumber)
{
// do we wnnt to handle this as a fatal error?
HostApplication.Messages.Add(HostApplicationMessageSeverity.Warning, "Primary and secondary sequence number mismatch", base.Accessor.GetFileName());
(Application.Instance as IHostApplication).Messages.Add(HostApplicationMessageSeverity.Warning, "Primary and secondary sequence number mismatch", base.Accessor.GetFileName());
}
DateTime lastModifiedTimestamp = reader.ReadDateTime64(); // FILETIME

View File

@ -20,6 +20,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using MBS.Framework;
using UniversalEditor.IO;
using UniversalEditor.ObjectModels.Icarus;
using UniversalEditor.ObjectModels.Icarus.Commands;
@ -57,7 +58,7 @@ namespace UniversalEditor.DataFormats.Icarus
{
// we may or may not wish to throw InvalidDataFormatException here;
// since it's plain text we could still continue reading it like normal but all hell could break loose if we encounter something weird
HostApplication.Messages.Add(HostApplicationMessageSeverity.Warning, "This file has NOT ben written by a BehavEd-compatible program! This can mess up big-style if you load a programmer-script with nested statements, etc.", Accessor.GetFileName());
(Application.Instance as IHostApplication).Messages.Add(HostApplicationMessageSeverity.Warning, "This file has NOT ben written by a BehavEd-compatible program! This can mess up big-style if you load a programmer-script with nested statements, etc.", Accessor.GetFileName());
}
while (!reader.EndOfStream)

View File

@ -22,9 +22,10 @@
using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using MBS.Framework;
using UniversalEditor.IO;
using UniversalEditor.ObjectModels.FileSystem;
using UniversalEditor.UserInterface;
namespace UniversalEditor.Plugins.Sega.DataFormats.FileSystem.Sega.FARC
{
@ -204,7 +205,7 @@ namespace UniversalEditor.Plugins.Sega.DataFormats.FileSystem.Sega.FARC
}
if (!foundMatch)
{
UserInterface.HostApplication.Messages.Add(UserInterface.HostApplicationMessageSeverity.Warning, "No valid encryption keys were available to process this file", file.Name);
(Application.Instance as IHostApplication).Messages.Add(HostApplicationMessageSeverity.Warning, "No valid encryption keys were available to process this file", file.Name);
return;
}

View File

@ -61,6 +61,10 @@
<Project>{3F664673-7E22-4486-9AD0-FC81861D0B78}</Project>
<Name>UniversalEditor.Compression</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\MBS.Framework\MBS.Framework\MBS.Framework.csproj">
<Project>{00266B21-35C9-4A7F-A6BA-D54D7FDCC25C}</Project>
<Name>MBS.Framework</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="DataFormats\FileSystem\Sega\FARC\FARCDataFormat.uexml.exclude" />