Improve CLI, update workflow and update Be.Windows.Forms.HexBox to 1.6.0

This commit is contained in:
fangrong 2024-08-02 10:19:51 +08:00
parent ffc7347d80
commit 5f426654f6
17 changed files with 544 additions and 76 deletions

View File

@ -15,22 +15,22 @@ jobs:
Solution_Name: Tinke.sln
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@main
- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@main
with:
dotnet-version: 6.0.x
# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v1.1.3
uses: microsoft/setup-msbuild@main
# Build
- name: Build
run: |
./compile.bat Release x86
- uses: actions/upload-artifact@master
- uses: actions/upload-artifact@main
with:
name: TinkeDSi-nightly-x86
path: build

View File

@ -15,22 +15,22 @@ jobs:
Solution_Name: Tinke.sln
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@main
- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@main
with:
dotnet-version: 6.0.x
# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v1.1.3
uses: microsoft/setup-msbuild@main
# Build
- name: Build
run: |
./compile.bat Release x64
- uses: actions/upload-artifact@master
- uses: actions/upload-artifact@main
with:
name: TinkeDSi-nightly
path: build

View File

@ -12,7 +12,7 @@ jobs:
container: mono:latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@main
- name: Setup build toolchain
run: |
@ -31,7 +31,7 @@ jobs:
mkbundle --deps Tinke.exe -o TinkeDSi --cross mono-6.8.0-ubuntu-16.04-x64 --i18n all -z --static
shell: bash
- uses: actions/upload-artifact@master
- uses: actions/upload-artifact@main
with:
name: TinkeDSi-nightly-mono
path: build

View File

@ -29,7 +29,7 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.4.7.*")]
[assembly: AssemblyVersion("1.6.0.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the

View File

@ -116,6 +116,7 @@
<Compile Include="FileDataBlock.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="FindOptions.cs" />
<Compile Include="HexBox.cs">
<SubType>Component</SubType>
</Compile>

View File

@ -82,7 +82,7 @@ namespace Be.Windows.Forms
_contextMenuStrip = cms;
}
if (this._hexBox.ByteProvider == null && this._hexBox.ContextMenuStrip != null)
if (this._hexBox.ByteProvider == null && this._hexBox.ContextMenuStrip == this._contextMenuStrip)
this._hexBox.ContextMenuStrip = null;
else if (this._hexBox.ByteProvider != null && this._hexBox.ContextMenuStrip == null)
this._hexBox.ContextMenuStrip = _contextMenuStrip;

View File

@ -55,7 +55,7 @@ namespace Be.Windows.Forms
/// <returns></returns>
public override string ToString()
{
return "Default";
return "ANSI (Default)";
}
}

View File

@ -0,0 +1,94 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Be.Windows.Forms
{
/// <summary>
/// Defines the type of the Find operation.
/// </summary>
public enum FindType
{
/// <summary>
/// Used for Text Find operations
/// </summary>
Text,
/// <summary>
/// Used for Hex Find operations
/// </summary>
Hex
}
/// <summary>
/// Defines all state information nee
/// </summary>
public class FindOptions
{
/// <summary>
/// Gets or sets whether the Find options are valid
/// </summary>
public bool IsValid { get; set; }
/// <summary>
/// Gets the Find buffer used for case insensitive Find operations. This is the binary representation of Text.
/// </summary>
internal byte[] FindBuffer { get; private set; }
/// <summary>
/// Gets the Find buffer used for case sensitive Find operations. This is the binary representation of Text in lower case format.
/// </summary>
internal byte[] FindBufferLowerCase { get; private set; }
/// <summary>
/// Gets the Find buffer used for case sensitive Find operations. This is the binary representation of Text in upper case format.
/// </summary>
internal byte[] FindBufferUpperCase { get; private set; }
/// <summary>
/// Contains the MatchCase value
/// </summary>
bool _matchCase;
/// <summary>
/// Gets or sets the value, whether the Find operation is case sensitive or not.
/// </summary>
public bool MatchCase
{
get { return _matchCase; }
set
{
_matchCase = value;
UpdateFindBuffer();
}
}
/// <summary>
/// Contains the text that should be found.
/// </summary>
string _text;
/// <summary>
/// Gets or sets the text that should be found. Only used, when Type is FindType.Hex.
/// </summary>
public string Text
{
get { return _text; }
set
{
_text = value;
UpdateFindBuffer();
}
}
/// <summary>
/// Gets or sets the hex buffer that should be found. Only used, when Type is FindType.Hex.
/// </summary>
public byte[] Hex { get; set; }
/// <summary>
/// Gets or sets the type what should be searched.
/// </summary>
public FindType Type { get; set; }
/// <summary>
/// Updates the find buffer.
/// </summary>
void UpdateFindBuffer()
{
string text = this.Text != null ? this.Text : string.Empty;
FindBuffer = ASCIIEncoding.ASCII.GetBytes(text);
FindBufferLowerCase = ASCIIEncoding.ASCII.GetBytes(text.ToLower());
FindBufferUpperCase = ASCIIEncoding.ASCII.GetBytes(text.ToUpper());
}
}
}

