mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-22 17:18:48 +00:00
🔥 Remove Drawing, WinForms and Unity projects
This commit is contained in:
parent
f200765280
commit
9c061eacf1
@ -1,188 +0,0 @@
|
||||
namespace X10D.Drawing
|
||||
{
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for <see cref="Image"/>.
|
||||
/// </summary>
|
||||
public static class ImageExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously converts the image so that its aspect ratio is 1:1, surrounding any new area with
|
||||
/// transparency.
|
||||
/// </summary>
|
||||
/// <param name="image">The image to convert.</param>
|
||||
/// <returns>Returns an <see cref="Image"/>.</returns>
|
||||
public static async Task<Image> ToSquareAsync(this Image image)
|
||||
{
|
||||
return await Task.Run(image.ToSquare);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously converts the image so that its aspect ratio is 1:1, surrounding any new area with
|
||||
/// transparency.
|
||||
/// </summary>
|
||||
/// <param name="image">The image to convert.</param>
|
||||
/// <param name="size">The new size of the image, i.e. the value of both the width and height.</param>
|
||||
/// <returns>Returns an <see cref="Image"/>.</returns>
|
||||
public static async Task<Image> ToSquareAsync(this Image image, int size)
|
||||
{
|
||||
return await Task.Run(() => image.ToSquare(size));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously converts the image so that its aspect ratio is 1:1, surrounding any new area with a
|
||||
/// specified background color.
|
||||
/// </summary>
|
||||
/// <param name="image">The image to convert.</param>
|
||||
/// <param name="size">The new size of the image, i.e. the value of both the width and height.</param>
|
||||
/// <param name="background">The background color to fill.</param>
|
||||
/// <returns>Returns an <see cref="Image"/>.</returns>
|
||||
public static async Task<Image> ToSquareAsync(this Image image, int size, Color background)
|
||||
{
|
||||
return await Task.Run(() => image.ToSquare(size, background));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously converts the image so that its aspect ratio is 1:1, surrounding any new area with a
|
||||
/// specified background color.
|
||||
/// </summary>
|
||||
/// <param name="image">The image to convert.</param>
|
||||
/// <param name="background">The background color to fill.</param>
|
||||
/// <returns>Returns an <see cref="Image"/>.</returns>
|
||||
public static async Task<Image> ToSquareAsync(this Image image, Color background)
|
||||
{
|
||||
return await Task.Run(() => image.ToSquare(background));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts the image so that its aspect ratio is 1:1, surrounding any new area with transparency.
|
||||
/// </summary>
|
||||
/// <param name="image">The image to convert.</param>
|
||||
/// <returns>Returns an <see cref="Image"/>.</returns>
|
||||
public static Image ToSquare(this Image image)
|
||||
{
|
||||
return image.ToSquare(Color.Transparent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts the image so that its aspect ratio is 1:1, surrounding any new area with transparency.
|
||||
/// </summary>
|
||||
/// <param name="image">The image to convert.</param>
|
||||
/// <param name="size">The new size of the image, i.e. the value of both the width and height.</param>
|
||||
/// <returns>Returns an <see cref="Image"/>.</returns>
|
||||
public static Image ToSquare(this Image image, int size)
|
||||
{
|
||||
return image.ToSquare(size, Color.Transparent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts the image so that its aspect ratio is 1:1, surrounding any new area with a specified background
|
||||
/// color.
|
||||
/// </summary>
|
||||
/// <param name="image">The image to convert.</param>
|
||||
/// <param name="background">The background color to fill.</param>
|
||||
/// <returns>Returns an <see cref="Image"/>.</returns>
|
||||
public static Image ToSquare(this Image image, Color background)
|
||||
{
|
||||
int resolution = Math.Max(image.Width, image.Height);
|
||||
return image.ToSquare(resolution, background);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts the image so that its aspect ratio is 1:1, surrounding any new area with a specified background
|
||||
/// color.
|
||||
/// </summary>
|
||||
/// <param name="image">The image to convert.</param>
|
||||
/// <param name="size">The new size of the image, i.e. the value of both the width and height.</param>
|
||||
/// <param name="background">The background color to fill.</param>
|
||||
/// <returns>Returns an <see cref="Image"/>.</returns>
|
||||
public static Image ToSquare(this Image image, int size, Color background)
|
||||
{
|
||||
int resolution = Math.Max(image.Width, image.Height);
|
||||
Bitmap newImage = new Bitmap(resolution, resolution);
|
||||
|
||||
using (Graphics graphics = Graphics.FromImage(newImage))
|
||||
{
|
||||
graphics.FillRectangle(new SolidBrush(background), new Rectangle(0, 0,
|
||||
resolution, resolution));
|
||||
|
||||
graphics.DrawImageUnscaled(image, resolution / 2 - image.Width / 2,
|
||||
resolution / 2 - image.Height / 2);
|
||||
}
|
||||
|
||||
return newImage.Scale(size, size);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously scales the image.
|
||||
/// </summary>
|
||||
/// <param name="image">The image to scale.</param>
|
||||
/// <param name="width">The new width.</param>
|
||||
/// <param name="height">The new height.</param>
|
||||
/// <returns>Returns a new <see cref="Image"/>.</returns>
|
||||
public static async Task<Bitmap> ScaleAsync(this Image image, int width, int height)
|
||||
{
|
||||
return await Task.Run(() => image.Scale(width, height));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously scales the image.
|
||||
/// </summary>
|
||||
/// <param name="image">The image to scale.</param>
|
||||
/// <param name="factor">The scale factor.</param>
|
||||
/// <returns>Returns a new <see cref="Image"/>.</returns>
|
||||
public static async Task<Bitmap> ScaleAsync(this Image image, float factor)
|
||||
{
|
||||
return await Task.Run(() => image.Scale(factor));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scales the image.
|
||||
/// </summary>
|
||||
/// <param name="image">The image to scale.</param>
|
||||
/// <param name="factor">The scale factor.</param>
|
||||
/// <returns>Returns a new <see cref="Image"/>.</returns>
|
||||
public static Bitmap Scale(this Image image, float factor)
|
||||
{
|
||||
return image.Scale((int) (image.Width * factor), (int) (image.Height * factor));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scales the image.
|
||||
/// </summary>
|
||||
/// <param name="image">The image to scale.</param>
|
||||
/// <param name="width">The new width.</param>
|
||||
/// <param name="height">The new height.</param>
|
||||
/// <returns>Returns a new <see cref="Image"/>.</returns>
|
||||
public static Bitmap Scale(this Image image, int width, int height)
|
||||
{
|
||||
Rectangle destRect = new Rectangle(0, 0, width, height);
|
||||
Bitmap destImage = new Bitmap(width, height);
|
||||
|
||||
destImage.SetResolution(image.HorizontalResolution, image.VerticalResolution);
|
||||
|
||||
using (Graphics graphics = Graphics.FromImage(destImage))
|
||||
{
|
||||
graphics.CompositingMode = CompositingMode.SourceCopy;
|
||||
graphics.CompositingQuality = CompositingQuality.HighQuality;
|
||||
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
graphics.SmoothingMode = SmoothingMode.HighQuality;
|
||||
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
||||
|
||||
using (ImageAttributes wrapMode = new ImageAttributes())
|
||||
{
|
||||
wrapMode.SetWrapMode(WrapMode.TileFlipXY);
|
||||
graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel,
|
||||
wrapMode);
|
||||
}
|
||||
}
|
||||
|
||||
return destImage;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Extensions.Drawing")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Extensions.Drawing")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("9e27fb65-4182-443c-8abe-71292f892b59")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
@ -1,11 +0,0 @@
|
||||
# X10D.Drawing
|
||||
|
||||
## About
|
||||
The X10D.Drawing library contains extension methods for the System.Drawing .NET library.
|
||||
|
||||
## Extended Classes
|
||||
Below is a list of the number of extension methods written for a given type. Overloaded methods are not counted.
|
||||
|
||||
| Type | Library | Method count |
|
||||
| :--- | :--- | :--- |
|
||||
| `Image` | `X10D.Drawing` | 3 (+1 async) |
|
@ -1,49 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{9E27FB65-4182-443C-8ABE-71292F892B59}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>X10D.Drawing</RootNamespace>
|
||||
<AssemblyName>X10D.Drawing</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ImageExtensions.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
1
X10D.Unity/.gitignore
vendored
1
X10D.Unity/.gitignore
vendored
@ -1 +0,0 @@
|
||||
lib/
|
@ -1,78 +0,0 @@
|
||||
namespace X10D.Unity
|
||||
{
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// A set of extension methods for <see cref="Material"/>.
|
||||
/// </summary>
|
||||
public static class MaterialExtensions
|
||||
{
|
||||
private static readonly int srcBlend = Shader.PropertyToID("_SrcBlend");
|
||||
private static readonly int dstBlend = Shader.PropertyToID("_DstBlend");
|
||||
private static readonly int zWrite = Shader.PropertyToID("_ZWrite");
|
||||
|
||||
/// <summary>
|
||||
/// An enumeration of blend modes.
|
||||
/// </summary>
|
||||
public enum BlendMode
|
||||
{
|
||||
Opaque,
|
||||
Cutout,
|
||||
Fade,
|
||||
Transparent
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Changes the material's blend mode.
|
||||
/// </summary>
|
||||
/// <param name="material">The material.</param>
|
||||
/// <param name="blendMode">The blend mode.</param>
|
||||
[SuppressMessage("ReSharper", "StringLiteralTypo")]
|
||||
public static void ChangeRenderMode(this Material material, BlendMode blendMode)
|
||||
{
|
||||
switch (blendMode)
|
||||
{
|
||||
case BlendMode.Opaque:
|
||||
material.SetInt(srcBlend, (int)UnityEngine.Rendering.BlendMode.One);
|
||||
material.SetInt(dstBlend, (int)UnityEngine.Rendering.BlendMode.Zero);
|
||||
material.SetInt(zWrite, 1);
|
||||
material.DisableKeyword("_ALPHATEST_ON");
|
||||
material.DisableKeyword("_ALPHABLEND_ON");
|
||||
material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
|
||||
material.renderQueue = -1;
|
||||
break;
|
||||
|
||||
case BlendMode.Cutout:
|
||||
material.SetInt(srcBlend, (int)UnityEngine.Rendering.BlendMode.One);
|
||||
material.SetInt(dstBlend, (int)UnityEngine.Rendering.BlendMode.Zero);
|
||||
material.SetInt(zWrite, 1);
|
||||
material.EnableKeyword("_ALPHATEST_ON");
|
||||
material.DisableKeyword("_ALPHABLEND_ON");
|
||||
material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
|
||||
material.renderQueue = 2450;
|
||||
break;
|
||||
|
||||
case BlendMode.Fade:
|
||||
material.SetInt(srcBlend, (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
|
||||
material.SetInt(dstBlend, (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
|
||||
material.SetInt(zWrite, 0);
|
||||
material.DisableKeyword("_ALPHATEST_ON");
|
||||
material.EnableKeyword("_ALPHABLEND_ON");
|
||||
material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
|
||||
material.renderQueue = 3000;
|
||||
break;
|
||||
|
||||
case BlendMode.Transparent:
|
||||
material.SetInt(srcBlend, (int)UnityEngine.Rendering.BlendMode.One);
|
||||
material.SetInt(dstBlend, (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
|
||||
material.SetInt(zWrite, 0);
|
||||
material.DisableKeyword("_ALPHATEST_ON");
|
||||
material.DisableKeyword("_ALPHABLEND_ON");
|
||||
material.EnableKeyword("_ALPHAPREMULTIPLY_ON");
|
||||
material.renderQueue = 3000;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Extensions.Unity")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Extensions.Unity")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("2657ef66-0334-4a5a-8c24-6c949224a989")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
@ -1,17 +0,0 @@
|
||||
# X10D.Unity
|
||||
|
||||
## About
|
||||
The X10D.Unity library contains extension methods for Unity engine types.
|
||||
|
||||
## Extended Classes
|
||||
Below is a list of the number of extension methods written for a given type. Overloaded methods are not counted.
|
||||
|
||||
| Type | Library | Method count |
|
||||
| :--- | :--- | :--- |
|
||||
| `Material` | `X10D.Unity` | 1 |
|
||||
| `Vector3` | `X10D.Unity` | 5 |
|
||||
|
||||
## Building
|
||||
To build this library, you will need to reference lib/UnityEngine.CoreModule.dll
|
||||
|
||||
You can find this library under `<UNITY_INSTALL_DIR>/Editor/Data/Managed/UnityEngine`
|
@ -1,66 +0,0 @@
|
||||
namespace X10D.Unity
|
||||
{
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// A set of extension methods for <see cref="Vector3"/>.
|
||||
/// </summary>
|
||||
public static class Vector3Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts a vector normal to an Euler rotation.
|
||||
/// </summary>
|
||||
/// <param name="v">The vector normal.</param>
|
||||
/// <returns>Returns a <see cref="Vector3"/> representing the Euler rotation.</returns>
|
||||
public static Vector3 NormalToEulerAngles(this Vector3 v)
|
||||
{
|
||||
float x = v.x;
|
||||
v.x = v.z;
|
||||
v.z = x;
|
||||
v.z *= 2.0f * v.y;
|
||||
v.y = 0.0f;
|
||||
return v * 90.0f;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rounds a vector to the nearest value.
|
||||
/// </summary>
|
||||
/// <param name="v">The vector to round.</param>
|
||||
/// <param name="nearest">The nearest value.</param>
|
||||
/// <returns>Returns a <see cref="Vector3"/> containing the rounded values.</returns>
|
||||
public static Vector3 Round(this Vector3 v, int nearest = 1)
|
||||
{
|
||||
return new Vector3(v.x.Round(nearest), v.y.Round(nearest), v.z.Round(nearest));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inverts the X component of a vector.
|
||||
/// </summary>
|
||||
/// <param name="v">The vector to evaluate.</param>
|
||||
/// <returns>Returns a <see cref="Vector3"/> whose values are (-X, Y, Z).</returns>
|
||||
public static Vector3 InvertX(this Vector3 v)
|
||||
{
|
||||
return new Vector3(-v.x, v.y, v.z);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inverts the Y component of a vector.
|
||||
/// </summary>
|
||||
/// <param name="v">The vector to evaluate.</param>
|
||||
/// <returns>Returns a <see cref="Vector3"/> whose values are (X, -Y, Z).</returns>
|
||||
public static Vector3 InvertY(this Vector3 v)
|
||||
{
|
||||
return new Vector3(v.x, -v.y, v.z);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inverts the Z component of a vector.
|
||||
/// </summary>
|
||||
/// <param name="v">The vector to evaluate.</param>
|
||||
/// <returns>Returns a <see cref="Vector3"/> whose values are (X, Y, -Z).</returns>
|
||||
public static Vector3 InvertZ(this Vector3 v)
|
||||
{
|
||||
return new Vector3(v.x, v.y, -v.z);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{2657EF66-0334-4A5A-8C24-6C949224A989}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>X10D.Unity</RootNamespace>
|
||||
<AssemblyName>X10D.Unity</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>lib\UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MaterialExtensions.cs" />
|
||||
<Compile Include="Vector3Extensions.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\X10D\X10D.csproj">
|
||||
<Project>{4a8cc062-8b82-4625-b3cc-7dbeab2af149}</Project>
|
||||
<Name>X10D</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
@ -1,68 +0,0 @@
|
||||
namespace X10D.WinForms
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for <see cref="Control"/>.
|
||||
/// </summary>
|
||||
public static class ControlExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets all controls and child controls of a specified control.
|
||||
/// </summary>
|
||||
/// <param name="control">The parent control.</param>
|
||||
/// <returns>Returns a collection of controls.</returns>
|
||||
public static IEnumerable<Control> GetAllControls(this Control control)
|
||||
{
|
||||
return control.GetAllControls<Control>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all controls and child controls of a specified control, which match the specified type.
|
||||
/// </summary>
|
||||
/// <typeparam name="TControl">A <see cref="Control"/> type.</typeparam>
|
||||
/// <param name="control">The parent control.</param>
|
||||
/// <returns>Returns a collection of controls.</returns>
|
||||
public static IEnumerable<TControl> GetAllControls<TControl>(this Control control)
|
||||
where TControl : Control
|
||||
{
|
||||
return control.GetAllControls(typeof(TControl)).Cast<TControl>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all controls and child controls of a specified control, which match the specified type.
|
||||
/// </summary>
|
||||
/// <param name="control">The parent control.</param>
|
||||
/// <param name="type">The type to match.</param>
|
||||
/// <returns>Returns a collection of controls.</returns>
|
||||
public static IEnumerable<Control> GetAllControls(this Control control, Type type)
|
||||
{
|
||||
IEnumerable<Control> controls = control.Controls.Cast<Control>().ToArray();
|
||||
|
||||
return controls.SelectMany(c => GetAllControls(c, type))
|
||||
.Concat(controls)
|
||||
.Where(c => c.GetType() == type);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Thread-safe method invocation. Calls <see cref="Control.Invoke(System.Delegate)"/> if
|
||||
/// <see cref="Control.InvokeRequired"/> returns <see langword="true"/>.
|
||||
/// </summary>
|
||||
/// <param name="control">The control from which to invoke.</param>
|
||||
/// <param name="action">The action to invoke.</param>
|
||||
public static void InvokeIfRequired(this Control control, MethodInvoker action)
|
||||
{
|
||||
if (control?.InvokeRequired ?? false)
|
||||
{
|
||||
control.Invoke(action);
|
||||
}
|
||||
else
|
||||
{
|
||||
action();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
namespace X10D.WinForms
|
||||
{
|
||||
using System.Windows.Forms;
|
||||
|
||||
/// <summary>
|
||||
/// A set of extension methods for <see cref="ListView"/> and <see cref="ListViewItem"/>.
|
||||
/// </summary>
|
||||
public static class ListViewExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Moves the <see cref="ListViewItem"/> to the top of the specified <see cref="ListView"/>.
|
||||
/// </summary>
|
||||
/// <param name="item">The <see cref="ListViewItem"/> to move.</param>
|
||||
/// <param name="listView">Optional. The parent <see cref="ListView"/>. Defaults to the current parent.</param>
|
||||
public static void MoveToTop(this ListViewItem item, ListView listView = null)
|
||||
{
|
||||
if (listView == null)
|
||||
{
|
||||
listView = item.ListView;
|
||||
}
|
||||
|
||||
if (listView.Items.Contains(item))
|
||||
{
|
||||
int i = listView.Items.IndexOf(item);
|
||||
listView.Items.RemoveAt(i);
|
||||
}
|
||||
|
||||
listView.Items.Insert(0, item);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Extensions.WinForms")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Extensions.WinForms")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("8bc9ef95-dc0f-4866-a01e-f07bbc675829")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
@ -1,12 +0,0 @@
|
||||
# X10D.WinForms
|
||||
|
||||
## About
|
||||
The X10D.WinForms library contains extension methods for the System.Windows.Forms library.
|
||||
|
||||
## Extended Classes
|
||||
Below is a list of the number of extension methods written for a given type. Overloaded methods are not counted.
|
||||
|
||||
| Type | Library | Method count |
|
||||
| :--- | :--- | :--- |
|
||||
| `Control` | `X10D.WinForms` | 2 |
|
||||
| `ListViewItem` | `X10D.Unity` | 1 |
|
@ -1,52 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{8BC9EF95-DC0F-4866-A01E-F07BBC675829}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>X10D.WinForms</RootNamespace>
|
||||
<AssemblyName>X10D.WinForms</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ControlExtensions.cs" />
|
||||
<Compile Include="ListViewExtensions.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
30
X10D.sln
30
X10D.sln
@ -3,36 +3,30 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.28902.138
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "X10D.WinForms", "X10D.WinForms\X10D.WinForms.csproj", "{8BC9EF95-DC0F-4866-A01E-F07BBC675829}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "X10D.Drawing", "X10D.Drawing\X10D.Drawing.csproj", "{9E27FB65-4182-443C-8ABE-71292F892B59}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "X10D.Unity", "X10D.Unity\X10D.Unity.csproj", "{2657EF66-0334-4A5A-8C24-6C949224A989}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "X10D", "X10D\X10D.csproj", "{4A8CC062-8B82-4625-B3CC-7DBEAB2AF149}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "X10D.Tests", "X10D.Tests\X10D.Tests.csproj", "{DF228EA2-D8EC-4A40-8917-E1E62E3B7D8E}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{FF6E59AB-1A23-4981-834C-47BEB5A46DC1}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.editorconfig = .editorconfig
|
||||
X10D.ruleset = X10D.ruleset
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{8BC9EF95-DC0F-4866-A01E-F07BBC675829}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8BC9EF95-DC0F-4866-A01E-F07BBC675829}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8BC9EF95-DC0F-4866-A01E-F07BBC675829}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8BC9EF95-DC0F-4866-A01E-F07BBC675829}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9E27FB65-4182-443C-8ABE-71292F892B59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9E27FB65-4182-443C-8ABE-71292F892B59}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9E27FB65-4182-443C-8ABE-71292F892B59}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9E27FB65-4182-443C-8ABE-71292F892B59}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2657EF66-0334-4A5A-8C24-6C949224A989}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2657EF66-0334-4A5A-8C24-6C949224A989}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2657EF66-0334-4A5A-8C24-6C949224A989}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2657EF66-0334-4A5A-8C24-6C949224A989}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4A8CC062-8B82-4625-B3CC-7DBEAB2AF149}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4A8CC062-8B82-4625-B3CC-7DBEAB2AF149}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4A8CC062-8B82-4625-B3CC-7DBEAB2AF149}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4A8CC062-8B82-4625-B3CC-7DBEAB2AF149}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DF228EA2-D8EC-4A40-8917-E1E62E3B7D8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DF228EA2-D8EC-4A40-8917-E1E62E3B7D8E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DF228EA2-D8EC-4A40-8917-E1E62E3B7D8E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DF228EA2-D8EC-4A40-8917-E1E62E3B7D8E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
Loading…
Reference in New Issue
Block a user