Commit 17a85d99 authored by justcoding121's avatar justcoding121

macOS fixes

parent b0569809
...@@ -11,28 +11,6 @@ ...@@ -11,28 +11,6 @@
"stopAtEntry": false, "stopAtEntry": false,
"console": "integratedTerminal", "console": "integratedTerminal",
"preLaunchTask": "build-basic-example-netcore" "preLaunchTask": "build-basic-example-netcore"
},
{
"name": "Windows|Net45|Debug|Basic Example",
"type": "clr",
"request": "launch",
"program": "${workspaceRoot}/examples/Titanium.Web.Proxy.Examples.Basic/bin/Debug/net45/Titanium.Web.Proxy.Examples.Basic.exe",
"args": [],
"cwd": "${workspaceRoot}",
"stopAtEntry": false,
"console": "integratedTerminal",
"preLaunchTask": "build-basic-example-net45"
},
{
"name": "Windows|Net45|Debug|Wpf Example",
"type": "clr",
"request": "launch",
"program": "${workspaceRoot}/examples/Titanium.Web.Proxy.Examples.Wpf/bin/x64/Debug/Titanium.Web.Proxy.Examples.Wpf.exe",
"args": [],
"cwd": "${workspaceRoot}",
"stopAtEntry": false,
"console": "internalConsole",
"preLaunchTask": "build-wpf-example"
} }
] ]
} }
\ No newline at end of file
...@@ -9,11 +9,12 @@ ...@@ -9,11 +9,12 @@
"**/bin": true, "**/bin": true,
"**/obj": true, "**/obj": true,
"**/*.DotSettings": true, "**/*.DotSettings": true,
"**/*.sln": true "**/*.sln": true,
"**/tests/" : true,
"**/Titanium.Web.Proxy.Examples.Wpf/" : true,
"**/*.Basic.csproj/": true
}, },
"search.exclude": { "search.exclude": {
// The following will hide the js and map files in the editor
"files.exclude": {
"**/.build": true, "**/.build": true,
"**/.nuget": true, "**/.nuget": true,
"**/.vs": true, "**/.vs": true,
...@@ -22,7 +23,9 @@ ...@@ -22,7 +23,9 @@
"**/bin": true, "**/bin": true,
"**/obj": true, "**/obj": true,
"**/*.DotSettings": true, "**/*.DotSettings": true,
"**/*.sln": true "**/*.sln": true,
} "**/tests/" : true,
"**/Titanium.Web.Proxy.Examples.Wpf/" : true,
"**/*.Basic.csproj/": true
} }
} }
\ No newline at end of file
...@@ -5,36 +5,12 @@ ...@@ -5,36 +5,12 @@
"label": "build-basic-example-netcore", "label": "build-basic-example-netcore",
"type": "process", "type": "process",
"command": "dotnet", "command": "dotnet",
"args": ["build","${workspaceFolder}/examples/Titanium.Web.Proxy.Examples.Basic/Titanium.Web.Proxy.Examples.Basic.csproj"], "args": ["build","${workspaceFolder}/examples/Titanium.Web.Proxy.Examples.Basic/Titanium.Web.Proxy.Examples.Basic.NetCore.csproj"],
"problemMatcher": "$msCompile", "problemMatcher": "$msCompile",
"group": { "group": {
"kind": "build", "kind": "build",
"isDefault": true "isDefault": true
} }
},
{
"label": "build-basic-example-net45",
"type": "process",
"windows": {
"command": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\Bin\\MSBuild.exe",
"args": ["${workspaceFolder}/examples/Titanium.Web.Proxy.Examples.Basic/Titanium.Web.Proxy.Examples.Basic.csproj", "/p:Platform=Any CPU"]
},
"osx": {
"command": "dotnet",
"args": ["${workspaceFolder}/src/Titanium.Web.Proxy.DotNet.sln"]
},
"linux": {
"command": "dotnet",
"args": ["${workspaceFolder}/src/Titanium.Web.Proxy.DotNet.sln"]
},
"problemMatcher": "$msCompile"
},
{
"label": "build-wpf-example",
"type": "process",
"command": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\Bin\\MSBuild.exe",
"args": ["${workspaceFolder}/examples/Titanium.Web.Proxy.Examples.Wpf/Titanium.Web.Proxy.Examples.Wpf.csproj", "/p:Platform=x64"],
"problemMatcher": "$msCompile"
} }
] ]
} }
\ No newline at end of file
using System; using System;
using System.Runtime.InteropServices;
using Titanium.Web.Proxy.Examples.Basic.Helpers; using Titanium.Web.Proxy.Examples.Basic.Helpers;
namespace Titanium.Web.Proxy.Examples.Basic namespace Titanium.Web.Proxy.Examples.Basic
...@@ -9,8 +10,11 @@ namespace Titanium.Web.Proxy.Examples.Basic ...@@ -9,8 +10,11 @@ namespace Titanium.Web.Proxy.Examples.Basic
public static void Main(string[] args) public static void Main(string[] args)
{ {
// fix console hang due to QuickEdit mode if(RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
ConsoleHelper.DisableQuickEditMode(); {
// fix console hang due to QuickEdit mode
ConsoleHelper.DisableQuickEditMode();
}
// Start proxy controller // Start proxy controller
controller.StartProxy(); controller.StartProxy();
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp2.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<LangVersion>7.1</LangVersion>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Titanium.Web.Proxy\Titanium.Web.Proxy.csproj" />
</ItemGroup>
</Project>
\ No newline at end of file
{ {
"fileOptions": { "fileOptions": {
"excludeSearchPatterns": [ "excludeSearchPatterns": [
"**/*.Docs.csproj" "**/*.Docs.csproj",
"**/tests/",
"**/Titanium.Web.Proxy.Examples.Wpf/",
"**/*.Basic.csproj/"
] ]
} }
} }
\ No newline at end of file
using System; using System;
#if NETSTANDARD2_0
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
#endif
namespace Titanium.Web.Proxy.Helpers namespace Titanium.Web.Proxy.Helpers
{ {
/// <summary> /// <summary>
...@@ -16,33 +14,24 @@ namespace Titanium.Web.Proxy.Helpers ...@@ -16,33 +14,24 @@ namespace Titanium.Web.Proxy.Helpers
/// <returns></returns> /// <returns></returns>
private static readonly Lazy<bool> isRunningOnMono = new Lazy<bool>(() => Type.GetType("Mono.Runtime") != null); private static readonly Lazy<bool> isRunningOnMono = new Lazy<bool>(() => Type.GetType("Mono.Runtime") != null);
#if NETSTANDARD2_0 /// <summary>
/// <summary> /// cache for Windows platform check
/// cache for Windows platform check /// </summary>
/// </summary> /// <returns></returns>
/// <returns></returns> private static bool isRunningOnWindows => RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
private static readonly Lazy<bool> isRunningOnWindows private static bool isRunningOnLinux => RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
= new Lazy<bool>(() => RuntimeInformation.IsOSPlatform(OSPlatform.Windows)); private static bool isRunningOnMac => RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
private static readonly Lazy<bool> isRunningOnLinux
= new Lazy<bool>(() => RuntimeInformation.IsOSPlatform(OSPlatform.Linux));
#endif
/// <summary> /// <summary>
/// Is running on Mono? /// Is running on Mono?
/// </summary> /// </summary>
internal static bool IsRunningOnMono => isRunningOnMono.Value; internal static bool IsRunningOnMono => isRunningOnMono.Value;
#if NETSTANDARD2_0 internal static bool IsLinux => isRunningOnLinux;
internal static bool IsLinux => isRunningOnLinux.Value;
#else internal static bool IsWindows => isRunningOnWindows;
internal static bool IsLinux => !IsWindows;
#endif internal static bool IsMac => isRunningOnMac;
#if NETSTANDARD2_0
internal static bool IsWindows => isRunningOnWindows.Value;
#else
internal static bool IsWindows => true;
#endif
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment