Command line switches

This commit is contained in:
Vichingo455 2022-03-07 17:19:31 +01:00
parent 0e579459fc
commit 66726b87c7
2 changed files with 14 additions and 2 deletions

View File

@ -253,7 +253,10 @@ namespace Notepad
private void Form1_Load(object sender, EventArgs e)
{
if (File.Exists(Global.savefilename))
{
text_area.Text = File.ReadAllText(Global.savefilename);
}
}
private void aboutWindowsToolStripMenuItem_Click(object sender, EventArgs e)

View File

@ -5,6 +5,7 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using System.Web;
using System.Diagnostics;
using System.IO;
namespace Notepad
{
@ -35,10 +36,18 @@ namespace Notepad
/// Punto di ingresso principale dell'applicazione.
/// </summary>
[STAThread]
static void Main()
static void Main(string[] switches)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if (switches.Length == 1)
{
string arg = switches[0].Trim();
if (File.Exists(arg))
{
Global.savefilename = arg;
}
}
Application.Run(new Form1());
}
}