Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
Clipboard.cs
Go to the documentation of this file.
1using System;
4
6
7internal 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 {
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}
override string GetClipboard()
Definition Clipboard.cs:9
override void SetClipboard(string text)
Definition Clipboard.cs:52
StreamReader StandardOutput
Definition Process.cs:673