中文问题编码

This commit is contained in:
yaofeng
2018-07-14 13:50:45 +08:00
parent e7a9ee07e0
commit fcbefa62ca
4 changed files with 20 additions and 6 deletions

View File

@@ -3,7 +3,9 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Web;
namespace ElectronNET.API
{
@@ -54,7 +56,12 @@ namespace ElectronNET.API
BridgeConnector.Socket.Off("showOpenDialogComplete" + guid);
var result = ((JArray)filePaths).ToObject<string[]>();
taskCompletionSource.SetResult(result);
var list = new List<string>();
foreach (var item in result)
{
list.Add(HttpUtility.UrlDecode(item));
}
taskCompletionSource.SetResult(list.ToArray());
});

View File

@@ -16,7 +16,7 @@ This package contains the API to access the "native" electron API.</Description>
<PackageTags>electron aspnetcore</PackageTags>
<PackageReleaseNotes>Changelog: https://github.com/ElectronNET/Electron.NET/blob/master/Changelog.md</PackageReleaseNotes>
<PackageIconUrl>https://raw.githubusercontent.com/ElectronNET/Electron.NET/master/assets/images/electron.net-logo-square.png</PackageIconUrl>
<Version>1.0.1</Version>
<Version>1.0.0.2</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@@ -32,8 +32,9 @@ This package contains the API to access the "native" electron API.</Description>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="EngineIoClientDotNet" Version="1.0.7.2" />
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.0.0" />
<PackageReference Include="SocketIoClientDotNet" Version="1.0.3" />
<PackageReference Include="SocketIoClientDotNet" Version="1.0.7.2" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(OS)' == 'Windows_NT'">

View File

@@ -9,7 +9,7 @@
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageOutputPath>..\artifacts</PackageOutputPath>
<PackageId>ElectronNET.CLI</PackageId>
<Version>1.0.4</Version>
<Version>1.0.4.1</Version>
<Authors>Gregor Biswanger, Robert Muehsig</Authors>
<Product>Electron.NET</Product>
<Company />

View File

@@ -20,13 +20,19 @@ module.exports = function (socket) {
socket.on('showOpenDialog', function (browserWindow, options, guid) {
var window = electron_1.BrowserWindow.fromId(browserWindow.id);
electron_1.dialog.showOpenDialog(window, options, function (filePaths) {
global.elesocket.emit('showOpenDialogComplete' + guid, filePaths || []);
filePaths = filePaths || [];
var encodeFilePaths = [];
filePaths.forEach((item, index) => {
encodeFilePaths.push(encodeURIComponent(item));
});
global.elesocket.emit('showOpenDialogComplete' + guid, encodeFilePaths);
});
});
socket.on('showSaveDialog', function (browserWindow, options, guid) {
var window = electron_1.BrowserWindow.fromId(browserWindow.id);
electron_1.dialog.showSaveDialog(window, options, function (filename) {
global.elesocket.emit('showSaveDialogComplete' + guid, filename || '');
filename = encodeURIComponent(filename || '');
global.elesocket.emit('showSaveDialogComplete' + guid, filename);
});
});
socket.on('showErrorBox', function (title, content) {