-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
612 additions
and
43 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" /> | ||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> | ||
<security> | ||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> | ||
<!-- UAC Manifest Options | ||
If you want to change the Windows User Account Control level replace the | ||
requestedExecutionLevel node with one of the following. | ||
<requestedExecutionLevel level="asInvoker" uiAccess="false" /> | ||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> | ||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" /> | ||
Specifying requestedExecutionLevel node will disable file and registry virtualization. | ||
If you want to utilize File and Registry Virtualization for backward | ||
compatibility then delete the requestedExecutionLevel node. | ||
--> | ||
<requestedExecutionLevel level="asInvoker" uiAccess="false" /> | ||
</requestedPrivileges> | ||
<applicationRequestMinimum> | ||
<defaultAssemblyRequest permissionSetReference="Custom" /> | ||
<PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" /> | ||
</applicationRequestMinimum> | ||
</security> | ||
</trustInfo> | ||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> | ||
<application> | ||
<!-- A list of all Windows versions that this application is designed to work with. | ||
Windows will automatically select the most compatible environment.--> | ||
<!-- If your application is designed to work with Windows Vista, uncomment the following supportedOS node--> | ||
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>--> | ||
<!-- If your application is designed to work with Windows 7, uncomment the following supportedOS node--> | ||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>--> | ||
<!-- If your application is designed to work with Windows 8, uncomment the following supportedOS node--> | ||
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>--> | ||
<!-- If your application is designed to work with Windows 8.1, uncomment the following supportedOS node--> | ||
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>--> | ||
</application> | ||
</compatibility> | ||
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) --> | ||
<!-- <dependency> | ||
<dependentAssembly> | ||
<assemblyIdentity | ||
type="win32" | ||
name="Microsoft.Windows.Common-Controls" | ||
version="6.0.0.0" | ||
processorArchitecture="*" | ||
publicKeyToken="6595b64144ccf1df" | ||
language="*" | ||
/> | ||
</dependentAssembly> | ||
</dependency>--> | ||
</asmv1:assembly> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 55 additions & 30 deletions
85
MonoGame.Framework/MonoGame.Framework/Design/Vector2TypeConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,81 @@ | ||
// MonoGame - Copyright (C) The MonoGame Team | ||
// This file is subject to the terms and conditions defined in | ||
// file 'LICENSE.txt', which is part of this source code package. | ||
|
||
using System; | ||
using System; | ||
using System.ComponentModel; | ||
using System.Globalization; | ||
|
||
namespace Microsoft.Xna.Framework.Design | ||
{ | ||
public class Vector2TypeConverter : TypeConverter | ||
[Serializable] | ||
public class Vector2Converter : ExpandableObjectConverter | ||
{ | ||
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) | ||
// Return true if we need to convert from a string. | ||
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) | ||
{ | ||
if (VectorConversion.CanConvertTo(context, destinationType)) | ||
return true; | ||
if (destinationType == typeof(string)) | ||
return true; | ||
if (sourceType == typeof(string)) return true; | ||
return base.CanConvertFrom(context, sourceType); | ||
} | ||
|
||
// Return true if we need to convert into a string. | ||
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) | ||
{ | ||
if (destinationType == typeof(String)) return true; | ||
return base.CanConvertTo(context, destinationType); | ||
} | ||
|
||
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) | ||
// Convert from a string. | ||
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) | ||
{ | ||
if (value.GetType() == typeof(string)) | ||
{ | ||
// Split the string separated by commas. | ||
string txt = (string)(value); | ||
|
||
string[] fields = txt.Split(new char[] { ';' }); | ||
|
||
try | ||
{ | ||
return new Vector2() { X = float.Parse(fields[0]), Y = float.Parse(fields[1]) }; | ||
} | ||
catch | ||
{ | ||
throw new InvalidCastException( | ||
"Cannot convert the string '" + | ||
value.ToString() + "' into a Vector2, values: " + fields[0] + "::" + fields[1]); | ||
} | ||
} | ||
else | ||
{ | ||
return base.ConvertFrom(context, culture, value); | ||
} | ||
} | ||
|
||
// Convert the StreetAddress to a string. | ||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) | ||
{ | ||
|
||
if (destinationType == typeof(string)) return value.ToString(); | ||
return base.ConvertTo(context, culture, value, destinationType); | ||
} | ||
|
||
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) | ||
// Return true to indicate that the object supports properties. | ||
public override bool GetPropertiesSupported(ITypeDescriptorContext context) | ||
{ | ||
if (sourceType == typeof(string)) | ||
return true; | ||
|
||
return base.CanConvertFrom(context, sourceType); | ||
return false; | ||
} | ||
|
||
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) | ||
// Return a property description collection. | ||
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) | ||
{ | ||
var sourceType = value.GetType(); | ||
var vec = Vector2.Zero; | ||
return TypeDescriptor.GetProperties(value); | ||
|
||
if (sourceType == typeof(string)) | ||
{ | ||
var str = (string)value; | ||
var words = str.Split(culture.TextInfo.ListSeparator.ToCharArray()); | ||
//PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(value, attributes); | ||
|
||
vec.X = float.Parse(words[0], culture); | ||
vec.Y = float.Parse(words[1], culture); | ||
//string[] sortOrder = new string[2]; | ||
|
||
return vec; | ||
} | ||
//sortOrder[0] = "X"; | ||
//sortOrder[1] = "Y"; | ||
|
||
return base.ConvertFrom(context, culture, value); | ||
//// Return a sorted list of properties | ||
//return properties.Sort(sortOrder); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.