mirror of
https://github.com/fadden/6502bench.git
synced 2025-01-20 14:31:17 +00:00
Load a hard-coded project file
Fixed some stuff that crashed. The project is loaded but nothing visually interesting happens yet. I'm still not entirely sure what the deal with declaring resources is, but it seems you can either declare a ResourceDictionary and put everything in it, or you can declare a bunch of items, which are then implicitly placed in a ResourceDictionary. This matters if you want to have your string definitions merged in with everything else. All of the examples I found did one thing or the other, not both at once, so it took some fiddling. Yay WPF.
This commit is contained in:
parent
ce27ae720e
commit
bf310d17bc
@ -19,9 +19,9 @@ limitations under the License.
|
||||
xmlns:local="clr-namespace:SourceGenWPF"
|
||||
StartupUri="ProjWin/MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
<FontFamily x:Key="GeneralMonoFont">Consolas</FontFamily>
|
||||
<ResourceDictionary>
|
||||
<FontFamily x:Key="GeneralMonoFont">Consolas</FontFamily>
|
||||
|
||||
<ResourceDictionary x:Key="whatever">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Res/Strings.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
@ -202,6 +202,12 @@ namespace SourceGenWPF {
|
||||
switch (mIdentLocation) {
|
||||
case Location.RuntimeDir:
|
||||
dir = RuntimeDataAccess.GetDirectory();
|
||||
if (string.IsNullOrEmpty(dir)) {
|
||||
// Could happen if we can't find the runtime data directory, though
|
||||
// we probably should've failed before now.
|
||||
Debug.Assert(false);
|
||||
return null;
|
||||
}
|
||||
subdirAllowed = true;
|
||||
break;
|
||||
case Location.ProjectDir:
|
||||
|
@ -184,9 +184,10 @@ namespace SourceGenWPF {
|
||||
|
||||
|
||||
public void OpenRecentProject(int projIndex) {
|
||||
//if (DoClose()) {
|
||||
// DoOpenFile(mRecentProjectPaths[projIndex]);
|
||||
//}
|
||||
if (DoClose()) {
|
||||
//DoOpenFile(mRecentProjectPaths[projIndex]);
|
||||
DoOpenFile(@"C:\Src\6502bench\EXTRA\ZIPPY#ff2000.dis65");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -42,6 +42,8 @@ namespace SourceGenWPF.ProjWin {
|
||||
public MainWindow() {
|
||||
InitializeComponent();
|
||||
|
||||
// TODO: verify that RuntimeData dir is accessible
|
||||
|
||||
mUI = new MainController();
|
||||
}
|
||||
|
||||
|
@ -620,7 +620,7 @@ namespace SourceGenWPF {
|
||||
}
|
||||
if (intKey < 0 || intKey + dfd.Length > spf.FileDataLength) {
|
||||
report.Add(FileLoadItem.Type.Warning,
|
||||
string.Format(Res.Strings.ERR_BAD_FD_FMT, intKey));
|
||||
string.Format(Res.Strings.ERR_BAD_FD, intKey));
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -675,7 +675,7 @@ namespace SourceGenWPF {
|
||||
subFormat = (FormatDescriptor.SubType)Enum.Parse(
|
||||
typeof(FormatDescriptor.SubType), sfd.SubFormat);
|
||||
} catch (ArgumentException) {
|
||||
report.Add(FileLoadItem.Type.Warning, Res.Strings.ERR_BAD_FD_TYPE +
|
||||
report.Add(FileLoadItem.Type.Warning, Res.Strings.ERR_BAD_FD_FORMAT +
|
||||
": " + sfd.Format + "/" + sfd.SubFormat);
|
||||
return false;
|
||||
}
|
||||
|
@ -3,8 +3,8 @@
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:local="clr-namespace:SourceGenWPF.Res">
|
||||
|
||||
<system:String x:Key="str_ErrBadFdFmt">Bad format descriptor at +{0:x6}.</system:String>
|
||||
<system:String x:Key="str_ErrBadFdType">Bad format descriptor type</system:String>
|
||||
<system:String x:Key="str_ErrBadFd">Bad format descriptor at +{0:x6}.</system:String>
|
||||
<system:String x:Key="str_ErrBadFdFormat">Bad format descriptor type</system:String>
|
||||
<system:String x:Key="str_ErrBadFileLength">Bad file length</system:String>
|
||||
<system:String x:Key="str_ErrBadIdent">Invalid file identifier</system:String>
|
||||
<system:String x:Key="str_ErrBadRange">Bad range</system:String>
|
||||
|
@ -18,10 +18,10 @@ using System.Windows;
|
||||
|
||||
namespace SourceGenWPF.Res {
|
||||
public static class Strings {
|
||||
public static string ERR_BAD_FD_FMT =
|
||||
(string)Application.Current.FindResource("str_ErrBadFdFmt");
|
||||
public static string ERR_BAD_FD_TYPE =
|
||||
(string)Application.Current.FindResource("str_ErrBadFdType");
|
||||
public static string ERR_BAD_FD =
|
||||
(string)Application.Current.FindResource("str_ErrBadFd");
|
||||
public static string ERR_BAD_FD_FORMAT =
|
||||
(string)Application.Current.FindResource("str_ErrBadFdFormat");
|
||||
public static string ERR_BAD_FILE_LENGTH =
|
||||
(string)Application.Current.FindResource("str_ErrBadFileLength");
|
||||
public static string ERR_BAD_IDENT =
|
||||
|
@ -55,7 +55,11 @@ namespace SourceGenWPF {
|
||||
return sBasePath;
|
||||
}
|
||||
|
||||
// Hack during development: remove bin/Debug, and convert SourceGenWPF to SourceGen.
|
||||
string upTwo = Path.GetDirectoryName(Path.GetDirectoryName(baseDir));
|
||||
if (upTwo.EndsWith("WPF")) {
|
||||
upTwo = upTwo.Substring(0, upTwo.Length - 3);
|
||||
}
|
||||
tryPath = Path.Combine(upTwo, RUNTIME_DATA_FILENAME);
|
||||
if (Directory.Exists(tryPath)) {
|
||||
sBasePath = Path.GetFullPath(tryPath);
|
||||
|
Loading…
x
Reference in New Issue
Block a user