Browse Source

Rename UNITY_METRO to UNITY_WSA

pull/348/merge
Canming Huang 5 years ago
parent
commit
359143bf30
  1. 2
      Emgu.CV.Contrib/XFeatures2D/CudaSURF.cs
  2. 4
      Emgu.CV.Unity/Assets/Emgu.CV/Demo/FaceDetection.cs
  3. 2
      Emgu.CV/Color/Bgr.cs
  4. 4
      Emgu.CV/Color/DisplayColorAttribute.cs
  5. 2
      Emgu.CV/Color/Rgb.cs
  6. 2
      Emgu.CV/Color/Rgb565.cs
  7. 2
      Emgu.CV/Core/Map.cs
  8. 80
      Emgu.CV/PInvoke/CvInvoke.cs
  9. 7
      Emgu.CV/Reflection/ReflectColorType.cs
  10. 5
      Emgu.Util/Toolbox.cs

2
Emgu.CV.Contrib/XFeatures2D/CudaSURF.cs

@ -1,4 +1,4 @@
#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN || UNITY_METRO || UNITY_EDITOR_WIN || NETFX_CORE)
#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN || NETFX_CORE)
//----------------------------------------------------------------------------
// Copyright (C) 2004-2020 by EMGU Corporation. All rights reserved.
//----------------------------------------------------------------------------

4
Emgu.CV.Unity/Assets/Emgu.CV/Demo/FaceDetection.cs

@ -36,10 +36,10 @@ public class FaceDetection : MonoBehaviour
{
TextAsset cascadeModel = Resources.Load<TextAsset>(fileName);
#if UNITY_METRO
#if UNITY_WSA
UnityEngine.Windows.File.WriteAllBytes(filePath, cascadeModel.bytes);
#else
File.WriteAllBytes(filePath, cascadeModel.bytes);
File.WriteAllBytes(filePath, cascadeModel.bytes);
#endif
}

2
Emgu.CV/Color/Bgr.cs

@ -27,7 +27,7 @@ namespace Emgu.CV.Structure
_scalar = new MCvScalar(blue, green, red);
}
#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE || UNITY_METRO || UNITY_EDITOR
#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE || UNITY_WSA || UNITY_EDITOR
/// <summary>
/// Create a Bgr color using the System.Drawing.Color
/// </summary>

4
Emgu.CV/Color/DisplayColorAttribute.cs

@ -4,7 +4,7 @@
using System;
#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_STANDALONE || UNITY_METRO || UNITY_EDITOR
#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_STANDALONE || UNITY_WSA || UNITY_EDITOR
using Color = UnityEngine.Color;
#else
using Color = System.Drawing.Color;
@ -23,7 +23,7 @@ namespace Emgu.CV
/// <param name="red">red</param>
public DisplayColorAttribute(int blue, int green, int red)
{
#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_STANDALONE || UNITY_METRO || UNITY_EDITOR
#if UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL || UNITY_STANDALONE || UNITY_WSA || UNITY_EDITOR
_displayColor = new Color(red/255.0f, green/255.0f, blue/255.0f, 1.0f);
#else
_displayColor = Color.FromArgb(red, green, blue);

2
Emgu.CV/Color/Rgb.cs

@ -27,7 +27,7 @@ namespace Emgu.CV.Structure
_scalar = new MCvScalar(red, green, blue);
}
#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE || UNITY_METRO || UNITY_EDITOR
#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE || UNITY_WSA || UNITY_EDITOR
/// <summary>
/// Create a Rgb color using the system color
/// </summary>

2
Emgu.CV/Color/Rgb565.cs

@ -30,7 +30,7 @@ namespace Emgu.CV.Structure
//TODO: implement this
}
#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE || UNITY_METRO || UNITY_EDITOR
#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE || UNITY_WSA || UNITY_EDITOR
/// <summary>
/// Create a Bgr565 color using the System.Drawing.Color
/// </summary>

2
Emgu.CV/Core/Map.cs

@ -191,7 +191,7 @@ namespace Emgu.CV
}
}
#if !(UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE || UNITY_METRO)
#if !(UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE || UNITY_WSA)
/// <summary>
/// Draw a rectangle in the map
/// </summary>

80
Emgu.CV/PInvoke/CvInvoke.cs

