-
Notifications
You must be signed in to change notification settings - Fork 1
/
ClipboardMultiplatform.cs
103 lines (102 loc) · 2.86 KB
/
ClipboardMultiplatform.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace raptor
{
class ClipboardMultiplatform
{
private class mydata : IDataObject
{
private object data;
public mydata(object data)
{
this.data = data;
}
public object GetData(String format) {
if (data!=null && data.GetType().ToString() == format)
{
return data;
}
else
{
return null;
}
}
public object GetData(String format, bool autoConvert)
{
return GetData(format);
}
public object GetData(Type type)
{
if (data!=null && data.GetType() == type)
{
return data;
}
else
{
return null;
}
}
public void SetData(String format, bool autoConvert, object data)
{
this.data = data;
}
public void SetData(String format, object data)
{
this.data = data;
}
public void SetData(Type type, object data)
{
this.data = data;
}
public void SetData(object data)
{
this.data = data;
}
public bool GetDataPresent(String format, bool autoConvert)
{
return (data != null && this.data.GetType().ToString() == format);
}
public bool GetDataPresent(String format)
{
return GetDataPresent(format, false);
}
public bool GetDataPresent(Type type)
{
return (data != null && this.data.GetType() == type);
}
public String[] GetFormats(bool autoconvert)
{
throw new System.Exception("not supported");
}
public String[] GetFormats()
{
throw new System.Exception("not supported");
}
}
private static mydata clipboard_data;
public static void SetDataObject(object data, bool afterExit)
{
if (Component.MONO)
{
clipboard_data = new mydata(data);
}
else
{
Clipboard.SetDataObject(data, afterExit);
}
}
public static IDataObject GetDataObject()
{
if (Component.MONO)
{
return clipboard_data;
}
else
{
return Clipboard.GetDataObject();
}
}
}
}