terraria-cpp2il-methodrecon v1.4.4.9
Terraria mobile dump, with reconstructed method body. Dump with CallAnalysis: https://infinitynichto.github.io/terraria-cpp2il
Loading...
Searching...
No Matches
TermInfoDriver.cs
Go to the documentation of this file.
1using System;
3using System.IO;
6
7namespace System
8{
9 // Token: 0x0200018D RID: 397
11 {
12 // Token: 0x06000F7A RID: 3962 RVA: 0x00020AA0 File Offset: 0x0001ECA0
13 private static string TryTermInfoDir(string dir, string term)
14 {
15 long num = 0L;
16 char c = dir[(int)num];
17 string text;
18 bool flag = File.Exists(text);
19 return text;
20 }
21
22 // Token: 0x06000F7B RID: 3963 RVA: 0x00020AD8 File Offset: 0x0001ECD8
23 private static string SearchTerminfo(string term)
24 {
25 for (;;)
26 {
28 if (text != null)
29 {
30 bool flag = Directory.Exists(text);
31 if ("TERMINFO" == null)
32 {
33 }
34 string text2;
35 if (text2 != null)
36 {
37 continue;
38 }
39 }
40 if ("TERMINFO" == null)
41 {
42 }
43 bool flag2 = Directory.Exists(text);
44 if ("TERMINFO" == null)
45 {
46 }
47 string text3;
48 if (text3 == null)
49 {
50 return;
51 }
52 }
53 }
54
55 // Token: 0x06000F7C RID: 3964 RVA: 0x00020B24 File Offset: 0x0001ED24
56 private void WriteConsole(string str)
57 {
58 if (str != null)
59 {
61 return;
62 }
63 }
64
65 // Token: 0x06000F7D RID: 3965 RVA: 0x00020B44 File Offset: 0x0001ED44
66 public TermInfoDriver(string term)
67 {
68 int num = 1;
69 this.cursorVisible = num != 0;
70 int num2 = 15;
73 if (num2 == 0)
74 {
75 }
77 {
78 return;
79 }
80 byte[] xterm = KnownTerminals.xterm;
81 }
82
83 // Token: 0x17000162 RID: 354
84 // (get) Token: 0x06000F7E RID: 3966 RVA: 0x00020BB4 File Offset: 0x0001EDB4
85 public bool Initialized
86 {
87 get
88 {
89 return this.inited;
90 }
91 }
92
93 // Token: 0x06000F7F RID: 3967 RVA: 0x00020BC8 File Offset: 0x0001EDC8
94 public void Init()
95 {
96 bool flag = this.inited;
97 if (!flag)
98 {
99 object obj = this.initLock;
100 if (flag)
101 {
102 return;
103 }
104 if (!flag)
105 {
106 }
108 if (!flag)
109 {
110 }
111 int num = 88;
112 if (num != 0 && num != 0)
113 {
114 return;
115 }
116 if (!flag)
117 {
118 }
119 int num2 = 16;
120 int num4;
121 int num3 = Math.Min(num4, num2);
122 int num5 = 1;
123 int num6 = Math.Max(num3, num5);
124 int num7 = 184;
125 if (num7 == 0)
126 {
127 }
128 if (num7 == 0)
129 {
130 }
131 Stream stream = Console.OpenStandardInput(0);
132 if (!true)
133 {
134 }
135 string text2;
136 string text3;
137 string text = text2 + text3;
138 string text4;
139 if (text4 == null)
140 {
141 }
142 string text5;
143 bool flag2 = text5 == "cygwin";
144 bool flag3;
145 if (flag3)
146 {
147 }
148 int num8 = 10;
149 if ("\u001b]0;{0}\a" == null || num8 != 0)
150 {
151 }
152 long num9 = 0L;
153 if ("\u001b]0;{0}\a" != null)
154 {
156 }
157 if (num9 != 0L)
158 {
159 throw new OutOfMemoryException();
160 }
161 }
162 }
163
164 // Token: 0x06000F80 RID: 3968 RVA: 0x00020CF4 File Offset: 0x0001EEF4
165 private void IncrementX()
166 {
167 int num = this.cursorLeft;
168 int num2 = this.WindowWidth;
169 int num3 = this.cursorTop;
170 int num4 = this.WindowHeight;
171 int num5 = this.rl_starty;
174 }
175
176 // Token: 0x06000F81 RID: 3969 RVA: 0x00020D38 File Offset: 0x0001EF38
178 {
179 int num = this.cursorLeft;
180 int num2 = this.rl_startx;
181 int num3 = this.cursorTop;
182 int num4 = this.rl_starty;
184 if (" " != null)
185 {
186 this.stdout.InternalWriteString(" ");
187 }
188 int num5 = this.cursorLeft;
189 string text = this.title;
190 }
191
192 // Token: 0x06000F82 RID: 3970 RVA: 0x00020DD0 File Offset: 0x0001EFD0
193 public void WriteSpecialKey(char c)
194 {
195 long num = 0L;
196 ConsoleKeyInfo consoleKeyInfo = this.CreateKeyInfoFromInt((int)c, num != 0L);
197 this.WriteSpecialKey(consoleKeyInfo);
198 }
199
200 // Token: 0x06000F83 RID: 3971 RVA: 0x00020DF0 File Offset: 0x0001EFF0
202 {
203 if (this.inited)
204 {
205 int num = this.cursorTop;
206 int num2 = this.WindowHeight;
207 int num3 = this.cursorTop;
209 this.IncrementX();
210 return;
211 }
212 }
213
214 // Token: 0x06000F84 RID: 3972 RVA: 0x00020E2C File Offset: 0x0001F02C
215 public bool IsSpecialKey(char c)
216 {
217 long num = 0L;
218 ConsoleKeyInfo consoleKeyInfo = this.CreateKeyInfoFromInt((int)c, num != 0L);
219 return this.IsSpecialKey(consoleKeyInfo);
220 }
221
222 // Token: 0x06000F85 RID: 3973 RVA: 0x00020E4C File Offset: 0x0001F04C
223 private void GetCursorPosition()
224 {
225 if (!true)
226 {
227 }
229 if ("\u001b[6n" != null)
230 {
231 this.stdout.InternalWriteString("\u001b[6n");
232 }
237 }
238
239 // Token: 0x06000F86 RID: 3974 RVA: 0x00020EFC File Offset: 0x0001F0FC
241 {
242 if (!true)
243 {
244 }
245 if (true)
246 {
247 if (!true)
248 {
249 }
250 if (!true)
251 {
252 }
253 if (!true)
254 {
255 }
256 return;
257 }
258 }
259
260 // Token: 0x17000163 RID: 355
261 // (get) Token: 0x06000F87 RID: 3975 RVA: 0x00020F5C File Offset: 0x0001F15C
262 public int WindowHeight
263 {
264 get
265 {
266 if (!this.inited)
267 {
268 this.Init();
269 }
271 return this.windowHeight;
272 }
273 }
274
275 // Token: 0x17000164 RID: 356
276 // (get) Token: 0x06000F88 RID: 3976 RVA: 0x00020F84 File Offset: 0x0001F184
277 public int WindowWidth
278 {
279 get
280 {
281 if (!this.inited)
282 {
283 this.Init();
284 }
286 return this.windowWidth;
287 }
288 }
289
290 // Token: 0x06000F89 RID: 3977 RVA: 0x00020FAC File Offset: 0x0001F1AC
291 public void Clear()
292 {
293 if (!this.inited)
294 {
295 this.Init();
296 }
297 string text = this.clear;
298 if (text != null)
299 {
300 this.stdout.InternalWriteString(text);
301 }
302 }
303
304 // Token: 0x06000F8A RID: 3978 RVA: 0x00020FE0 File Offset: 0x0001F1E0
305 private void AddToBuffer(int b)
306 {
307 if (this.buffer != null)
308 {
309 int num = this.writepos;
310 char[] array = this.buffer;
311 return;
312 }
313 }
314
315 // Token: 0x06000F8B RID: 3979 RVA: 0x0002100C File Offset: 0x0001F20C
316 private void AdjustBuffer()
317 {
318 int num = this.readpos;
319 string text = this.keypadXmit;
320 }
321
322 // Token: 0x06000F8C RID: 3980 RVA: 0x00021028 File Offset: 0x0001F228
323 private ConsoleKeyInfo CreateKeyInfoFromInt(int n, bool alt)
324 {
325 }
326
327 // Token: 0x06000F8D RID: 3981 RVA: 0x00021038 File Offset: 0x0001F238
328 private object GetKeyFromBuffer(bool cooked)
329 {
330 int num = this.readpos;
331 string text = this.keypadXmit;
332 char[] array = this.buffer;
333 bool flag = this.rootmap.StartsWith(43155456);
334 int num2 = this.readpos;
335 string text2 = this.keypadXmit;
337 char[] array2 = this.buffer;
338 if (this.keymap != null)
339 {
341 int num3 = this.readpos;
342 string text3 = this.keypadXmit;
343 int num4 = this.readpos;
344 string text4 = this.keypadXmit;
346 char[] array3 = this.buffer;
347 int num5 = this.writepos;
349 }
350 int num6 = this.readpos;
351 string text5 = this.keypadXmit;
352 throw new InvalidCastException();
353 }
354
355 // Token: 0x06000F8E RID: 3982 RVA: 0x000210F4 File Offset: 0x0001F2F4
357 {
358 do
359 {
360 bool flag = this.inited;
361 if (!flag)
362 {
363 this.Init();
364 }
365 this.InitKeys();
366 if (this.GetKeyFromBuffer(true) != null)
367 {
368 }
369 if (!flag)
370 {
371 }
373 bool flag2 = this.stdin.DataAvailable();
375 bool flag3 = this.stdin.DataAvailable();
376 long num = 0L;
377 if (this.GetKeyFromBuffer(num != 0L) != null)
378 {
379 goto IL_0071;
380 }
382 }
383 while (this.GetKeyFromBuffer(true) == null);
384 fresh.m_value = true;
385 IL_0071:
386 throw new InvalidCastException();
387 }
388
389 // Token: 0x06000F8F RID: 3983 RVA: 0x00021178 File Offset: 0x0001F378
390 private bool InputPending()
391 {
392 int num = this.readpos;
393 string text = this.keypadXmit;
394 return true;
395 }
396
397 // Token: 0x06000F90 RID: 3984 RVA: 0x00021198 File Offset: 0x0001F398
398 private void QueueEcho(char c)
399 {
400 if (this.echobuf == null)
401 {
402 }
403 int num = this.readpos;
404 string text = this.keypadXmit;
405 bool flag = this.stdin.DataAvailable();
406 char[] array = this.echobuf;
407 int num2 = this.echon;
408 this.stdout.InternalWriteChars(array, num2);
409 }
410
411 // Token: 0x06000F91 RID: 3985 RVA: 0x000211EC File Offset: 0x0001F3EC
412 private void Echo(ConsoleKeyInfo key)
413 {
414 bool flag = this.IsSpecialKey(key);
415 }
416
417 // Token: 0x06000F92 RID: 3986 RVA: 0x00021204 File Offset: 0x0001F404
418 private void EchoFlush()
419 {
420 int num = this.echon;
421 if (num != 0)
422 {
424 char[] array = this.echobuf;
425 cstreamWriter.InternalWriteChars(array, num);
426 }
427 }
428
429 // Token: 0x06000F93 RID: 3987 RVA: 0x00021234 File Offset: 0x0001F434
430 public int Read([In] [Out] char[] dest, int index, int count)
431 {
432 int num2;
433 do
434 {
435 int num = 1;
436 object keyFromBuffer = this.GetKeyFromBuffer(num != 0);
437 if (keyFromBuffer == null)
438 {
439 break;
440 }
441 num2 = 1;
442 }
443 while (this.GetKeyFromBuffer(num2 != 0) != null);
444 int num3 = this.cursorLeft;
447 this.Echo(consoleKeyInfo);
448 int num4 = this.echon;
449 if (num4 != 0)
450 {
452 char[] array = this.echobuf;
453 cstreamWriter.InternalWriteChars(array, num4);
454 }
455 long num5 = 0L;
456 this.AddToBuffer((int)num5);
457 throw new InvalidCastException();
458 }
459
460 // Token: 0x06000F94 RID: 3988 RVA: 0x000212B8 File Offset: 0x0001F4B8
462 {
464 this.Echo(consoleKeyInfo);
465 int num = this.echon;
466 if (num != 0)
467 {
469 char[] array = this.echobuf;
470 cstreamWriter.InternalWriteChars(array, num);
471 }
472 return consoleKeyInfo;
473 }
474
475 // Token: 0x06000F95 RID: 3989 RVA: 0x000212F8 File Offset: 0x0001F4F8
476 public string ReadLine()
477 {
478 return this.ReadUntilConditionInternal(true);
479 }
480
481 // Token: 0x06000F96 RID: 3990 RVA: 0x0002130C File Offset: 0x0001F50C
482 public string ReadToEnd()
483 {
484 long num = 0L;
485 return this.ReadUntilConditionInternal(num != 0L);
486 }
487
488 // Token: 0x06000F97 RID: 3991 RVA: 0x00021324 File Offset: 0x0001F524
490 {
491 for (;;)
492 {
493 if (!this.inited)
494 {
495 this.Init();
496 }
497 this.GetCursorPosition();
498 long num = 0L;
499 int num2 = this.cursorLeft;
500 byte[] array = this.control_characters;
503 int num3;
504 if (num3 == 0)
505 {
506 return;
507 }
508 if (true)
509 {
510 long num4 = 0L;
511 this.Echo(consoleKeyInfo);
512 while (num4 == 0L)
513 {
514 }
515 if (false)
516 {
517 break;
518 }
519 }
520 }
521 int num5 = this.echon;
522 if (num5 != 0)
523 {
525 char[] array2 = this.echobuf;
526 cstreamWriter.InternalWriteChars(array2, num5);
527 return;
528 }
529 }
530
531 // Token: 0x06000F98 RID: 3992 RVA: 0x000213A8 File Offset: 0x0001F5A8
532 public void SetCursorPosition(int left, int top)
533 {
534 if (!this.inited)
535 {
536 this.Init();
537 }
539 int num = this.bufferWidth;
540 int num2 = this.bufferHeight;
541 string text;
542 if (text != null)
543 {
544 this.stdout.InternalWriteString(text);
545 }
546 this.cursorLeft = left;
547 this.title = top;
548 }
549
550 // Token: 0x06000F99 RID: 3993 RVA: 0x000213F8 File Offset: 0x0001F5F8
551 private void CreateKeyMap()
552 {
609 }
610
611 // Token: 0x06000F9A RID: 3994 RVA: 0x000215C4 File Offset: 0x0001F7C4
612 private void InitKeys()
613 {
614 if (!this.initKeys)
615 {
616 this.CreateKeyMap();
618 int num = 1;
619 byte[] array = this.control_characters;
620 this.initKeys = num != 0;
621 }
622 }
623
624 // Token: 0x06000F9B RID: 3995 RVA: 0x00021600 File Offset: 0x0001F800
626 {
627 byte[] stringBytes = this.reader.GetStringBytes(s);
628 if (stringBytes != null)
629 {
631 return;
632 }
633 }
634
635 // Token: 0x06000F9C RID: 3996 RVA: 0x0002162C File Offset: 0x0001F82C
636 // Note: this type is marked as 'beforefieldinit'.
638 {
639 if (("/usr/share/terminfo" == null || "/usr/share/terminfo" != null) && ("/etc/terminfo" == null || "/etc/terminfo" != null) && ("/usr/lib/terminfo" == null || "/usr/lib/terminfo" != null) && ("/lib/terminfo" == null || "/lib/terminfo" != null))
640 {
641 return;
642 }
643 throw new ArrayTypeMismatchException();
644 }
645
646 // Token: 0x04000698 RID: 1688
647 private unsafe static int* native_terminal_size;
648
649 // Token: 0x04000699 RID: 1689
650 private static int terminal_size;
651
652 // Token: 0x0400069A RID: 1690
653 private static readonly string[] locations;
654
655 // Token: 0x0400069B RID: 1691
657
658 // Token: 0x0400069C RID: 1692
659 private int cursorLeft;
660
661 // Token: 0x0400069D RID: 1693
662 private int cursorTop;
663
664 // Token: 0x0400069E RID: 1694
665 private string title;
666
667 // Token: 0x0400069F RID: 1695
668 private string titleFormat;
669
670 // Token: 0x040006A0 RID: 1696
671 private bool cursorVisible;
672
673 // Token: 0x040006A1 RID: 1697
674 private string csrVisible;
675
676 // Token: 0x040006A2 RID: 1698
677 private string csrInvisible;
678
679 // Token: 0x040006A3 RID: 1699
680 private string clear;
681
682 // Token: 0x040006A4 RID: 1700
683 private string bell;
684
685 // Token: 0x040006A5 RID: 1701
686 private string term;
687
688 // Token: 0x040006A6 RID: 1702
690
691 // Token: 0x040006A7 RID: 1703
693
694 // Token: 0x040006A8 RID: 1704
695 private int windowWidth;
696
697 // Token: 0x040006A9 RID: 1705
698 private int windowHeight;
699
700 // Token: 0x040006AA RID: 1706
701 private int bufferHeight;
702
703 // Token: 0x040006AB RID: 1707
704 private int bufferWidth;
705
706 // Token: 0x040006AC RID: 1708
707 private char[] buffer;
708
709 // Token: 0x040006AD RID: 1709
710 private int readpos;
711
712 // Token: 0x040006AE RID: 1710
713 private int writepos;
714
715 // Token: 0x040006AF RID: 1711
716 private string keypadXmit;
717
718 // Token: 0x040006B0 RID: 1712
719 private string keypadLocal;
720
721 // Token: 0x040006B1 RID: 1713
722 private bool inited;
723
724 // Token: 0x040006B2 RID: 1714
725 private object initLock;
726
727 // Token: 0x040006B3 RID: 1715
728 private bool initKeys;
729
730 // Token: 0x040006B4 RID: 1716
731 private string origPair;
732
733 // Token: 0x040006B5 RID: 1717
734 private string origColors;
735
736 // Token: 0x040006B6 RID: 1718
737 private string cursorAddress;
738
739 // Token: 0x040006B7 RID: 1719
741
742 // Token: 0x040006B8 RID: 1720
743 private string setfgcolor;
744
745 // Token: 0x040006B9 RID: 1721
746 private string setbgcolor;
747
748 // Token: 0x040006BA RID: 1722
749 private int maxColors;
750
751 // Token: 0x040006BB RID: 1723
752 private bool noGetPosition;
753
754 // Token: 0x040006BC RID: 1724
756
757 // Token: 0x040006BD RID: 1725
759
760 // Token: 0x040006BE RID: 1726
761 private int rl_startx;
762
763 // Token: 0x040006BF RID: 1727
764 private int rl_starty;
765
766 // Token: 0x040006C0 RID: 1728
767 private byte[] control_characters;
768
769 // Token: 0x040006C1 RID: 1729
770 private static readonly int[] _consoleColorToAnsiCode;
771
772 // Token: 0x040006C2 RID: 1730
773 private char[] echobuf;
774
775 // Token: 0x040006C3 RID: 1731
776 private int echon;
777 }
778}
class f__AnonymousType0<< Count > j__TPar
bool StartsWith(int c)
void AddMapping(TermInfoStrings key, byte[] val)
static Stream OpenStandardInput(int bufferSize)
Definition Console.cs:87
static string internalGetEnvironmentVariable(string variable)
void InternalWriteString(string val)
void InternalWriteChars(char[] buffer, int n)
static bool Exists(string path)
Definition Directory.cs:64
static bool Exists(string path)
Definition File.cs:86
static byte Min(byte val1, byte val2)
Definition Math.cs:152
static byte Max(byte val1, byte val2)
Definition Math.cs:111
void WriteSpecialKey(char c)
ConsoleKeyInfo ReadKeyInternal([Out] bool fresh)
TermInfoDriver(string term)
static readonly int[] _consoleColorToAnsiCode
static string TryTermInfoDir(string dir, string term)
void WriteConsole(string str)
ConsoleKeyInfo CreateKeyInfoFromInt(int n, bool alt)
object GetKeyFromBuffer(bool cooked)
static readonly string[] locations
void Echo(ConsoleKeyInfo key)
void WriteSpecialKey(ConsoleKeyInfo key)
bool IsSpecialKey(ConsoleKeyInfo key)
ConsoleKeyInfo ReadKey(bool intercept)
static string SearchTerminfo(string term)
void SetCursorPosition(int left, int top)
void AddStringMapping(TermInfoStrings s)
int Read([In][Out] char[] dest, int index, int count)
static unsafe int * native_terminal_size
string ReadUntilConditionInternal(bool haltOnNewLine)
byte[] GetStringBytes(TermInfoStrings tstr)
static void Exit(object obj)
Definition Monitor.cs:47