HotFix: Open file from OS

This commit is contained in:
2025-05-27 03:40:34 +03:00
parent 57d4ecfd54
commit 37f2bb5eac
4 changed files with 14 additions and 13 deletions

View File

@@ -233,7 +233,7 @@ namespace McBitFont {
if (com && lines != 1 && fcount > 1) {
// Comments enabled and other than "1 symbol per line" selected
// Print a symbol comment before its data
output += " // " + f.code.ToString() + " --> " + mainForm.decodeSymbol(f.code) + "\n";
output += " // " + f.code.ToString() + " --> " + mainForm.DecodeSymbol(f.code) + "\n";
}
if (lines == 1) {
// "1 symbol per line" - new line offset
@@ -369,7 +369,7 @@ namespace McBitFont {
if (!f.Equals(flast) && f.width > 0) output += ",";
if (com && fcount > 1) {
//...with a comment
output += " // " + f.code.ToString() + " --> " + mainForm.decodeSymbol(f.code);
output += " // " + f.code.ToString() + " --> " + mainForm.DecodeSymbol(f.code);
}
output += "\n";
}

View File

@@ -70,6 +70,7 @@ namespace McBitFont {
public MainForm() {
InitializeComponent();
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
this.dotPanel.MouseWheel += new MouseEventHandler(this.DotPanel_MouseWheel);
}
@@ -118,7 +119,7 @@ namespace McBitFont {
tsmiCodeShift.Visible = frames.Count > 1;
CodeShiftToolStripMenuItem.Visible = frames.Count > 1;
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
}
[DllImport("user32.dll")]
@@ -681,14 +682,14 @@ namespace McBitFont {
Application.Exit();
}
public string decodeSymbol(int code) {
public string DecodeSymbol(int code) {
var enc = Encoding.GetEncoding(codepage);
if (code < 32) return "";
return enc.GetString(new byte[] { (byte)code });
}
private FrameMiniature DrawFrameChar(FrameMiniature ff, Font font, int sx, int sy) {
string s = decodeSymbol(ff.code);
string s = DecodeSymbol(ff.code);
Bitmap bmp = new Bitmap(ff.width, ff.height);
Graphics g = Graphics.FromImage(bmp);
g.Clear(Color.White);
@@ -766,7 +767,7 @@ namespace McBitFont {
foreach (FrameMiniature ff in frames) {
var s = ff.code.ToString().PadLeft(3, '0');
ilMiniatures.Images.Add(s, (Image)GetMiniPictue(ff));
var sss = decodeSymbol(ff.code);
var sss = DecodeSymbol(ff.code);
miniList.Items.Add(s, s + ' ' + append + sss, s);
}
f = CopyFrame(frames.First());
@@ -874,7 +875,7 @@ namespace McBitFont {
foreach (FrameMiniature ff in frames) {
var s = ff.code.ToString().PadLeft(3, '0');
var sHex = 'x' + Convert.ToString(ff.code, 16).PadLeft(2, '0').ToUpper();
var sss = decodeSymbol(ff.code);
var sss = DecodeSymbol(ff.code);
ilMiniatures.Images.Add(s, (Image)GetMiniPictue(ff));
miniList.Items.Add(s, (chkHexCodes.Checked ? sHex : s) + ' ' + sss, s);
}
@@ -968,7 +969,7 @@ namespace McBitFont {
var s = ff.code.ToString().PadLeft(3, '0');
ilMiniatures.Images.Add(s, (Image)GetMiniPictue(ff));
var sss = decodeSymbol(ff.code);
var sss = DecodeSymbol(ff.code);
miniList.Items.Add(s, s + ' ' + sss, s);
CheckForAdd();
}
@@ -1189,7 +1190,7 @@ namespace McBitFont {
frames[i] = ff;
var key = ff.code.ToString().PadLeft(3, '0');
var text = decodeSymbol(ff.code);
var text = DecodeSymbol(ff.code);
ilMiniatures.Images.Add(key, (Image)GetMiniPictue(ff));
miniList.Items.Add(key, key + ' ' + text, key);
}
@@ -1228,7 +1229,7 @@ namespace McBitFont {
if (frames.Count == 1) return;
foreach (ListViewItem item in miniList.Items) {
var code = Convert.ToInt32(item.ImageKey);
var symbol = decodeSymbol(code);
var symbol = DecodeSymbol(code);
if (chkHexCodes.Checked) {
var sHex = 'x' + Convert.ToString(code, 16).PadLeft(2, '0').ToUpper();
item.Text = sHex + ' ' + symbol;
@@ -1340,7 +1341,7 @@ namespace McBitFont {
var s = (last - first > 0) ? newf.code.ToString().PadLeft(3, '0') : "000";
var sHex = (last - first > 0) ? 'x' + Convert.ToString(newf.code, 16).PadLeft(2, '0').ToUpper() : "0x0";
var sss = (last - first > 0) ? decodeSymbol(newf.code) : "Single";
var sss = (last - first > 0) ? DecodeSymbol(newf.code) : "Single";
ilMiniatures.Images.Add(s, (Image)GetMiniPictue(newf));
miniList.Items.Add(s, (chkHexCodes.Checked ? sHex : s) + ' ' + sss, s);
}

View File

@@ -108,8 +108,8 @@ namespace McBitFont {
Bitmap bmp, result;
Graphics g;
chars[0] = mainForm.decodeSymbol((int)nudChar1.Value);
chars[1] = mainForm.decodeSymbol((int)nudChar2.Value);
chars[0] = mainForm.DecodeSymbol((int)nudChar1.Value);
chars[1] = mainForm.DecodeSymbol((int)nudChar2.Value);
for (int i = 0; i < 2; i++) {
bmp = new Bitmap((int)nudNewX.Value, (int)nudNewY.Value);
g = Graphics.FromImage(bmp);

Binary file not shown.