-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. The work of the editors has been rewritten, which allows you to ed…
…it the text more flexibly and use additional unused characters. 2. Search has been added. 3. Small work has been done to optimize the program.
- Loading branch information
Showing
14 changed files
with
684 additions
and
387 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace ujlptr_subedit | ||
{ | ||
static class EditorExtensions | ||
{ | ||
public static string ConvertTextToHex(this string text, Encoding codePage, Dictionary<string, string> hexConverter = null) | ||
{ | ||
string hex = BitConverter.ToString(codePage.GetBytes(text)).Replace("-", ""); | ||
string outHex = ""; | ||
|
||
for (int i = 0; i < hex.Length / 2; i++) | ||
{ | ||
if (hexConverter != null) | ||
{ | ||
if (hexConverter.ContainsKey(hex.Substring(i * 2, 2))) | ||
{ | ||
outHex += hexConverter[hex.Substring(i * 2, 2)]; | ||
} | ||
else | ||
{ | ||
outHex += hex.Substring(i * 2, 2); | ||
} | ||
} | ||
else | ||
{ | ||
outHex += hex.Substring(i * 2, 2); | ||
} | ||
} | ||
return outHex; | ||
} | ||
|
||
public static string ConvertHexToText(this string text, Encoding codePage) | ||
{ | ||
byte[] raw = new byte[text.Length / 2]; | ||
for (int i = 0; i < raw.Length; i++) | ||
{ | ||
raw[i] = Convert.ToByte(text.Substring(i * 2, 2), 16); | ||
} | ||
return codePage.GetString(raw); | ||
} | ||
|
||
public static string ConvertTextFromPattern(this string text, Encoding codePage, Dictionary<string, string> hexConverter) | ||
{ | ||
if (hexConverter != null) | ||
{ | ||
return text.ConvertTextToHex(codePage, hexConverter).ConvertHexToText(codePage); | ||
} | ||
return text; | ||
} | ||
|
||
public static string GetTextFromAddress(this int address, byte[] file, Encoding codePage) | ||
{ | ||
int count = 0; | ||
bool StopFlag = false; | ||
while (true) | ||
{ | ||
if (address + count == file.Length) | ||
{ | ||
break; | ||
} | ||
if (file[address + count] == 0x00) | ||
{ | ||
StopFlag = true; | ||
} | ||
else if (StopFlag) | ||
{ | ||
break; | ||
} | ||
count++; | ||
} | ||
if (count > 0) | ||
{ | ||
count--; | ||
} | ||
|
||
return codePage.GetString(file, address, count); | ||
} | ||
public static int GetTextLegthFromAddress(this int address, byte[] file) | ||
{ | ||
int count = 0; | ||
bool StopFlag = false; | ||
while (true) | ||
{ | ||
if (address + count == file.Length) | ||
{ | ||
break; | ||
} | ||
if (file[address + count] == 0x00) | ||
{ | ||
StopFlag = true; | ||
} | ||
else if (StopFlag) | ||
{ | ||
break; | ||
} | ||
count++; | ||
} | ||
if (count > 0) | ||
{ | ||
count--; | ||
} | ||
|
||
return count; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
|
||
namespace ujlptr_subedit | ||
{ | ||
public class Group | ||
{ | ||
public List<Line> Lines = new List<Line>(); | ||
public int MaxChars = 0; | ||
public int CurChars = 0; | ||
public int TextLocation; | ||
public bool Edit = false; | ||
|
||
public int UpdateCurChars() | ||
{ | ||
CurChars = 0; | ||
foreach (Line line in Lines) | ||
{ | ||
CurChars += line.Text.Replace("\0", "").Length; | ||
} | ||
return CurChars; | ||
} | ||
|
||
public Group(List<int> pointersLocation, List<byte[]> pointers, List<string> texts, int FirstCharAddress, int MaxChars) | ||
{ | ||
TextLocation = FirstCharAddress; | ||
this.MaxChars = MaxChars; | ||
foreach (string text in texts) | ||
{ | ||
CurChars += text.Replace("\0", "").Length; | ||
} | ||
|
||
for (int i = 0; i < pointersLocation.Count; i++) | ||
{ | ||
Lines.Add(new Line(pointersLocation[i], pointers[i], texts[i].Replace("\0", ""))); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
|
||
namespace ujlptr_subedit | ||
{ | ||
public class Line | ||
{ | ||
public int PointerLocation; | ||
public string Text; | ||
public string Time; | ||
public string SwitchingTime; | ||
|
||
public Line(int pointerLocation, byte[] pointer, string text) | ||
{ | ||
|
||
PointerLocation = pointerLocation; | ||
Text = text; | ||
if (pointer.Length == 6) | ||
{ | ||
Time = BitConverter.ToString(pointer, 3, 1).Replace("-", ""); | ||
SwitchingTime = BitConverter.ToString(pointer, 4, 2).Replace("-", ""); | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.