Skip to content

Commit

Permalink
Improve CLI, update workflow and update Be.Windows.Forms.HexBox to 1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
R-YaTian committed Aug 2, 2024
1 parent ffc7347 commit 5f42665
Show file tree
Hide file tree
Showing 17 changed files with 544 additions and 76 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 @@ -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
8 changes: 4 additions & 4 deletions .github/workflows/dotnet-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions .github/workflows/mono.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
container: mono:latest

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

- name: Setup build toolchain
run: |
apt-get update
Expand All @@ -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
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
2 changes: 1 addition & 1 deletion Be.Windows.Forms.HexBox/ByteCharConverters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public virtual byte ToByte(char c)
/// <returns></returns>
public override string ToString()
{
return "Default";
return "ANSI (Default)";
}
}

Expand Down
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 5f42665

Please sign in to comment.