33//using System.Drawing;
44//using System.Drawing.Text;
55using System . Globalization ;
6+ using System . Reflection ;
7+
68//using System.Security.Policy;
79using System . Text . RegularExpressions ;
810//using System.Xml;
@@ -14,11 +16,11 @@ namespace CStat
1416 /// </summary>
1517 public partial class Form1 : Form
1618 {
17- //public System.Diagnostics.Process p = new System.Diagnostics.Process();
18-
1919 private bool act = false ;
2020 private int entryMode ;
2121 private int statCode ;
22+ private readonly string AppName = Assembly . GetEntryAssembly ( ) ! . GetName ( ) . Name ! ;
23+ private readonly string AppVersion = Assembly . GetEntryAssembly ( ) ! . GetName ( ) . Version ! . ToString ( ) ;
2224 private readonly Regex rHex = new Regex ( "^0x" , RegexOptions . IgnoreCase ) ;
2325 private readonly Regex rBin = new Regex ( "^0b" , RegexOptions . IgnoreCase ) ;
2426 private readonly Regex rSpace = new Regex ( @"\s" , RegexOptions . IgnoreCase ) ;
@@ -66,7 +68,7 @@ public partial class Form1 : Form
6668 private readonly String [ ] cKey = { "P" , "" , "F" , "E" , "F" , "F" , "R" , "T" , "T" , "" , "" , "" , "" , "" , "" , "" } ;
6769
6870 /// <summary>
69- /// Calculate cstat/flags for Mapster32 or EDuke32
71+ /// Calculate cstat/flags for Mapster32 or EDuke32 - main form
7072 /// </summary>
7173 public Form1 ( )
7274 {
@@ -78,6 +80,8 @@ public Form1()
7880 rtbInfo . Text = "Information from https://wiki.eduke32.com/wiki/Cstat_(sprite)," +
7981 " https://wiki.eduke32.com/wiki/Cstat_(wall)" + Environment . NewLine +
8082 "and https://voidpoint.io/terminx/eduke32/-/blob/master/source/build/include/buildtypes.h" ;
83+
84+ aboutToolStripMenuItem . Text = "&About " + AppName ;
8185 }
8286
8387 private void InitLV ( )
@@ -386,5 +390,48 @@ private void LV_ItemChecked(object sender, ItemCheckedEventArgs e)
386390 {
387391 enableClear ( ) ;
388392 }
393+
394+ private void aboutToolStripMenuItem_Click ( object sender , EventArgs e )
395+ {
396+ string s = AppName + " v" + AppVersion + " by Steven J Stover" + Environment . NewLine +
397+ "Copyright 2024, licensed under GPL v2.0" ;
398+ MessageBox . Show ( s , "About " + AppName ) ;
399+ }
400+
401+ /// <summary>
402+ /// CStat Help form instantiation
403+ /// </summary>
404+ public Form Frm = null ! ;
405+ bool isFrmOpen = false ;
406+ private void viewHelpToolStripMenuItem_Click ( object sender , EventArgs e )
407+ {
408+
409+ if ( isFrmOpen )
410+ {
411+ if ( Frm . WindowState == FormWindowState . Minimized )
412+ Frm . WindowState = FormWindowState . Normal ;
413+ else
414+ Frm . Focus ( ) ;
415+ }
416+ else
417+ {
418+ Frm = new Form2 ( ) ;
419+ isFrmOpen = true ;
420+ Frm . FormClosed += new FormClosedEventHandler ( Frm_FormClosed ! ) ;
421+ Frm . Show ( ) ;
422+ }
423+
424+ }
425+ void Frm_FormClosed ( object sender , FormClosedEventArgs e )
426+ {
427+ //var frm = sender as Form2;
428+ // Do something with <frm>
429+ isFrmOpen = false ;
430+ }
431+
432+ private void exitToolStripMenuItem_Click ( object sender , EventArgs e )
433+ {
434+ Application . Exit ( ) ;
435+ }
389436 }
390437}
0 commit comments