Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
Clipboard.cs
Go to the documentation of this file.
1
using
System
;
2
using
System.Diagnostics
;
3
using
ReLogic.OS.Base
;
4
5
namespace
ReLogic.OS.Linux
;
6
7
internal
class
Clipboard
:
ReLogic
.OS.Base.
Clipboard
8
{
9
protected
override
string
GetClipboard
()
10
{
11
try
12
{
13
string
result;
14
using
(
Process
process =
new
Process
())
15
{
16
process.StartInfo =
new
ProcessStartInfo
(
"xsel"
,
"-o"
)
17
{
18
UseShellExecute =
false
,
19
RedirectStandardOutput =
true
20
};
21
process.
Start
();
22
result = process.
StandardOutput
.ReadToEnd();
23
process.
WaitForExit
();
24
}
25
return
result;
26
}
27
catch
(
Exception
)
28
{
29
return
""
;
30
}
31
}
32
33
private
void
ClearClipboard
()
34
{
35
try
36
{
37
using
Process
process =
new
Process
();
38
process.StartInfo =
new
ProcessStartInfo
(
"xsel"
,
"-c"
)
39
{
40
UseShellExecute =
false
,
41
RedirectStandardOutput =
false
,
42
RedirectStandardInput =
true
43
};
44
process.Start();
45
process.WaitForExit();
46
}
47
catch
(
Exception
)
48
{
49
}
50
}
51
52
protected
override
void
SetClipboard
(
string
text
)
53
{
54
if
(
text
==
""
)
55
{
56
ClearClipboard
();
57
return
;
58
}
59
try
60
{
61
using
Process
process =
new
Process
();
62
process.StartInfo =
new
ProcessStartInfo
(
"xsel"
,
"-i"
)
63
{
64
UseShellExecute =
false
,
65
RedirectStandardOutput =
false
,
66
RedirectStandardInput =
true
67
};
68
process.Start();
69
process.StandardInput.Write(
text
);
70
process.StandardInput.Close();
71
process.WaitForExit();
72
}
73
catch
(
Exception
)
74
{
75
}
76
}
77
}
ReLogic.OS.Linux.Clipboard.ClearClipboard
void ClearClipboard()
Definition
Clipboard.cs:33
ReLogic.OS.Linux.Clipboard.GetClipboard
override string GetClipboard()
Definition
Clipboard.cs:9
ReLogic.OS.Linux.Clipboard.SetClipboard
override void SetClipboard(string text)
Definition
Clipboard.cs:52
ReLogic.OS.Linux.Clipboard
Definition
Clipboard.cs:8
System.Diagnostics.ProcessStartInfo
Definition
ProcessStartInfo.cs:17
System.Diagnostics.Process.StandardOutput
StreamReader StandardOutput
Definition
Process.cs:673
System.Diagnostics.Process.Start
bool Start()
Definition
Process.cs:1193
System.Diagnostics.Process.WaitForExit
void WaitForExit()
Definition
Process.cs:1323
System.Diagnostics.Process
Definition
Process.cs:18
System.Exception
Definition
Exception.cs:15
ReLogic.OS.Base
Definition
Clipboard.cs:3
ReLogic.OS.Linux
Definition
Clipboard.cs:5
ReLogic
Definition
IAssetReader.cs:5
System.Diagnostics
Definition
AggregationManager.cs:6
System.ExceptionArgument.text
@ text
System.ConsoleKey.Process
@ Process
System
Definition
BlockingCollection.cs:8
source
ReLogic
ReLogic.OS.Linux
Clipboard.cs
Generated by
1.10.0