Jypeli 10
The simple game programming library
CFFauxAttributes.cs
Siirry tämän tiedoston dokumentaatioon.
1#region MIT License
2/*
3 * Copyright (c) 2005-2008 Jonathan Mark Porter. http://physics2d.googlepages.com/
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights to
8 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 * the Software, and to permit persons to whom the Software is furnished to do so,
10 * subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
17 * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22#endregion
23
24
25
26
27
28namespace System
29{
30 //Attributes for the CompactFramework that dont exist int the CompactFramework so
31 //this can compile under the CompactFramework without rewritting.
32 //or having compiler directives surrounding all of these Attributes.
33#if CompactFramework || WindowsCE || PocketPC || SILVERLIGHT
34 [ComVisible(true)]
35 [AttributeUsage(
36 AttributeTargets.Delegate |
37 AttributeTargets.Enum |
38 AttributeTargets.Struct |
39 AttributeTargets.Class,
40 Inherited = false)]
41 public sealed class SerializableAttribute : Attribute
42 { }
43#endif
44#if CompactFramework || WindowsCE || PocketPC
45 namespace Runtime.Serialization
46 {
47 [Serializable]
48 [ComVisible(true)]
49 public class SerializationException : SystemException
50 {
51 public SerializationException() { }
52 public SerializationException(string message) : base(message) { }
53 public SerializationException(string message, Exception innerException) : base(message, innerException) { }
54 }
55 }
56#endif
57#if CompactFramework || WindowsCE || PocketPC || XBOX360 || SILVERLIGHT
58 [ComVisible(true)]
59 [AttributeUsage(AttributeTargets.Field, Inherited = false)]
60 public sealed class NonSerializedAttribute : Attribute
61 { }
62 namespace Xml.Serialization
63 {
64 [AttributeUsage(AttributeTargets.ReturnValue | AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
65 public sealed class XmlIgnoreAttribute : Attribute
66 { }
67 [AttributeUsage(AttributeTargets.ReturnValue | AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
68 public class XmlAttributeAttribute : Attribute
69 {
70 public XmlAttributeAttribute() { }
71 public XmlAttributeAttribute(string attributeName) { }
72 public XmlAttributeAttribute(Type type) { }
73 public XmlAttributeAttribute(string attributeName, Type type) { }
74 }
75 }
76 namespace ComponentModel
77 {
78 [AttributeUsage(AttributeTargets.All)]
79 public sealed class DescriptionAttribute : Attribute
80 {
81 public DescriptionAttribute() { }
82 public DescriptionAttribute(string description) { }
83 }
84 }
85 namespace Runtime.Serialization
86 {
87 [ComVisible(true)]
88 public interface IDeserializationCallback
89 {
90 void OnDeserialization(object sender);
91 }
92 }
93#endif
94#if SILVERLIGHT
95
96 [ComVisible(true)]
97 public interface ICloneable
98 {
99 object Clone();
100 }
101
102 public static class ExtensionMethods
103 {
104 public static int RemoveAll<T>(this System.Collections.Generic.List<T> self, Predicate<T> match)
105 {
106 if (match == null)
107 {
108 throw new ArgumentNullException("match");
109 }
110 int index = 0;
111 while ((index < self.Count) && !match(self[index]))
112 {
113 index++;
114 }
115 if (index >= self.Count)
116 {
117 return 0;
118 }
119 int index2 = index + 1;
120 while (index2 < self.Count)
121 {
122 while ((index2 < self.Count) && match(self[index2]))
123 {
124 index2++;
125 }
126 if (index2 < self.Count)
127 {
128 self[index++] = self[index2++];
129 }
130 }
131 int result = self.Count - index;
132 self.RemoveRange(index, result);
133 return result;
134 }
135 }
136#endif
137}