File tree Expand file tree Collapse file tree 4 files changed +5
-29
lines changed
Expand file tree Collapse file tree 4 files changed +5
-29
lines changed Original file line number Diff line number Diff line change 1- using System ;
2- using System . Diagnostics . Contracts ;
1+ using System . Diagnostics . Contracts ;
32using System . Drawing ;
43using System . Text ;
54using ReClassNET . Memory ;
87
98namespace ReClassNET . Nodes
109{
11- [ ContractClass ( typeof ( BaseTextNodeContract ) ) ]
1210 public abstract class BaseTextNode : BaseNode
1311 {
1412 public int Length { get ; set ; }
1513
1614 /// <summary>Size of the node in bytes.</summary>
1715 public override int MemorySize => Length * CharacterSize ;
1816
19- /// <summary>Size of one character in bytes.</summary>
20- public abstract int CharacterSize { get ; }
21-
17+ /// <summary>The encoding of the string.</summary>
2218 public abstract Encoding Encoding { get ; }
2319
20+ /// <summary>Size of one character in bytes.</summary>
21+ private int CharacterSize => Encoding . GetSimpleByteCountPerChar ( ) ;
22+
2423 public override void CopyFromNode ( BaseNode node )
2524 {
2625 Length = node . MemorySize / CharacterSize ;
@@ -92,18 +91,4 @@ public string ReadValueFromMemory(MemoryBuffer memory)
9291 return memory . ReadString ( Encoding , Offset , MemorySize ) ;
9392 }
9493 }
95-
96- [ ContractClassFor ( typeof ( BaseTextNode ) ) ]
97- internal abstract class BaseTextNodeContract : BaseTextNode
98- {
99- public override int CharacterSize
100- {
101- get
102- {
103- Contract . Ensures ( Contract . Result < int > ( ) > 0 ) ;
104-
105- throw new NotImplementedException ( ) ;
106- }
107- }
108- }
10994}
Original file line number Diff line number Diff line change 11using System . Drawing ;
22using System . Text ;
3- using ReClassNET . Memory ;
43using ReClassNET . UI ;
54
65namespace ReClassNET . Nodes
76{
87 public class Utf16TextNode : BaseTextNode
98 {
10- public override int CharacterSize => 2 ;
11-
129 public override Encoding Encoding => Encoding . Unicode ;
1310
1411 public override Size Draw ( ViewInfo view , int x , int y )
Original file line number Diff line number Diff line change 11using System . Drawing ;
22using System . Text ;
3- using ReClassNET . Memory ;
43using ReClassNET . UI ;
54
65namespace ReClassNET . Nodes
76{
87 public class Utf32TextNode : BaseTextNode
98 {
10- public override int CharacterSize => 4 ;
11-
129 public override Encoding Encoding => Encoding . UTF32 ;
1310
1411 public override Size Draw ( ViewInfo view , int x , int y )
Original file line number Diff line number Diff line change 11using System . Drawing ;
22using System . Text ;
3- using ReClassNET . Memory ;
43using ReClassNET . UI ;
54
65namespace ReClassNET . Nodes
76{
87 public class Utf8TextNode : BaseTextNode
98 {
10- public override int CharacterSize => 1 ;
11-
129 public override Encoding Encoding => Encoding . UTF8 ;
1310
1411 public override Size Draw ( ViewInfo view , int x , int y )
You can’t perform that action at this time.
0 commit comments