Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2d60d75

Browse files
committed
Added somes Insert methods (actually not showing in control and impossible to save it in file, it's a debut)
1 parent9af1d1d commit2d60d75

File tree

3 files changed

+37
-13
lines changed

3 files changed

+37
-13
lines changed

‎Sources/WPFHexaEditor/Core/Bytes/ByteProvider.cs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,12 +1636,12 @@ public IEnumerable<ByteDifference> Compare(ByteProvider providerToCompare, bool
16361636
{
16371637
if(!CheckIsOpen(this)||!CheckIsOpen(providerToCompare))yieldreturnnull;
16381638

1639-
//get the maxlenght
1640-
varmaxLenght=Length>providerToCompare.Length
1639+
//get the maxlength
1640+
varmaxlength=Length>providerToCompare.Length
16411641
?Length
16421642
:providerToCompare.Length;
16431643

1644-
for(inti=0;i<maxLenght;i++)
1644+
for(inti=0;i<maxlength;i++)
16451645
{
16461646
//NEED TO BE OPTIMISED
16471647
varorigineByte=GetByte(i,compareChange).singleByte;

‎Sources/WPFHexaEditor/Core/CustomBackgroundBlock.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public CustomBackgroundBlock(string start, long length, SolidColorBrush color, s
7272
publiclongStopOffset=>StartOffset+Length;
7373

7474
/// <summary>
75-
/// Get or set thelenght of background block
75+
/// Get or set thelength of background block
7676
/// </summary>
7777
publiclongLength{get;set;}
7878

‎Sources/WPFHexaEditor/HexEditor.xaml.cs‎

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,8 @@ private void Provider_ReadOnlyChanged(object sender, EventArgs e)
10231023
if(!CheckIsOpen(_provider))return;
10241024

10251025
ReadOnlyMode=_provider.IsLockedFile||_provider.ReadOnlyMode;
1026+
1027+
ReadOnlyChanged?.Invoke(sender,e);
10261028
}
10271029

10281030
#endregion ReadOnly property/event
@@ -2904,7 +2906,7 @@ private void UpdateViewers(bool controlResize)
29042906
{
29052907
varbufferlength=MaxVisibleLine*(BytePerLine+1+ByteShiftLeft)*ByteSizeRatio;
29062908

2907-
#region Build the bufferlenght if needed
2909+
#region Build the bufferlength if needed
29082910

29092911
if(controlResize)
29102912
{
@@ -3835,7 +3837,7 @@ public IEnumerable<long> ReplaceAll(string find, string replace, bool truckLengt
38353837
/// <summary>
38363838
/// Update statusbar for somes property dont support dependency property
38373839
/// </summary>
3838-
privatevoidUpdateStatusBar(boolupdateFileLenght=true)
3840+
privatevoidUpdateStatusBar(boolupdateFilelength=true)
38393841
{
38403842
if(StatusBarVisibility!=Visibility.Visible)return;
38413843

@@ -3847,7 +3849,7 @@ private void UpdateStatusBar(bool updateFileLenght = true)
38473849
}
38483850

38493851
#region Show length
3850-
if(updateFileLenght)
3852+
if(updateFilelength)
38513853
{
38523854
varisMegabByte=false;
38533855

@@ -5417,17 +5419,17 @@ private static void Control_DeletePropertyChanged(DependencyObject d,
54175419
}
54185420

54195421
/// <summary>
5420-
/// Select bytes setted by bytePositionInStream with thelenght
5422+
/// Select bytes setted by bytePositionInStream with thelength
54215423
/// </summary>
54225424
/// <param name="bytePositionInStream">First byte to delete</param>
5423-
/// <param name="lenght">Number of byte to delete</param>
5424-
publicvoidDeleteBytesAtPosition(longbytePositionInStream,longlenght=1)
5425+
/// <param name="length">Number of byte to delete</param>
5426+
publicvoidDeleteBytesAtPosition(longbytePositionInStream,longlength=1)
54255427
{
54265428
varpreviousSelectionStart=SelectionStart;
54275429
varpreviousSelectionStop=SelectionStop;
54285430

54295431
SelectionStart=bytePositionInStream;
5430-
SelectionStop=bytePositionInStream+lenght;
5432+
SelectionStop=bytePositionInStream+length;
54315433

54325434
DeleteSelection();
54335435

@@ -5667,15 +5669,37 @@ private static void Control_CanInsertEverywhereChanged(DependencyObject d, Depen
56675669
/// <summary>
56685670
/// Insert byte at the specified position
56695671
/// </summary>
5670-
publicvoidInsertByte(byte@byte,longbytePositionInStream)
5672+
publicvoidInsertByte(byte@byte,longbytePositionInStream)=>
5673+
InsertByte(@byte,bytePositionInStream,1);
5674+
5675+
/// <summary>
5676+
/// Insert byte at the specified position for the length
5677+
/// </summary>
5678+
publicvoidInsertByte(byte@byte,longbytePositionInStream,longlength)
56715679
{
56725680
if(!CheckIsOpen(_provider))return;
56735681
if(!CanInsertEverywhere)return;
56745682

5675-
_provider.AddByteAdded(@byte,bytePositionInStream);
5683+
for(inti=0;i<=length;i++)
5684+
_provider.AddByteAdded(@byte,bytePositionInStream+i);
56765685

56775686
RefreshView();
56785687
}
5688+
5689+
/// <summary>
5690+
/// Insert an array of byte at specified position
5691+
/// </summary>
5692+
publicvoidInsertBytes(byte[]bytes,longbytePositionInStream)
5693+
{
5694+
if(!CheckIsOpen(_provider))return;
5695+
if(!CanInsertEverywhere)return;
5696+
5697+
foreach(byte@byteinbytes)
5698+
_provider.AddByteAdded(@byte,bytePositionInStream++);
5699+
5700+
RefreshView();
5701+
}
5702+
56795703
#endregion
56805704
}
56815705
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp