File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,5 +25,29 @@ internal abstract class WinGetObjectBuilder<T> where T : IWinGetObject?
2525 /// Cleares all added data from the builder.
2626 /// </summary>
2727 public abstract void Clear ( ) ;
28+
29+ /// <summary>
30+ /// Checks if the given value is possibly shortened.
31+ /// </summary>
32+ /// <returns>
33+ /// <see langword="true"/> if the value is shortened or <see langword="false"/> if not.
34+ /// </returns>
35+ public static bool CheckShortenedValue ( string value )
36+ {
37+ // Char 8230 is at the end of the shortened id if UTF-8 encoding is used.
38+ #if NETCOREAPP3_1_OR_GREATER
39+ if ( value . EndsWith ( ( char ) 8230 ) )
40+ {
41+ return true ;
42+ }
43+ #elif NETSTANDARD2_0
44+ if ( value . EndsWith ( ( ( char ) 8230 ) . ToString ( ) ) )
45+ {
46+ return true ;
47+ }
48+ #endif
49+
50+ return false ;
51+ }
2852 }
2953}
Original file line number Diff line number Diff line change 33// https://github.com/basicx-StrgV/ //
44//--------------------------------------------------//
55using WGetNET . Abstractions ;
6- using WGetNET . HelperClasses ;
76
87namespace WGetNET . Builder
98{
@@ -45,7 +44,7 @@ public void AddEntryName(string entryName)
4544 /// <param name="rawContent">The raw data of the info entry as a <see cref="System.String"/></param>
4645 public void AddRawContent ( string rawContent )
4746 {
48- _hasShortenedContent = ProcessOutputReader . CheckShortenedValue ( rawContent ) ;
47+ _hasShortenedContent = CheckShortenedValue ( rawContent ) ;
4948
5049 if ( _hasShortenedContent )
5150 {
Original file line number Diff line number Diff line change 55using System ;
66using System . IO ;
77using WGetNET . Abstractions ;
8- using WGetNET . HelperClasses ;
98
109namespace WGetNET . Builder
1110{
@@ -45,7 +44,7 @@ public void AddEntryName(string entryName)
4544 /// <param name="rawContent">The raw data of the info entry as a <see cref="System.String"/></param>
4645 public void AddRawContent ( string rawContent )
4746 {
48- _hasShortenedContent = ProcessOutputReader . CheckShortenedValue ( rawContent ) ;
47+ _hasShortenedContent = CheckShortenedValue ( rawContent ) ;
4948
5049 if ( _hasShortenedContent )
5150 {
Original file line number Diff line number Diff line change 44//--------------------------------------------------//
55using System ;
66using WGetNET . Abstractions ;
7- using WGetNET . HelperClasses ;
87
98namespace WGetNET . Builder
109{
@@ -44,7 +43,7 @@ public void AddEntryName(string entryName)
4443 /// <param name="rawContent">The raw data of the info entry as a <see cref="System.String"/></param>
4544 public void AddRawContent ( string rawContent )
4645 {
47- _hasShortenedContent = ProcessOutputReader . CheckShortenedValue ( rawContent ) ;
46+ _hasShortenedContent = CheckShortenedValue ( rawContent ) ;
4847
4948 if ( _hasShortenedContent )
5049 {
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ public void AddName(string name)
5252 /// </param>
5353 public void AddId ( string id )
5454 {
55- _hasShortenedId = ProcessOutputReader . CheckShortenedValue ( id ) ;
55+ _hasShortenedId = CheckShortenedValue ( id ) ;
5656 if ( _hasShortenedId )
5757 {
5858 // Remove the char at the end of the shortened id.
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ public void AddName(string name)
8585 /// </param>
8686 public void AddId ( string id )
8787 {
88- _hasShortenedId = ProcessOutputReader . CheckShortenedValue ( id ) ;
88+ _hasShortenedId = CheckShortenedValue ( id ) ;
8989 if ( _hasShortenedId )
9090 {
9191 // Remove the char at the end of the shortened id.
Original file line number Diff line number Diff line change @@ -812,30 +812,6 @@ public static string ExportOutputToString(ProcessResult result)
812812 return string . Empty ;
813813 }
814814 }
815-
816- /// <summary>
817- /// Checks if the given value is possibly shortened.
818- /// </summary>
819- /// <returns>
820- /// <see langword="true"/> if the value is shortened or <see langword="false"/> if not.
821- /// </returns>
822- public static bool CheckShortenedValue ( string value )
823- {
824- // Char 8230 is at the end of the shortened id if UTF-8 encoding is used.
825- #if NETCOREAPP3_1_OR_GREATER
826- if ( value . EndsWith ( ( char ) 8230 ) )
827- {
828- return true ;
829- }
830- #elif NETSTANDARD2_0
831- if ( value . EndsWith ( ( ( char ) 8230 ) . ToString ( ) ) )
832- {
833- return true ;
834- }
835- #endif
836-
837- return false ;
838- }
839815 //------------------------------------------------------------------------------------------------------------
840816
841817 //---Helper---------------------------------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments