diff --git a/SourceGenWPF/MainController.cs b/SourceGenWPF/MainController.cs index 6c2eac1..0ac8610 100644 --- a/SourceGenWPF/MainController.cs +++ b/SourceGenWPF/MainController.cs @@ -775,6 +775,38 @@ namespace SourceGenWPF { #region Main window UI event handlers + public void NewProject() { + if (!CloseProject()) { + return; + } + + string sysDefsPath = RuntimeDataAccess.GetPathName("SystemDefs.json"); + if (sysDefsPath == null) { + MessageBox.Show(Res.Strings.ERR_LOAD_CONFIG_FILE, Res.Strings.OPERATION_FAILED, + MessageBoxButton.OK, MessageBoxImage.Error); + return; + } + + SystemDefSet sds = null; + try { + sds = SystemDefSet.ReadFile(sysDefsPath); + } catch (Exception ex) { + Debug.WriteLine("Failed loading system def set: " + ex); + MessageBox.Show(Res.Strings.ERR_LOAD_CONFIG_FILE, Res.Strings.OPERATION_FAILED, + MessageBoxButton.OK, MessageBoxImage.Error); + return; + } + + NewProject dlg = new NewProject(mMainWin, sds); + if (dlg.ShowDialog() != true) { + return; + } + bool ok = PrepareNewProject(Path.GetFullPath(dlg.DataFileName), dlg.SystemDef); + if (ok) { + FinishPrep(); + } + } + public void OpenRecentProject(int projIndex) { if (!CloseProject()) { return; diff --git a/SourceGenWPF/Res/Strings.xaml b/SourceGenWPF/Res/Strings.xaml index 5d047f0..a0f63c7 100644 --- a/SourceGenWPF/Res/Strings.xaml +++ b/SourceGenWPF/Res/Strings.xaml @@ -35,6 +35,8 @@ limitations under the License. Cannot write to read-only file {0}. Could not convert value to integer Key value is out of range + - INVALID DEFINITION + Unable to load config file This does not appear to be a valid .dis65 project file Project file may be corrupt Unable to load project file @@ -43,6 +45,7 @@ limitations under the License. C# Source Files(*.cs)|*.cs SourceGen projects(*.dis65)|*.dis65 SourceGen symbols (*.sym65)|*.sym65 + File is {0:N1} KB of raw data. Target assembler: {0} v{1} [{2}] •Operand format is {0} Line {0}: {1} diff --git a/SourceGenWPF/Res/Strings.xaml.cs b/SourceGenWPF/Res/Strings.xaml.cs index 62810d9..fa0e70a 100644 --- a/SourceGenWPF/Res/Strings.xaml.cs +++ b/SourceGenWPF/Res/Strings.xaml.cs @@ -50,6 +50,10 @@ namespace SourceGenWPF.Res { (string)Application.Current.FindResource("str_ErrInvalidIntValue"); public static string ERR_INVALID_KEY_VALUE = (string)Application.Current.FindResource("str_ErrInvalidKeyValue"); + public static string ERR_INVALID_SYSDEF = + (string)Application.Current.FindResource("str_ErrInvalidSysdef"); + public static string ERR_LOAD_CONFIG_FILE = + (string)Application.Current.FindResource("str_ErrLoadConfigFile"); public static string ERR_NOT_PROJECT_FILE = (string)Application.Current.FindResource("str_ErrNotProjectFile"); public static string ERR_PROJECT_FILE_CORRUPT = @@ -66,6 +70,8 @@ namespace SourceGenWPF.Res { (string)Application.Current.FindResource("str_FileFilterDis65"); public static string FILE_FILTER_SYM65 = (string)Application.Current.FindResource("str_FileFilterSym65"); + public static string FILE_INFO_FMT = + (string)Application.Current.FindResource("str_FileInfoFmt"); public static string GENERATED_FOR_VERSION_FMT = (string)Application.Current.FindResource("str_GeneratedForVersion"); public static string INFO_FD_SUM_FMT = diff --git a/SourceGenWPF/SourceGenWPF.csproj b/SourceGenWPF/SourceGenWPF.csproj index 58745c4..897816b 100644 --- a/SourceGenWPF/SourceGenWPF.csproj +++ b/SourceGenWPF/SourceGenWPF.csproj @@ -87,6 +87,9 @@ EditStatusFlags.xaml + + NewProject.xaml + ProjectLoadIssue.xaml @@ -179,6 +182,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/SourceGenWPF/WpfGui/MainWindow.xaml b/SourceGenWPF/WpfGui/MainWindow.xaml index 47ae25b..c84b862 100644 --- a/SourceGenWPF/WpfGui/MainWindow.xaml +++ b/SourceGenWPF/WpfGui/MainWindow.xaml @@ -71,6 +71,7 @@ limitations under the License. Ctrl+Shift+Minus + @@ -119,6 +120,8 @@ limitations under the License. CanExecute="CanNavigateBackward" Executed="NavigateBackwardCmd_Executed"/> + - + @@ -351,7 +354,8 @@ limitations under the License. - + (filename) + + (details) + + + + +