@ -58,70 +58,19 @@ namespace Emgu.CV
/// <remarks>If <paramref name="loadDirectory"/> is null, the default location on windows is the dll's path appended by either "x64" or "x86", depends on the applications current mode.</remarks>
public static bool LoadUnmanagedModules(String loadDirectory, params String[] unmanagedModules)
{
#if NETFX_CORE
if (loadDirectory != null)
{
throw new NotImplementedException("Loading modules from a specific directory is not implemented in Windows Store App");
}
String subfolder = String.Empty;
if (Emgu.Util.Platform.OperationSystem == Emgu.Util.TypeEnum.OS.Windows) //|| Platform.OperationSystem == Emgu.Util.TypeEnum.OS.WindowsPhone)
{
if (IntPtr.Size == 8)
{ //64bit process
#if UNITY_METRO
subfolder = "x86_64";
#else
subfolder = String.Empty;
#endif
}
else
#if UNITY_WSA
if (loadDirectory != null)
{
subfolder = String.Empty;
throw new NotImplementedException("Loading modules from a specific directory is not implemented in Windows Store App");
}
}
Windows.Storage.StorageFolder installFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
#if UNITY_METRO
loadDirectory = Path.Combine(
Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName( installFolder.Path))))
, "Plugins", "Metro", subfolder);
#else
loadDirectory = Path.Combine(installFolder.Path, subfolder);
#endif
var t = System.Threading.Tasks.Task.Run(async () =>
{
List<string> files = new List<string>();
Windows.Storage.StorageFolder loadFolder = installFolder;
try
{
if (!String.IsNullOrEmpty(subfolder))
loadFolder = await installFolder.GetFolderAsync(subfolder);
foreach (var file in await loadFolder.GetFilesAsync())
files.Add(file.Name);
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(String.Format("Unable to retrieve files in folder '{0}':{1}", loadFolder.Path, e.StackTrace));
}
return files;
});
t.Wait();
List<String> loadableFiles = t.Result;
//Let unity handle the library loading
return true;
#else
String oldDir = String.Empty;
if (loadDirectory == null)
{
String subfolder = String.Empty;
#if UNITY_EDITOR_WIN
subfolder = IntPtr.Size == 8 ? "x86_64" : "x86";
#elif UNITY_STANDALONE_WIN
#else
if (Platform.OperationSystem == Emgu.Util.Platform.OS.Windows
|| Platform.OperationSystem == Emgu.Util.Platform.OS.Linux)
{
@ -137,7 +86,6 @@ namespace Emgu.CV
//subfolder = IntPtr.Size == 8 ? "x64" : "x86";
}
#endif
System.Reflection.Assembly asm = typeof(CvInvoke).Assembly; //System.Reflection.Assembly.GetExecutingAssembly();
if ((String.IsNullOrEmpty(asm.Location) || !File.Exists(asm.Location)))
@ -320,8 +268,6 @@ namespace Emgu.CV
#endif
}
String oldDir = String.Empty;
bool addDllDirectorySuccess = false;
if (!String.IsNullOrEmpty(loadDirectory) && Directory.Exists(loadDirectory))
{
@ -363,7 +309,7 @@ namespace Emgu.CV
"Loading Open CV binary for default locations. Current directory: {0}",
Environment.CurrentDirectory));
}
#endif
bool success = true;
string prefix = string.Empty;
@ -382,10 +328,10 @@ namespace Emgu.CV
bool optionalComponent = mName.Contains("ffmpeg");
String fullPath = Path.Combine(prefix, mName);
String moduleName = Path.Combine(prefix, mName);
//Use absolute path for Windows Desktop
fullPath = Path.Combine(loadDirectory, fullPath);
String fullPath = Path.Combine(loadDirectory, moduleName);
bool fileExist = File.Exists(fullPath);
bool loaded = false;
@ -423,6 +369,7 @@ namespace Emgu.CV
}
return success;
#endif
}
/// <summary>
@ -508,7 +455,8 @@ namespace Emgu.CV
return libraryLoaded;
}
}
} else if (Emgu.Util.Platform.OperationSystem != Emgu.Util.Platform.OS.MacOS)
}
else if (Emgu.Util.Platform.OperationSystem != Emgu.Util.Platform.OS.MacOS)
{
String formatString = GetModuleFormatString();
for (int i = 0; i < modules.Length; ++i)
@ -562,7 +510,7 @@ namespace Emgu.CV
}
catch (Exception e)
{
System.Diagnostics.Trace.WriteLine(String.Format("Failed to register error handler using RedirectError : {0}", e.StackTrace));
System.Diagnostics.Trace.WriteLine(String.Format("Failed to register error handler using RedirectError : {0}", e.StackTrace));
throw;
}
}

7
Emgu.CV/Reflection/ReflectColorType.cs

@ -5,7 +5,7 @@
using System;
using System.Collections.Generic;
#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE || UNITY_METRO || UNITY_EDITOR || UNITY_WEBGL
#if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE || UNITY_WSA || UNITY_EDITOR || UNITY_WEBGL
using UnityEngine;
#elif NETFX_CORE
using Windows.UI;
@ -40,9 +40,8 @@ namespace Emgu.CV.Reflection
//create default color
Color[] res = new Color[color.Dimension];
for (int i = 0; i < res.Length; i++)
//res[i] = Color.FromArgb(255, 125, 125, 125);
#if ( UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE || UNITY_METRO || UNITY_WEBGL)
res[i] = Color.gray;
#if (UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE || UNITY_WSA || UNITY_WEBGL)
res[i] = Color.gray;
#else
res[i] = Color.Gray;
#endif

5
Emgu.Util/Toolbox.cs

@ -4,9 +4,7 @@
using System;
using System.Text;
using System.Xml;
#if !(UNITY_ANDROID || UNITY_IPHONE || UNITY_STANDALONE || UNITY_METRO || UNITY_EDITOR)
using System.Xml.Linq;
#endif
using System.Xml.Serialization;
using System.IO;
using System.Runtime.InteropServices;
@ -22,7 +20,6 @@ namespace Emgu.Util
/// </summary>
public static class Toolbox
{
#if !(UNITY_ANDROID || UNITY_IPHONE || UNITY_STANDALONE || UNITY_METRO || UNITY_EDITOR )
#region xml serilization and deserialization
/// <summary>
/// Convert an object to an xml document
@ -108,7 +105,7 @@ namespace Emgu.Util
return (T)(new XmlSerializer(typeof(T))).Deserialize(stringReader);
}
#endregion
#endif
/// <summary>
/// Similar to Marshal.SizeOf function

Loading…
Cancel
Save