From 514856d8c79bee4a35c61aa08213fd774c7a7ee9 Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Thu, 23 Aug 2018 12:49:57 -0400 Subject: [Mono] Move several small related files --- .../glue/cs_files/Attributes/ExportAttribute.cs | 17 ++++++++ .../cs_files/Attributes/GodotMethodAttribute.cs | 17 ++++++++ .../mono/glue/cs_files/Attributes/RPCAttributes.cs | 25 ++++++++++++ .../glue/cs_files/Attributes/SignalAttribute.cs | 9 +++++ .../mono/glue/cs_files/Attributes/ToolAttribute.cs | 7 ++++ modules/mono/glue/cs_files/ExportAttribute.cs | 17 -------- .../glue/cs_files/Extensions/NodeExtensions.cs | 45 ++++++++++++++++++++++ .../glue/cs_files/Extensions/ObjectExtensions.cs | 17 ++++++++ .../Extensions/ResourceLoaderExtensions.cs | 10 +++++ modules/mono/glue/cs_files/GodotMethodAttribute.cs | 17 -------- modules/mono/glue/cs_files/IAwaitable.cs | 12 ------ modules/mono/glue/cs_files/IAwaiter.cs | 18 --------- .../mono/glue/cs_files/Interfaces/IAwaitable.cs | 12 ++++++ modules/mono/glue/cs_files/Interfaces/IAwaiter.cs | 18 +++++++++ modules/mono/glue/cs_files/NodeExtensions.cs | 45 ---------------------- modules/mono/glue/cs_files/ObjectExtensions.cs | 17 -------- modules/mono/glue/cs_files/RPCAttributes.cs | 25 ------------ .../mono/glue/cs_files/ResourceLoaderExtensions.cs | 10 ----- modules/mono/glue/cs_files/SignalAttribute.cs | 9 ----- modules/mono/glue/cs_files/StringExtensions.cs | 14 +++---- modules/mono/glue/cs_files/ToolAttribute.cs | 7 ---- 21 files changed, 183 insertions(+), 185 deletions(-) create mode 100644 modules/mono/glue/cs_files/Attributes/ExportAttribute.cs create mode 100644 modules/mono/glue/cs_files/Attributes/GodotMethodAttribute.cs create mode 100644 modules/mono/glue/cs_files/Attributes/RPCAttributes.cs create mode 100644 modules/mono/glue/cs_files/Attributes/SignalAttribute.cs create mode 100644 modules/mono/glue/cs_files/Attributes/ToolAttribute.cs delete mode 100644 modules/mono/glue/cs_files/ExportAttribute.cs create mode 100644 modules/mono/glue/cs_files/Extensions/NodeExtensions.cs create mode 100644 modules/mono/glue/cs_files/Extensions/ObjectExtensions.cs create mode 100644 modules/mono/glue/cs_files/Extensions/ResourceLoaderExtensions.cs delete mode 100644 modules/mono/glue/cs_files/GodotMethodAttribute.cs delete mode 100644 modules/mono/glue/cs_files/IAwaitable.cs delete mode 100644 modules/mono/glue/cs_files/IAwaiter.cs create mode 100644 modules/mono/glue/cs_files/Interfaces/IAwaitable.cs create mode 100644 modules/mono/glue/cs_files/Interfaces/IAwaiter.cs delete mode 100644 modules/mono/glue/cs_files/NodeExtensions.cs delete mode 100644 modules/mono/glue/cs_files/ObjectExtensions.cs delete mode 100644 modules/mono/glue/cs_files/RPCAttributes.cs delete mode 100644 modules/mono/glue/cs_files/ResourceLoaderExtensions.cs delete mode 100644 modules/mono/glue/cs_files/SignalAttribute.cs delete mode 100644 modules/mono/glue/cs_files/ToolAttribute.cs diff --git a/modules/mono/glue/cs_files/Attributes/ExportAttribute.cs b/modules/mono/glue/cs_files/Attributes/ExportAttribute.cs new file mode 100644 index 0000000000..6adf044886 --- /dev/null +++ b/modules/mono/glue/cs_files/Attributes/ExportAttribute.cs @@ -0,0 +1,17 @@ +using System; + +namespace Godot +{ + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class ExportAttribute : Attribute + { + private PropertyHint hint; + private string hintString; + + public ExportAttribute(PropertyHint hint = PropertyHint.None, string hintString = "") + { + this.hint = hint; + this.hintString = hintString; + } + } +} diff --git a/modules/mono/glue/cs_files/Attributes/GodotMethodAttribute.cs b/modules/mono/glue/cs_files/Attributes/GodotMethodAttribute.cs new file mode 100644 index 0000000000..55848769d5 --- /dev/null +++ b/modules/mono/glue/cs_files/Attributes/GodotMethodAttribute.cs @@ -0,0 +1,17 @@ +using System; + +namespace Godot +{ + [AttributeUsage(AttributeTargets.Method)] + internal class GodotMethodAttribute : Attribute + { + private string methodName; + + public string MethodName { get { return methodName; } } + + public GodotMethodAttribute(string methodName) + { + this.methodName = methodName; + } + } +} diff --git a/modules/mono/glue/cs_files/Attributes/RPCAttributes.cs b/modules/mono/glue/cs_files/Attributes/RPCAttributes.cs new file mode 100644 index 0000000000..6bf9560bfa --- /dev/null +++ b/modules/mono/glue/cs_files/Attributes/RPCAttributes.cs @@ -0,0 +1,25 @@ +using System; + +namespace Godot +{ + [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field)] + public class RemoteAttribute : Attribute {} + + [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field)] + public class SyncAttribute : Attribute {} + + [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field)] + public class MasterAttribute : Attribute {} + + [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field)] + public class SlaveAttribute : Attribute {} + + [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field)] + public class RemoteSyncAttribute : Attribute {} + + [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field)] + public class MasterSyncAttribute : Attribute {} + + [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field)] + public class SlaveSyncAttribute : Attribute {} +} diff --git a/modules/mono/glue/cs_files/Attributes/SignalAttribute.cs b/modules/mono/glue/cs_files/Attributes/SignalAttribute.cs new file mode 100644 index 0000000000..3957387be9 --- /dev/null +++ b/modules/mono/glue/cs_files/Attributes/SignalAttribute.cs @@ -0,0 +1,9 @@ +using System; + +namespace Godot +{ + [AttributeUsage(AttributeTargets.Delegate)] + public class SignalAttribute : Attribute + { + } +} diff --git a/modules/mono/glue/cs_files/Attributes/ToolAttribute.cs b/modules/mono/glue/cs_files/Attributes/ToolAttribute.cs new file mode 100644 index 0000000000..d0437409af --- /dev/null +++ b/modules/mono/glue/cs_files/Attributes/ToolAttribute.cs @@ -0,0 +1,7 @@ +using System; + +namespace Godot +{ + [AttributeUsage(AttributeTargets.Class)] + public class ToolAttribute : Attribute {} +} diff --git a/modules/mono/glue/cs_files/ExportAttribute.cs b/modules/mono/glue/cs_files/ExportAttribute.cs deleted file mode 100644 index e6f569e1bb..0000000000 --- a/modules/mono/glue/cs_files/ExportAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace Godot -{ - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] - public class ExportAttribute : Attribute - { - private PropertyHint hint; - private string hintString; - - public ExportAttribute(PropertyHint hint = PropertyHint.None, string hintString = "") - { - this.hint = hint; - this.hintString = hintString; - } - } -} diff --git a/modules/mono/glue/cs_files/Extensions/NodeExtensions.cs b/modules/mono/glue/cs_files/Extensions/NodeExtensions.cs new file mode 100644 index 0000000000..71534d7782 --- /dev/null +++ b/modules/mono/glue/cs_files/Extensions/NodeExtensions.cs @@ -0,0 +1,45 @@ +namespace Godot +{ + public partial class Node + { + public T GetNode(NodePath path) where T : Godot.Node + { + return (T)GetNode(path); + } + + public T GetNodeOrNull(NodePath path) where T : Godot.Node + { + return GetNode(path) as T; + } + + public T GetChild(int idx) where T : Godot.Node + { + return (T)GetChild(idx); + } + + public T GetChildOrNull(int idx) where T : Godot.Node + { + return GetChild(idx) as T; + } + + public T GetOwner() where T : Godot.Node + { + return (T)GetOwner(); + } + + public T GetOwnerOrNull() where T : Godot.Node + { + return GetOwner() as T; + } + + public T GetParent() where T : Godot.Node + { + return (T)GetParent(); + } + + public T GetParentOrNull() where T : Godot.Node + { + return GetParent() as T; + } + } +} diff --git a/modules/mono/glue/cs_files/Extensions/ObjectExtensions.cs b/modules/mono/glue/cs_files/Extensions/ObjectExtensions.cs new file mode 100644 index 0000000000..5c9e6609f4 --- /dev/null +++ b/modules/mono/glue/cs_files/Extensions/ObjectExtensions.cs @@ -0,0 +1,17 @@ +using System; + +namespace Godot +{ + public partial class Object + { + public static bool IsInstanceValid(Object instance) + { + return instance != null && instance.NativeInstance != IntPtr.Zero; + } + + public static WeakRef WeakRef(Object obj) + { + return NativeCalls.godot_icall_Godot_weakref(Object.GetPtr(obj)); + } + } +} diff --git a/modules/mono/glue/cs_files/Extensions/ResourceLoaderExtensions.cs b/modules/mono/glue/cs_files/Extensions/ResourceLoaderExtensions.cs new file mode 100644 index 0000000000..ceecc589e6 --- /dev/null +++ b/modules/mono/glue/cs_files/Extensions/ResourceLoaderExtensions.cs @@ -0,0 +1,10 @@ +namespace Godot +{ + public static partial class ResourceLoader + { + public static T Load(string path) where T : Godot.Resource + { + return (T) Load(path); + } + } +} diff --git a/modules/mono/glue/cs_files/GodotMethodAttribute.cs b/modules/mono/glue/cs_files/GodotMethodAttribute.cs deleted file mode 100644 index 55848769d5..0000000000 --- a/modules/mono/glue/cs_files/GodotMethodAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace Godot -{ - [AttributeUsage(AttributeTargets.Method)] - internal class GodotMethodAttribute : Attribute - { - private string methodName; - - public string MethodName { get { return methodName; } } - - public GodotMethodAttribute(string methodName) - { - this.methodName = methodName; - } - } -} diff --git a/modules/mono/glue/cs_files/IAwaitable.cs b/modules/mono/glue/cs_files/IAwaitable.cs deleted file mode 100644 index 0397957d00..0000000000 --- a/modules/mono/glue/cs_files/IAwaitable.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Godot -{ - public interface IAwaitable - { - IAwaiter GetAwaiter(); - } - - public interface IAwaitable - { - IAwaiter GetAwaiter(); - } -} diff --git a/modules/mono/glue/cs_files/IAwaiter.cs b/modules/mono/glue/cs_files/IAwaiter.cs deleted file mode 100644 index b5aa1a5389..0000000000 --- a/modules/mono/glue/cs_files/IAwaiter.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Runtime.CompilerServices; - -namespace Godot -{ - public interface IAwaiter : INotifyCompletion - { - bool IsCompleted { get; } - - void GetResult(); - } - - public interface IAwaiter : INotifyCompletion - { - bool IsCompleted { get; } - - TResult GetResult(); - } -} diff --git a/modules/mono/glue/cs_files/Interfaces/IAwaitable.cs b/modules/mono/glue/cs_files/Interfaces/IAwaitable.cs new file mode 100644 index 0000000000..0397957d00 --- /dev/null +++ b/modules/mono/glue/cs_files/Interfaces/IAwaitable.cs @@ -0,0 +1,12 @@ +namespace Godot +{ + public interface IAwaitable + { + IAwaiter GetAwaiter(); + } + + public interface IAwaitable + { + IAwaiter GetAwaiter(); + } +} diff --git a/modules/mono/glue/cs_files/Interfaces/IAwaiter.cs b/modules/mono/glue/cs_files/Interfaces/IAwaiter.cs new file mode 100644 index 0000000000..d3be9d781c --- /dev/null +++ b/modules/mono/glue/cs_files/Interfaces/IAwaiter.cs @@ -0,0 +1,18 @@ +using System.Runtime.CompilerServices; + +namespace Godot +{ + public interface IAwaiter : INotifyCompletion + { + bool IsCompleted { get; } + + void GetResult(); + } + + public interface IAwaiter : INotifyCompletion + { + bool IsCompleted { get; } + + TResult GetResult(); + } +} diff --git a/modules/mono/glue/cs_files/NodeExtensions.cs b/modules/mono/glue/cs_files/NodeExtensions.cs deleted file mode 100644 index 71534d7782..0000000000 --- a/modules/mono/glue/cs_files/NodeExtensions.cs +++ /dev/null @@ -1,45 +0,0 @@ -namespace Godot -{ - public partial class Node - { - public T GetNode(NodePath path) where T : Godot.Node - { - return (T)GetNode(path); - } - - public T GetNodeOrNull(NodePath path) where T : Godot.Node - { - return GetNode(path) as T; - } - - public T GetChild(int idx) where T : Godot.Node - { - return (T)GetChild(idx); - } - - public T GetChildOrNull(int idx) where T : Godot.Node - { - return GetChild(idx) as T; - } - - public T GetOwner() where T : Godot.Node - { - return (T)GetOwner(); - } - - public T GetOwnerOrNull() where T : Godot.Node - { - return GetOwner() as T; - } - - public T GetParent() where T : Godot.Node - { - return (T)GetParent(); - } - - public T GetParentOrNull() where T : Godot.Node - { - return GetParent() as T; - } - } -} diff --git a/modules/mono/glue/cs_files/ObjectExtensions.cs b/modules/mono/glue/cs_files/ObjectExtensions.cs deleted file mode 100644 index 5c9e6609f4..0000000000 --- a/modules/mono/glue/cs_files/ObjectExtensions.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace Godot -{ - public partial class Object - { - public static bool IsInstanceValid(Object instance) - { - return instance != null && instance.NativeInstance != IntPtr.Zero; - } - - public static WeakRef WeakRef(Object obj) - { - return NativeCalls.godot_icall_Godot_weakref(Object.GetPtr(obj)); - } - } -} diff --git a/modules/mono/glue/cs_files/RPCAttributes.cs b/modules/mono/glue/cs_files/RPCAttributes.cs deleted file mode 100644 index 6bf9560bfa..0000000000 --- a/modules/mono/glue/cs_files/RPCAttributes.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; - -namespace Godot -{ - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field)] - public class RemoteAttribute : Attribute {} - - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field)] - public class SyncAttribute : Attribute {} - - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field)] - public class MasterAttribute : Attribute {} - - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field)] - public class SlaveAttribute : Attribute {} - - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field)] - public class RemoteSyncAttribute : Attribute {} - - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field)] - public class MasterSyncAttribute : Attribute {} - - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field)] - public class SlaveSyncAttribute : Attribute {} -} diff --git a/modules/mono/glue/cs_files/ResourceLoaderExtensions.cs b/modules/mono/glue/cs_files/ResourceLoaderExtensions.cs deleted file mode 100644 index ceecc589e6..0000000000 --- a/modules/mono/glue/cs_files/ResourceLoaderExtensions.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Godot -{ - public static partial class ResourceLoader - { - public static T Load(string path) where T : Godot.Resource - { - return (T) Load(path); - } - } -} diff --git a/modules/mono/glue/cs_files/SignalAttribute.cs b/modules/mono/glue/cs_files/SignalAttribute.cs deleted file mode 100644 index 3957387be9..0000000000 --- a/modules/mono/glue/cs_files/SignalAttribute.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace Godot -{ - [AttributeUsage(AttributeTargets.Delegate)] - public class SignalAttribute : Attribute - { - } -} diff --git a/modules/mono/glue/cs_files/StringExtensions.cs b/modules/mono/glue/cs_files/StringExtensions.cs index eaeed7b37b..b58f8bc6a8 100644 --- a/modules/mono/glue/cs_files/StringExtensions.cs +++ b/modules/mono/glue/cs_files/StringExtensions.cs @@ -1,5 +1,3 @@ -//using System; - using System; using System.Collections.Generic; using System.Globalization; @@ -583,7 +581,7 @@ namespace Godot // public static byte[] Md5Buffer(this string instance) { - return NativeCalls.godot_icall_String_md5_buffer(instance); + return NativeCalls.godot_icall_String_md5_buffer(instance); } // @@ -591,7 +589,7 @@ namespace Godot // public static string Md5Text(this string instance) { - return NativeCalls.godot_icall_String_md5_text(instance); + return NativeCalls.godot_icall_String_md5_text(instance); } // @@ -750,7 +748,7 @@ namespace Godot // public static int Rfind(this string instance, string what, int from = -1) { - return NativeCalls.godot_icall_String_rfind(instance, what, from); + return NativeCalls.godot_icall_String_rfind(instance, what, from); } // @@ -758,7 +756,7 @@ namespace Godot // public static int Rfindn(this string instance, string what, int from = -1) { - return NativeCalls.godot_icall_String_rfindn(instance, what, from); + return NativeCalls.godot_icall_String_rfindn(instance, what, from); } // @@ -777,7 +775,7 @@ namespace Godot public static byte[] Sha256Buffer(this string instance) { - return NativeCalls.godot_icall_String_sha256_buffer(instance); + return NativeCalls.godot_icall_String_sha256_buffer(instance); } // @@ -785,7 +783,7 @@ namespace Godot // public static string Sha256Text(this string instance) { - return NativeCalls.godot_icall_String_sha256_text(instance); + return NativeCalls.godot_icall_String_sha256_text(instance); } // diff --git a/modules/mono/glue/cs_files/ToolAttribute.cs b/modules/mono/glue/cs_files/ToolAttribute.cs deleted file mode 100644 index d8601b5b32..0000000000 --- a/modules/mono/glue/cs_files/ToolAttribute.cs +++ /dev/null @@ -1,7 +0,0 @@ -using System; - -namespace Godot -{ - [AttributeUsage(AttributeTargets.Class)] - public class ToolAttribute : Attribute {} -} -- cgit v1.2.3