Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
Merge branch 'R-YaTian:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
mn1712trungson authored Dec 20, 2024
2 parents 6f3fd50 + 94dcf78 commit e0115a0
Show file tree
Hide file tree
Showing 43 changed files with 15,215 additions and 791 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/dotnet-desktop-x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,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
8 changes: 4 additions & 4 deletions .github/workflows/dotnet-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,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
6 changes: 3 additions & 3 deletions .github/workflows/mono.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
container: mono:latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@main

- name: Setup build toolchain
run: |
apt-get update
Expand All @@ -32,7 +32,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
2 changes: 1 addition & 1 deletion Be.Windows.Forms.HexBox/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
// 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
Expand Down
3 changes: 2 additions & 1 deletion Be.Windows.Forms.HexBox/Be.Windows.Forms.HexBox.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
<Compile Include="FileDataBlock.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="FindOptions.cs" />
<Compile Include="HexBox.cs">
<SubType>Component</SubType>
</Compile>
Expand Down Expand Up @@ -181,4 +182,4 @@
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>
</Project>
2 changes: 1 addition & 1 deletion Be.Windows.Forms.HexBox/BuiltInContextMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void CheckBuiltInContextMenu()
_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;
Expand Down
26 changes: 20 additions & 6 deletions Be.Windows.Forms.HexBox/ByteCharConverters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ public interface IByteCharConverter
/// </summary>
/// <param name="c"></param>
/// <returns></returns>
byte ToByte(char c);
byte[] ToByte(char c);

Encoding ToEncoding();
}

/// <summary>
Expand All @@ -44,9 +46,11 @@ public virtual char ToChar(byte b)
/// </summary>
/// <param name="c"></param>
/// <returns></returns>
public virtual byte ToByte(char c)
public virtual byte[] ToByte(char c)
{
return (byte)c;
byte[] bytes = new byte[1];
bytes[0] = (byte)c;
return bytes;
}

/// <summary>
Expand All @@ -55,7 +59,12 @@ public virtual byte ToByte(char c)
/// <returns></returns>
public override string ToString()
{
return "Default";
return "ANSI (Default)";
}

public Encoding ToEncoding()
{
return Encoding.Default;
}
}

Expand Down Expand Up @@ -86,10 +95,10 @@ public virtual char ToChar(byte b)
/// </summary>
/// <param name="c"></param>
/// <returns></returns>
public virtual byte ToByte(char c)
public virtual byte[] ToByte(char c)
{
byte[] decoded = _ebcdicEncoding.GetBytes(new char[] { c });
return decoded.Length > 0 ? decoded[0] : (byte)0;
return decoded.Length > 0 ? decoded : (new byte[1] { 0 });
}

/// <summary>
Expand All @@ -100,5 +109,10 @@ public override string ToString()
{
return "EBCDIC (Code Page 500)";
}

public Encoding ToEncoding()
{
return this._ebcdicEncoding;
}
}
}
94 changes: 94 additions & 0 deletions Be.Windows.Forms.HexBox/FindOptions.cs
Original file line number Diff line number Diff line change
@@ -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());
}
}
}
Loading

0 comments on commit e0115a0

Please sign in to comment.