Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #20 from uurha/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
uurha committed Nov 29, 2022
1 parent a8b206a commit 17da234
Show file tree
Hide file tree
Showing 27 changed files with 50 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Editor/BetterExtensions.Editor.asmdef
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "BetterExtensions.Editor",
"rootNamespace": "",
"rootNamespace": "Better.Extensions",
"references": [],
"includePlatforms": [
"Editor"
Expand Down
2 changes: 1 addition & 1 deletion Editor/EditorAddons/ComponentExtension.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using UnityEditor;
using UnityEngine;

namespace BetterExtensions.EditorAddons
namespace Better.Extensions.EditorAddons
{
public static class ComponentExtension
{
Expand Down
2 changes: 1 addition & 1 deletion Runtime/BetterExtensions.Runtime.asmdef
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "BetterExtensions.Runtime",
"rootNamespace": "",
"rootNamespace": "Better.Extensions",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
Expand Down
2 changes: 1 addition & 1 deletion Runtime/CustomComponents/TMP_Extensions/LinkOpener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using UnityEngine;
using UnityEngine.EventSystems;

namespace BetterExtensions.Runtime.CustomComponents
namespace Runtime.CustomComponents
{
/// <summary>
/// Component to open URL inside TMPro.TMP_Text
Expand Down
5 changes: 2 additions & 3 deletions Runtime/Extension/ActionExtensions/ActionAwaiter.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using System;
using System.Threading;
using System.Threading;
using System.Threading.Tasks;
using UnityEngine.Events;

namespace BetterExtensions.Runtime.Extension.ActionExtensions
namespace Better.Extensions.Runtime.Extension.ActionExtensions
{
public static class ActionAwaiter
{
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Extension/ActionExtensions/BaseActionWrapper.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Threading.Tasks;

namespace BetterExtensions.Runtime.Extension.ActionExtensions
namespace Better.Extensions.Runtime.Extension.ActionExtensions
{
internal abstract class BaseActionWrapper<T>
{
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Extension/ActionExtensions/UnityEventWrapper.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Threading.Tasks;
using UnityEngine.Events;

namespace BetterExtensions.Runtime.Extension.ActionExtensions
namespace Better.Extensions.Runtime.Extension.ActionExtensions
{
internal class UnityEventWrapper<T> : BaseActionWrapper<T>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using UnityEngine;
using Object = UnityEngine.Object;

namespace BetterExtensions.Runtime.Extension.AsyncExtension
namespace Better.Extensions.Runtime.Extension.AsyncExtension
{
[DebuggerNonUserCode]
public readonly struct AssetBundleRequestAwaiter : INotifyCompletion
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Extension/AsyncExtension/AsyncOperationAwaiter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Runtime.CompilerServices;
using UnityEngine;

namespace BetterExtensions.Runtime.Extension.AsyncExtension
namespace Better.Extensions.Runtime.Extension.AsyncExtension
{
[DebuggerNonUserCode]
public readonly struct AsyncOperationAwaiter : INotifyCompletion
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Extension/AsyncExtension/ExtensionMethods.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using UnityEngine;
using UnityEngine.Networking;

namespace BetterExtensions.Runtime.Extension.AsyncExtension
namespace Better.Extensions.Runtime.Extension.AsyncExtension
{
public static class ExtensionMethods
{
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Extension/AsyncExtension/ResourceRequestAwaiter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Runtime.CompilerServices;
using UnityEngine;

namespace BetterExtensions.Runtime.Extension.AsyncExtension
namespace Better.Extensions.Runtime.Extension.AsyncExtension
{
[DebuggerNonUserCode]
public readonly struct ResourceRequestAwaiter : INotifyCompletion
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Extension/AsyncExtension/UnityWebRequestAwaiter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Runtime.CompilerServices;
using UnityEngine.Networking;

namespace BetterExtensions.Runtime.Extension.AsyncExtension
namespace Better.Extensions.Runtime.Extension.AsyncExtension
{
[DebuggerNonUserCode]
public readonly struct UnityWebRequestAwaiter : INotifyCompletion
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Extension/AudioClipExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Threading.Tasks;
using UnityEngine;

namespace BetterExtensions.Runtime.Extension
namespace Better.Extensions.Runtime.Extension
{
public static class AudioClipExtensions
{
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Extension/ClipboardExtension.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using UnityEngine;

namespace BetterExtensions.Runtime.Extension
namespace Better.Extensions.Runtime.Extension
{
public static class ClipboardExtension
{
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Extension/EnumExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Reflection;

namespace BetterExtensions.Runtime.Extension
namespace Better.Extensions.Runtime.Extension
{
public static class EnumExtensions
{
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Extension/MathfExtensions/Range.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using UnityEngine;

namespace BetterExtensions.Runtime.Extension.MathfExtensions
namespace Better.Extensions.Runtime.Extension.MathfExtensions
{
[Serializable]
public struct Range<T> where T : new()
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Extension/MathfExtensions/RangeExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using UnityEngine;

namespace BetterExtensions.Runtime.Extension.MathfExtensions
namespace Better.Extensions.Runtime.Extension.MathfExtensions
{
public static class RangeExtensions
{
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Extension/MathfExtensions/RendererExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Linq;
using UnityEngine;

namespace BetterExtensions.Runtime.Extension.MathfExtensions
namespace Better.Extensions.Runtime.Extension.MathfExtensions
{
public static class RendererExtensions
{
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Extension/MathfExtensions/TransformStruct.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using UnityEngine;

namespace BetterExtensions.Runtime.Extension.MathfExtensions
namespace Better.Extensions.Runtime.Extension.MathfExtensions
{
public readonly struct LineIntersection
{
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Extension/MathfExtensions/Vector3Math.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Unity.Collections;
using UnityEngine;

namespace BetterExtensions.Runtime.Extension.MathfExtensions
namespace Better.Extensions.Runtime.Extension.MathfExtensions
{
public struct Vector3Math
{
Expand Down
26 changes: 23 additions & 3 deletions Runtime/Extension/NullableExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace BetterExtensions.Runtime.Extension
namespace Better.Extensions.Runtime.Extension
{
public static class NullableExtensions
{
Expand All @@ -20,7 +20,7 @@ public static bool IsNullable(this Type type)
if (!type.IsValueType) return true;
return Nullable.GetUnderlyingType(type) != null;
}

public static bool Cast<T>(this object o, out T value)
{
value = default;
Expand All @@ -31,7 +31,27 @@ public static bool Cast<T>(this object o, out T value)
return true;
}
}


if (o is T casted)
{
value = casted;
return true;
}

return false;
}

public static bool Cast<T1, T>(this T1 o, out T value)
{
value = default;
if (IsNullable<T>())
{
if (o == null)
{
return true;
}
}

if (o is T casted)
{
value = casted;
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Extension/SerializeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Text;
using System.Threading.Tasks;

namespace BetterExtensions.Runtime.Extension
namespace Better.Extensions.Runtime.Extension
{
public static class SerializeExtensions
{
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Extension/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Reflection;
using System.Text.RegularExpressions;

namespace BetterExtensions.Runtime.Extension
namespace Better.Extensions.Runtime.Extension
{
public static class StringExtensions
{
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Extension/TasksExtension/TaskExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Threading.Tasks;

namespace BetterExtensions.Runtime.Extension.TasksExtension
namespace Better.Extensions.Runtime.Extension.TasksExtension
{
public static class TaskExtensions
{
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Extension/UIExtension.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections;
using UnityEngine;

namespace BetterExtensions.Runtime.Extension
namespace Better.Extensions.Runtime.Extension
{
/// <summary>
/// UI state tool for canvas groups
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Wrappers/DownloadHandlerFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using UnityEngine;
using UnityEngine.Networking;

namespace BetterExtensions.Runtime.Wrappers
namespace Better.Extensions.Runtime.Wrappers
{
/// <summary>
/// This class allows to load file directly to file without loading file into memory.
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"changelogUrl": "https://github.com/uurha/BetterExtensions",
"documentationUrl": "https://github.com/uurha/BetterExtensions/tree/main#readme",
"license": "MIT",
"licensesUrl":"https://github.com/uurha/BetterExtensions/blob/main/LICENSE",
"keywords": [
"extensions",
"asynchronous"
Expand Down

0 comments on commit 17da234

Please sign in to comment.