source: 2013/30/MiskaK/MW2(My Warfare 2)/Paranneltu Jypeli/AdvanceMath/CFFauxAttributes.cs @ 4507

Revision 4507, 4.9 KB checked in by anlakane, 6 years ago (diff)

Talletus.

Line 
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
27using System;
28using System.Runtime.InteropServices;
29
30namespace System
31{
32    //Attributes for the CompactFramework that dont exist int the CompactFramework so
33    //this can compile under the CompactFramework without rewritting.
34    //or having compiler directives surrounding all of these Attributes.
35#if CompactFramework || WindowsCE || PocketPC || SILVERLIGHT
36    [ComVisible(true)]
37    [AttributeUsage(
38        AttributeTargets.Delegate |
39        AttributeTargets.Enum |
40        AttributeTargets.Struct |
41        AttributeTargets.Class,
42        Inherited = false)]
43    public sealed class SerializableAttribute : Attribute
44    { }
45#endif
46#if CompactFramework || WindowsCE || PocketPC
47    namespace Runtime.Serialization
48    {
49        [Serializable]
50        [ComVisible(true)]
51        public class SerializationException : SystemException
52        {
53            public SerializationException() { }
54            public SerializationException(string message) : base(message) { }
55            public SerializationException(string message, Exception innerException) : base(message, innerException) { }
56        }
57    }
58#endif
59#if CompactFramework || WindowsCE || PocketPC || XBOX360 || SILVERLIGHT
60    [ComVisible(true)]
61    [AttributeUsage(AttributeTargets.Field, Inherited = false)]
62    public sealed class NonSerializedAttribute : Attribute
63    { }
64    namespace Xml.Serialization
65    {
66        [AttributeUsage(AttributeTargets.ReturnValue | AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
67        public sealed class XmlIgnoreAttribute : Attribute
68        { }
69        [AttributeUsage(AttributeTargets.ReturnValue | AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
70        public class XmlAttributeAttribute : Attribute
71        {
72            public XmlAttributeAttribute() { }
73            public XmlAttributeAttribute(string attributeName) { }
74            public XmlAttributeAttribute(Type type) { }
75            public XmlAttributeAttribute(string attributeName, Type type) { }
76        }
77    }
78    namespace ComponentModel
79    {
80        [AttributeUsage(AttributeTargets.All)]
81        public sealed class DescriptionAttribute : Attribute
82        {
83            public DescriptionAttribute() { }
84            public DescriptionAttribute(string description) { }
85        }
86    }
87    namespace Runtime.Serialization
88    {
89        [ComVisible(true)]
90        public interface IDeserializationCallback
91        {
92            void OnDeserialization(object sender);
93        }
94    }
95#endif
96#if SILVERLIGHT
97
98    [ComVisible(true)]
99    public interface ICloneable
100    {
101        object Clone();
102    }
103
104    public static class ExtensionMethods
105    {
106        public static int RemoveAll<T>(this System.Collections.Generic.List<T> self, Predicate<T> match)
107        {
108            if (match == null)
109            {
110                throw new ArgumentNullException("match");
111            }
112            int index = 0;
113            while ((index < self.Count) && !match(self[index]))
114            {
115                index++;
116            }
117            if (index >= self.Count)
118            {
119                return 0;
120            }
121            int index2 = index + 1;
122            while (index2 < self.Count)
123            {
124                while ((index2 < self.Count) && match(self[index2]))
125                {
126                    index2++;
127                }
128                if (index2 < self.Count)
129                {
130                    self[index++] = self[index2++];
131                }
132            }
133            int result = self.Count - index;
134            self.RemoveRange(index, result);
135            return result;
136        }
137    }
138#endif
139}
Note: See TracBrowser for help on using the repository browser.