File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
OneScript.Core/Exceptions
OneScript.StandardLibrary/Text Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -14,5 +14,12 @@ public class TypeConversionException : RuntimeException
14
14
public TypeConversionException ( BilingualString message ) : base ( message )
15
15
{
16
16
}
17
+
18
+ public TypeConversionException ( )
19
+ : base ( new BilingualString (
20
+ "Íåñîîòâåòñòâèå òèïîâ" ,
21
+ "Type mismatch" ) )
22
+ {
23
+ }
17
24
}
18
25
}
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ public int XPos
40
40
}
41
41
set
42
42
{
43
- Console . CursorLeft = Math . Min ( value , Console . WindowWidth - 1 ) ;
43
+ Console . CursorLeft = Math . Min ( value , Console . WindowWidth - 1 ) ;
44
44
}
45
45
}
46
46
@@ -54,8 +54,8 @@ public int YPos
54
54
set
55
55
{
56
56
Console . CursorTop = Math . Min ( value , Console . WindowHeight - 1 ) ;
57
+ }
57
58
}
58
- }
59
59
60
60
[ ContextMethod ( "ПрочитатьСтроку" , "ReadLine" ) ]
61
61
public string ReadLine ( )
@@ -134,6 +134,8 @@ public IValue TextColor
134
134
{
135
135
Console . ForegroundColor = typed . UnderlyingValue ;
136
136
}
137
+ else
138
+ throw new TypeConversionException ( ) ;
137
139
}
138
140
}
139
141
@@ -144,7 +146,7 @@ public IValue BackgroundColor
144
146
{
145
147
try
146
148
{
147
- return ( ClrEnumValueWrapper < ConsoleColor > ) GlobalsHelper . GetEnum < ConsoleColorEnum > ( ) . FromNativeValue ( Console . BackgroundColor ) ;
149
+ return GlobalsHelper . GetEnum < ConsoleColorEnum > ( ) . FromNativeValue ( Console . BackgroundColor ) ;
148
150
}
149
151
catch ( InvalidOperationException )
150
152
{
@@ -157,6 +159,8 @@ public IValue BackgroundColor
157
159
{
158
160
Console . BackgroundColor = typed . UnderlyingValue ;
159
161
}
162
+ else
163
+ throw new TypeConversionException ( ) ;
160
164
}
161
165
}
162
166
You can’t perform that action at this time.
0 commit comments