View File

@ -1106,6 +1106,10 @@ namespace Be.Windows.Forms
/// </summary>
Rectangle _recLineInfo;
/// <summary>
/// Contains the column info header rectangle bounds
/// </summary>
Rectangle _recColumnInfo;
/// <summary>
/// Contains the hex data bounds
/// </summary>
Rectangle _recHex;
@ -1118,11 +1122,6 @@ namespace Be.Windows.Forms
/// Contains string format information for text drawing
/// </summary>
StringFormat _stringFormat;
/// <summary>
/// Contains the width and height of a single char
/// </summary>
SizeF _charSize;
/// <summary>
/// Contains the maximum of visible horizontal bytes
/// </summary>
@ -1283,6 +1282,16 @@ namespace Be.Windows.Forms
[Description("Occurs, when the value of LineInfoVisible property has changed.")]
public event EventHandler LineInfoVisibleChanged;
/// <summary>
/// Occurs, when the value of ColumnInfoVisibleChanged property has changed.
/// </summary>
[Description("Occurs, when the value of ColumnInfoVisibleChanged property has changed.")]
public event EventHandler ColumnInfoVisibleChanged;
/// <summary>
/// Occurs, when the value of GroupSeparatorVisibleChanged property has changed.
/// </summary>
[Description("Occurs, when the value of GroupSeparatorVisibleChanged property has changed.")]
public event EventHandler GroupSeparatorVisibleChanged;
/// <summary>
/// Occurs, when the value of StringViewVisible property has changed.
/// </summary>
[Description("Occurs, when the value of StringViewVisible property has changed.")]
@ -1293,6 +1302,11 @@ namespace Be.Windows.Forms
[Description("Occurs, when the value of BorderStyle property has changed.")]
public event EventHandler BorderStyleChanged;
/// <summary>
/// Occurs, when the value of ColumnWidth property has changed.
/// </summary>
[Description("Occurs, when the value of GroupSize property has changed.")]
public event EventHandler GroupSizeChanged;
/// <summary>
/// Occurs, when the value of BytesPerLine property has changed.
/// </summary>
[Description("Occurs, when the value of BytesPerLine property has changed.")]
@ -1342,6 +1356,16 @@ namespace Be.Windows.Forms
/// </summary>
[Description("Occurs, when CopyHex method was invoked and ClipBoardData changed.")]
public event EventHandler CopiedHex;
/// <summary>
/// Occurs, when the CharSize property has changed
/// </summary>
[Description("Occurs, when the CharSize property has changed")]
public event EventHandler CharSizeChanged;
/// <summary>
/// Occurs, when the RequiredWidth property changes
/// </summary>
[Description("Occurs, when the RequiredWidth property changes")]
public event EventHandler RequiredWidthChanged;
#endregion
#region Ctors
@ -1357,7 +1381,7 @@ namespace Be.Windows.Forms
this._builtInContextMenu = new BuiltInContextMenu(this);
BackColor = Color.White;
Font = new Font("Courier New", 9F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
Font = SystemFonts.MessageBoxFont;
_stringFormat = new StringFormat(StringFormat.GenericTypographic);
_stringFormat.FormatFlags = StringFormatFlags.MeasureTrailingSpaces;
@ -1485,11 +1509,11 @@ namespace Be.Windows.Forms
_vScrollBar.Minimum = 0;
_vScrollBar.Maximum = max;
_vScrollBar.Value = ToScrollPos(_scrollVpos);
_vScrollBar.Enabled = true;
_vScrollBar.Visible = true;
}
else
{
_vScrollBar.Enabled = false;
_vScrollBar.Visible = false;
}
}
@ -1920,11 +1944,83 @@ namespace Be.Windows.Forms
/// <summary>
/// Searches the current ByteProvider
/// </summary>
/// <param name="bytes">the array of bytes to find</param>
/// <param name="startIndex">the start index</param>
/// <param name="options">contains all find options</param>
/// <returns>the SelectionStart property value if find was successfull or
/// -1 if there is no match
/// -2 if Find was aborted.</returns>
public long Find(FindOptions options)
{
var startIndex = this.SelectionStart + this.SelectionLength;
int match = 0;
byte[] buffer1 = null;
byte[] buffer2 = null;
if (options.Type == FindType.Text && options.MatchCase)
{
if(options.FindBuffer == null || options.FindBuffer.Length == 0)
throw new ArgumentException("FindBuffer can not be null when Type: Text and MatchCase: false");
buffer1 = options.FindBuffer;
}
else if (options.Type == FindType.Text && !options.MatchCase)
{
if(options.FindBufferLowerCase == null || options.FindBufferLowerCase.Length == 0)
throw new ArgumentException("FindBufferLowerCase can not be null when Type is Text and MatchCase is true");
if(options.FindBufferUpperCase == null || options.FindBufferUpperCase.Length == 0)
throw new ArgumentException("FindBufferUpperCase can not be null when Type is Text and MatchCase is true");
if(options.FindBufferLowerCase.Length != options.FindBufferUpperCase.Length)
throw new ArgumentException("FindBufferUpperCase and FindBufferUpperCase must have the same size when Type is Text and MatchCase is true");
buffer1 = options.FindBufferLowerCase;
buffer2 = options.FindBufferUpperCase;
}
else if (options.Type == FindType.Hex)
{
if(options.Hex == null || options.Hex.Length == 0)
throw new ArgumentException("Hex can not be null when Type is Hex");
buffer1 = options.Hex;
}
int buffer1Length = buffer1.Length;
_abortFind = false;
for (long pos = startIndex; pos < _byteProvider.Length; pos++)
{
if (_abortFind)
return -2;
if (pos % 1000 == 0) // for performance reasons: DoEvents only 1 times per 1000 loops
Application.DoEvents();
byte compareByte = _byteProvider.ReadByte(pos);
bool buffer1Match = compareByte == buffer1[match];
bool hasBuffer2 = buffer2 != null;
bool buffer2Match = hasBuffer2 ? compareByte == buffer2[match] : false;
bool isMatch = buffer1Match || buffer2Match;
if (!isMatch)
{
pos -= match;
match = 0;
_findingPos = pos;
continue;
}
match++;
if (match == buffer1Length)
{
long bytePos = pos - buffer1Length + 1;
Select(bytePos, buffer1Length);
ScrollByteIntoView(_bytePos + _selectionLength);
ScrollByteIntoView(_bytePos);
return bytePos;
}
}
return -1;
}
public long Find(byte[] bytes, long startIndex)
{
int match = 0;
@ -1963,6 +2059,7 @@ namespace Be.Windows.Forms
return -1;
}
public long Find_Prv(byte[] bytes, long endIndex)
{
int bytesLength = bytes.Length;
@ -2351,6 +2448,10 @@ namespace Be.Windows.Forms
if(_shadowSelectionVisible)
PaintCurrentBytesSign(e.Graphics);
}
if (_columnInfoVisible)
PaintHeaderRow(e.Graphics);
if (_groupSeparatorVisible)
PaintColumnSeparator(e.Graphics);
}
@ -2359,10 +2460,10 @@ namespace Be.Windows.Forms
// Ensure endByte isn't > length of array.
endByte = Math.Min(_byteProvider.Length-1, endByte);
Color lineInfoColor = (this.LineInfoForeColor != Color.Empty) ? this.LineInfoForeColor : this.ForeColor;
Color lineInfoColor = (this.InfoForeColor != Color.Empty) ? this.InfoForeColor : this.ForeColor;
Brush brush = new SolidBrush(lineInfoColor);
int maxLine = GetGridBytePoint(endByte-startByte).Y+1;
int maxLine = GetGridBytePoint(endByte - startByte).Y + 1;
for(int i = 0; i < maxLine; i++)
{
@ -2385,6 +2486,32 @@ namespace Be.Windows.Forms
}
}
void PaintHeaderRow(Graphics g)
{
Brush brush = new SolidBrush(this.InfoForeColor);
for (int col = 0; col < _iHexMaxHBytes; col++)
{
PaintColumnInfo(g, (byte)col, brush, col);
}
}
void PaintColumnSeparator(Graphics g)
{
for (int col = GroupSize; col < _iHexMaxHBytes; col += GroupSize)
{
var pen = new Pen(new SolidBrush(this.InfoForeColor), 1);
PointF headerPointF = GetColumnInfoPointF(col);
headerPointF.X -= _charSize.Width / 2;
g.DrawLine(pen, headerPointF, new PointF(headerPointF.X, headerPointF.Y + _recColumnInfo.Height + _recHex.Height));
if (StringViewVisible)
{
PointF byteStringPointF = GetByteStringPointF(new Point(col, 0));
headerPointF.X -= 2;
g.DrawLine(pen, new PointF(byteStringPointF.X, byteStringPointF.Y), new PointF(byteStringPointF.X, byteStringPointF.Y + _recHex.Height));
}
}
}
void PaintHex(Graphics g, long startByte, long endByte)
{
Brush brush = new SolidBrush(GetDefaultForeColor());
@ -2423,7 +2550,18 @@ namespace Be.Windows.Forms
g.DrawString(sB.Substring(0,1), Font, brush, bytePointF, _stringFormat);
bytePointF.X += _charSize.Width;
g.DrawString(sB.Substring(1,1), Font, brush, bytePointF, _stringFormat);
g.DrawString(sB.Substring(1, 1), Font, brush, bytePointF, _stringFormat);
}
void PaintColumnInfo(Graphics g, byte b, Brush brush, int col)
{
PointF headerPointF = GetColumnInfoPointF(col);
string sB = ConvertByteToHex(b);
g.DrawString(sB.Substring(0, 1), Font, brush, headerPointF, _stringFormat);
headerPointF.X += _charSize.Width;
g.DrawString(sB.Substring(1, 1), Font, brush, headerPointF, _stringFormat);
}
void PaintHexStringSelected(Graphics g, byte b, Brush brush, Brush brushBack, Point gridPoint)
@ -2489,7 +2627,7 @@ namespace Be.Windows.Forms
void PaintCurrentBytesSign(Graphics g)
{
if(_keyInterpreter != null && Focused && _bytePos != -1 && Enabled)
if (_keyInterpreter != null && _bytePos != -1 && Enabled)
{
if(_keyInterpreter.GetType() == typeof(KeyInterpreter))
{
@ -2688,8 +2826,14 @@ namespace Be.Windows.Forms
void UpdateRectanglePositioning()
{
// calc char size
SizeF charSize = this.CreateGraphics().MeasureString("A", Font, 100, _stringFormat);
_charSize = new SizeF((float)Math.Ceiling(charSize.Width), (float)Math.Ceiling(charSize.Height));
SizeF charSize;
using (var graphics = this.CreateGraphics())
{
charSize = this.CreateGraphics().MeasureString("A", Font, 100, _stringFormat);
}
CharSize = new SizeF((float)Math.Ceiling(charSize.Width), (float)Math.Ceiling(charSize.Height));
int requiredWidth = 0;
// calc content bounds
_recContent = ClientRectangle;
@ -2704,6 +2848,7 @@ namespace Be.Windows.Forms
_vScrollBar.Left = _recContent.X+_recContent.Width;
_vScrollBar.Top = _recContent.Y;
_vScrollBar.Height = _recContent.Height;
requiredWidth += _vScrollBar.Width;
}
int marginLeft = 4;
@ -2715,31 +2860,59 @@ namespace Be.Windows.Forms
_recContent.Y,
(int)(_charSize.Width*10),
_recContent.Height);
requiredWidth += _recLineInfo.Width;
}
else
{
_recLineInfo = Rectangle.Empty;
_recLineInfo.X = marginLeft;
requiredWidth += marginLeft;
}
// calc line info bounds
_recColumnInfo = new Rectangle(_recLineInfo.X + _recLineInfo.Width, _recContent.Y, _recContent.Width - _recLineInfo.Width, (int)charSize.Height + 4);
if (_columnInfoVisible)
{
_recLineInfo.Y += (int)charSize.Height + 4;
_recLineInfo.Height -= (int)charSize.Height + 4;
}
else
{
_recColumnInfo.Height = 0;
}
// calc hex bounds and grid
_recHex = new Rectangle(_recLineInfo.X + _recLineInfo.Width,
_recLineInfo.Y,
_recContent.Width - _recLineInfo.Width,
_recContent.Height);
_recContent.Height - _recColumnInfo.Height);
if(UseFixedBytesPerLine)
{
SetHorizontalByteCount(_bytesPerLine);
_recHex.Width = (int)Math.Floor(((double)_iHexMaxHBytes)*_charSize.Width*3+(2*_charSize.Width));
_recHex.Width = (int)Math.Floor(((double)_iHexMaxHBytes) * _charSize.Width * 3 + (2 * _charSize.Width));
requiredWidth += _recHex.Width;
}
else
{
int hmax = (int)Math.Floor((double)_recHex.Width/(double)_charSize.Width);
if(hmax > 1)
SetHorizontalByteCount((int)Math.Floor((double)hmax/3));
int hmax = (int)Math.Floor((double)_recHex.Width / (double)_charSize.Width);
if (_stringViewVisible)
{
hmax -= 2;
if (hmax > 1)
SetHorizontalByteCount((int)Math.Floor((double)hmax / 4));
else
SetHorizontalByteCount(hmax);
SetHorizontalByteCount(1);
}
else
{
if (hmax > 1)
SetHorizontalByteCount((int)Math.Floor((double)hmax / 3));
else
SetHorizontalByteCount(1);
}
_recHex.Width = (int)Math.Floor(((double)_iHexMaxHBytes) * _charSize.Width * 3 + (2 * _charSize.Width));
requiredWidth += _recHex.Width;
}
if(_stringViewVisible)
@ -2748,12 +2921,15 @@ namespace Be.Windows.Forms
_recHex.Y,
(int)(_charSize.Width*_iHexMaxHBytes),
_recHex.Height);
requiredWidth += _recStringView.Width;
}
else
{
_recStringView = Rectangle.Empty;
}
RequiredWidth = requiredWidth;
int vmax = (int)Math.Floor((double)_recHex.Height/(double)_charSize.Height);
SetVerticalByteCount(vmax);
@ -2772,7 +2948,15 @@ namespace Be.Windows.Forms
PointF GetBytePointF(Point gp)
{
float x = (3 * _charSize.Width) * gp.X + _recHex.X;
float y = (gp.Y+1)*_charSize.Height-_charSize.Height+_recHex.Y;
float y = (gp.Y + 1) * _charSize.Height - _charSize.Height + _recHex.Y;
return new PointF(x, y);
}
PointF GetColumnInfoPointF(int col)
{
Point gp = GetGridBytePoint(col);
float x = (3 * _charSize.Width) * gp.X + _recColumnInfo.X;
float y = _recColumnInfo.Y;
return new PointF(x,y);
}
@ -2823,7 +3007,12 @@ namespace Be.Windows.Forms
}
set
{
if (value == null)
return;
base.Font = value;
this.UpdateRectanglePositioning();
this.Invalidate();
}
}
@ -2921,6 +3110,28 @@ namespace Be.Windows.Forms
}
} int _bytesPerLine = 16;
/// <summary>
/// Gets or sets the number of bytes in a group. Used to show the group separator line (if GroupSeparatorVisible is true)
/// </summary>
/// <remarks>
/// GroupSeparatorVisible property must set to true
/// </remarks>
[DefaultValue(4), Category("Hex"), Description("Gets or sets the byte-count between group separators (if visible).")]
public int GroupSize
{
get { return _groupSize; }
set
{
if (_groupSize == value)
return;
_groupSize = value;
OnGroupSizeChanged(EventArgs.Empty);
UpdateRectanglePositioning();
Invalidate();
}
} int _groupSize = 4;
/// <summary>
/// Gets or sets if the count of bytes in one line is fix.
/// </summary>
@ -3028,6 +3239,45 @@ namespace Be.Windows.Forms
}
IByteProvider _byteProvider;
/// <summary>
/// Gets or sets the visibility of the group separator.
/// </summary>
[DefaultValue(false), Category("Hex"), Description("Gets or sets the visibility of a separator vertical line.")]
public bool GroupSeparatorVisible
{
get { return _groupSeparatorVisible; }
set
{
if (_groupSeparatorVisible == value)
return;
_groupSeparatorVisible = value;
OnGroupSeparatorVisibleChanged(EventArgs.Empty);
UpdateRectanglePositioning();
Invalidate();
}
} bool _groupSeparatorVisible = false;
/// <summary>
/// Gets or sets the visibility of the column info
/// </summary>
[DefaultValue(false), Category("Hex"), Description("Gets or sets the visibility of header row.")]
public bool ColumnInfoVisible
{
get { return _columnInfoVisible; }
set
{
if (_columnInfoVisible == value)
return;
_columnInfoVisible = value;
OnColumnInfoVisibleChanged(EventArgs.Empty);
UpdateRectanglePositioning();
Invalidate();
}
} bool _columnInfoVisible = false;
/// <summary>
/// Gets or sets the visibility of a line info.
@ -3047,7 +3297,7 @@ namespace Be.Windows.Forms
UpdateRectanglePositioning();
Invalidate();
}
} bool _lineInfoVisible;
} bool _lineInfoVisible = false;
/// <summary>
/// Gets or sets the offset of a line info.
@ -3065,7 +3315,7 @@ namespace Be.Windows.Forms
Invalidate();
}
} long _lineInfoOffset;
} long _lineInfoOffset = 0;
/// <summary>
/// Gets or sets the hex box´s border style.
@ -3184,14 +3434,14 @@ namespace Be.Windows.Forms
/// <summary>
/// Gets or sets the line info color. When this property is null, then ForeColor property is used.
/// Gets or sets the info color used for column info and line info. When this property is null, then ForeColor property is used.
/// </summary>
[DefaultValue(typeof(Color), "Empty"), Category("Hex"), Description("Gets or sets the line info color. When this property is null, then ForeColor property is used.")]
public Color LineInfoForeColor
[DefaultValue(typeof(Color), "Gray"), Category("Hex"), Description("Gets or sets the line info color. When this property is null, then ForeColor property is used.")]
public Color InfoForeColor
{
get { return _lineInfoForeColor; }
set { _lineInfoForeColor = value; Invalidate(); }
} Color _lineInfoForeColor = Color.Empty;
get { return _infoForeColor; }
set { _infoForeColor = value; Invalidate(); }
} Color _infoForeColor = Color.Gray;
/// <summary>
/// Gets or sets the background color for the selected bytes.
@ -3243,6 +3493,40 @@ namespace Be.Windows.Forms
set { _shadowSelectionColor = value; Invalidate(); }
} Color _shadowSelectionColor = Color.FromArgb(100, 60, 188, 255);
/// <summary>
/// Contains the size of a single character in pixel
/// </summary>
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public SizeF CharSize
{
get { return _charSize; }
private set
{
if (_charSize == value)
return;
_charSize = value;
if (CharSizeChanged != null)
CharSizeChanged(this, EventArgs.Empty);
}
} SizeF _charSize;
/// <summary>
/// Gets the width required for the content
/// </summary>
[DefaultValue(0), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public int RequiredWidth
{
get { return _requiredWidth; }
private set
{
if (_requiredWidth == value)
return;
_requiredWidth = value;
if (RequiredWidthChanged != null)
RequiredWidthChanged(this, EventArgs.Empty);
}
} int _requiredWidth;
/// <summary>
/// Gets the number bytes drawn horizontally.
/// </summary>
@ -3543,6 +3827,26 @@ namespace Be.Windows.Forms
LineInfoVisibleChanged(this, e);
}
/// <summary>
/// Raises the OnColumnInfoVisibleChanged event.
/// </summary>
/// <param name="e">An EventArgs that contains the event data.</param>
protected virtual void OnColumnInfoVisibleChanged(EventArgs e)
{
if (ColumnInfoVisibleChanged != null)
ColumnInfoVisibleChanged(this, e);
}
/// <summary>
/// Raises the ColumnSeparatorVisibleChanged event.
/// </summary>
/// <param name="e">An EventArgs that contains the event data.</param>
protected virtual void OnGroupSeparatorVisibleChanged(EventArgs e)
{
if (GroupSeparatorVisibleChanged != null)
GroupSeparatorVisibleChanged(this, e);
}
/// <summary>
/// Raises the StringViewVisibleChanged event.
/// </summary>
@ -3573,6 +3877,16 @@ namespace Be.Windows.Forms
UseFixedBytesPerLineChanged(this, e);
}
/// <summary>
/// Raises the GroupSizeChanged event.
/// </summary>
/// <param name="e">An EventArgs that contains the event data.</param>
protected virtual void OnGroupSizeChanged(EventArgs e)
{
if (GroupSizeChanged != null)
GroupSizeChanged(this, e);
}
/// <summary>
/// Raises the BytesPerLineChanged event.
/// </summary>
@ -3735,5 +4049,28 @@ namespace Be.Windows.Forms
UpdateScrollSize();
}
#endregion
#region Scaling Support for High DPI resolution screens
/// <summary>
/// For high resolution screen support
/// </summary>
/// <param name="factor">the factor</param>
/// <param name="specified">bounds</param>
protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
{
base.ScaleControl(factor, specified);
this.BeginInvoke(new MethodInvoker(() =>
{
this.UpdateRectanglePositioning();
if (_caretVisible)
{
DestroyCaret();
CreateCaret();
}
this.Invalidate();
}));
}
#endregion
}
}

View File

@ -16,7 +16,13 @@ namespace Be.Windows.Forms
/// </summary>
static Util()
{
_designMode = (System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToLower() == "devenv");
// design mode is true if host process is: Visual Studio, Visual Studio Express Versions (C#, VB, C++) or SharpDevelop
var designerHosts = new List<string>() { "devenv", "vcsexpress", "vbexpress", "vcexpress", "sharpdevelop" };
using (var process = System.Diagnostics.Process.GetCurrentProcess())
{
var processName = process.ProcessName.ToLower();
_designMode = designerHosts.Contains(processName);
}
}
/// <summary>

View File

@ -80,7 +80,6 @@ namespace Tinke
"\n <InstantSearch>True</InstantSearch>" +
"\n <WindowDebug>True</WindowDebug>" +
"\n <WindowInformation>True</WindowInformation>" +
//"\n <ModeWindow>False</ModeWindow>" +
"\n </Options>\n</Tinke>",
Encoding.UTF8);
}
@ -152,28 +151,46 @@ namespace Tinke
}
else if (Program.tblRoms.Count() == 1)
{
if (File.Exists(Program.tblRoms[0]))
filesToRead[0] = Program.tblRoms[0];
else {
MessageBox.Show(Tools.Helper.GetTranslation("Messages", "S2E"), Tools.Helper.GetTranslation("Messages", "S01"));
this.Close();
Application.Exit();
return;
}
}
else
{
foreach (string fileName in Program.tblRoms)
{
if (!File.Exists(fileName))
{
MessageBox.Show(Tools.Helper.GetTranslation("Messages", "S2E"), Tools.Helper.GetTranslation("Messages", "S01"));
this.Close();
Application.Exit();
return;
}
}
filesToRead = new String[Program.tblRoms.Count()];
Array.Copy(Program.tblRoms.ToArray(), 0, filesToRead, 0, filesToRead.Length);
}
}
else if (Program.curCommand == 1)
{
if (!File.Exists(Program.extractFilePath))
Console.WriteLine("The input file not found!");
else {
filesToRead[0] = Program.extractFilePath;
ReadGame(filesToRead[0]);
sFolder folderSelect = accion.Root;
if (Program.extractOutputPath is string)
{
sFolder folderSelect = accion.Root;
if (string.IsNullOrWhiteSpace(Program.extractOutputPath))
Program.extractOutputPath = ".";
Directory.CreateDirectory(Program.extractOutputPath + Path.DirectorySeparatorChar + folderSelect.name);
RecursivoExtractFolder(folderSelect, Program.extractOutputPath + Path.DirectorySeparatorChar + folderSelect.name);
Console.WriteLine("Extract all files to " + Program.extractOutputPath + Path.DirectorySeparatorChar + folderSelect.name);
}
else
Console.WriteLine("Param error...");
if (!isMono)
{
@ -186,14 +203,22 @@ namespace Tinke
}
else if (Program.curCommand == 2)
{
if (!File.Exists(Program.replaceInputFile))
Console.WriteLine("The input file not found!");
else {
filesToRead[0] = Program.replaceInputFile;
ReadGame(filesToRead[0]);
if (Program.replaceResPath is string)
string fullPath = Path.GetFullPath(Program.replaceResPath);
string lastDirectoryName = Path.GetFileName(fullPath.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar));
if (Directory.Exists(Program.replaceResPath) && string.Equals(lastDirectoryName, "root"))
{
ChangeByDir(Program.replaceResPath);
} else
Console.WriteLine("Param error...");
btnSaveROM_Click(null, null);
} else
Console.WriteLine("The nitrofs folder not found or the folder name is not 'root'");
}
if (!isMono)
{
Program.FreeConsole();

View File

@ -94,7 +94,7 @@ namespace Tinke
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.hexBox1.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.hexBox1.LineInfoForeColor = System.Drawing.Color.Empty;
this.hexBox1.InfoForeColor = System.Drawing.Color.Empty;
this.hexBox1.LineInfoVisible = true;
this.hexBox1.Location = new System.Drawing.Point(0, 24);
this.hexBox1.Name = "hexBox1";

View File

@ -262,6 +262,7 @@
<S2B>The DSi Banner is good!</S2B>
<S2C>The DSi Banner is incomplete or corrupted.</S2C>
<S2D>The donor iheader mismatch!</S2D>
<S2E>File(s) not found!</S2E>
</Messages>
<DSDecmp>
<!-- LZ10 -->

View File

@ -266,6 +266,7 @@
<S2B>The DSi Banner is good!</S2B>
<S2C>The DSi Banner is incomplete or corrupted.</S2C>
<S2D>The donor iheader mismatch!</S2D>
<S2E>File(s) not found!</S2E>
</Messages>
<DSDecmp>
<!-- LZ10 -->

View File

@ -262,6 +262,7 @@
<S2B>The DSi Banner is good!</S2B>
<S2C>The DSi Banner is incomplete or corrupted.</S2C>
<S2D>The donor iheader mismatch!</S2D>
<S2E>File(s) not found!</S2E>
</Messages>
<DSDecmp>
<!-- LZ10 -->

View File

@ -261,6 +261,7 @@
<S2B>The DSi Banner is good!</S2B>
<S2C>The DSi Banner is incomplete or corrupted.</S2C>
<S2D>The donor iheader mismatch!</S2D>
<S2E>File(s) not found!</S2E>
</Messages>
<DSDecmp>
<!-- LZ10 -->

View File

@ -261,6 +261,7 @@
<S2B>DSi Banner 正确!</S2B>
<S2C>DSi Banner 不完整或已损坏。</S2C>
<S2D>donor iheader 不匹配!</S2D>
<S2E>一个或多个文件未找到!</S2E>
</Messages>
<DSDecmp>
<!-- LZ10 -->