Ability to open a project by double-clicking on a file in Explorer
This commit is contained in:
@@ -89,6 +89,11 @@ namespace McBitFont {
|
|||||||
this.Text = "McBitFont " + version + " - " + prjName;
|
this.Text = "McBitFont " + version + " - " + prjName;
|
||||||
|
|
||||||
fbuf = new FrameMiniature(0, dotWidth, dotHeight);
|
fbuf = new FrameMiniature(0, dotWidth, dotHeight);
|
||||||
|
|
||||||
|
// Chek for arguments
|
||||||
|
if (Environment.GetCommandLineArgs().Length > 1) {
|
||||||
|
loadProject(Environment.GetCommandLineArgs()[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
@@ -654,18 +659,11 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void openToolStripMenuItem_Click(object sender, EventArgs e) {
|
private void loadProject(string filename) {
|
||||||
if (prjModified) {
|
|
||||||
if (MessageBox.Show("The project is modified.\nDo you want to save it first?", "Project was modified!", MessageBoxButtons.YesNo) == DialogResult.Yes) {
|
|
||||||
saveToolStripMenuItem.PerformClick();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (dlgOpen.ShowDialog() == DialogResult.OK) {
|
|
||||||
SaveBlock sav;
|
SaveBlock sav;
|
||||||
BinaryFormatter formatter = new BinaryFormatter();
|
BinaryFormatter formatter = new BinaryFormatter();
|
||||||
|
|
||||||
using (FileStream fs = File.Open(dlgOpen.FileName, FileMode.Open)) {
|
using (FileStream fs = File.Open(filename, FileMode.Open)) {
|
||||||
sav = (SaveBlock)formatter.Deserialize(fs);
|
sav = (SaveBlock)formatter.Deserialize(fs);
|
||||||
fs.Close();
|
fs.Close();
|
||||||
}
|
}
|
||||||
@@ -695,11 +693,22 @@ namespace McBitFont {
|
|||||||
modified = false;
|
modified = false;
|
||||||
prjModified = false;
|
prjModified = false;
|
||||||
|
|
||||||
prjName = Path.GetFileNameWithoutExtension(dlgOpen.FileName);
|
prjName = Path.GetFileNameWithoutExtension(filename);
|
||||||
this.Text = "McBitFont " + version + " - " + prjName;
|
this.Text = "McBitFont " + version + " - " + prjName;
|
||||||
checkForAdd();
|
checkForAdd();
|
||||||
fbuffer = false;
|
fbuffer = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void openToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||||
|
if (prjModified) {
|
||||||
|
if (MessageBox.Show("The project is modified.\nDo you want to save it first?", "Project was modified!", MessageBoxButtons.YesNo) == DialogResult.Yes) {
|
||||||
|
saveToolStripMenuItem.PerformClick();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (dlgOpen.ShowDialog() == DialogResult.OK) {
|
||||||
|
loadProject(dlgOpen.FileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeSymbolToolStripMenuItem_Click(object sender, EventArgs e) {
|
private void removeSymbolToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||||
|
Reference in New Issue
Block a user