Skip to content

Commit 9183d98

Browse files
authored
Merge pull request #106 from Mzying2001/CEF84
Cef84
2 parents c7f4320 + 07d6d9f commit 9183d98

File tree

4 files changed

+22
-17
lines changed

4 files changed

+22
-17
lines changed

CefFlashBrowser/Utils/SolHelper.cs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace CefFlashBrowser.Utils
77
{
88
public static class SolHelper
99
{
10-
private static Dictionary<Type, string> TypeStringDic { get; } = new Dictionary<Type, string>
10+
private static readonly Dictionary<Type, string> _typeStringDic = new Dictionary<Type, string>
1111
{
1212
[typeof(int)] = "int",
1313
[typeof(double)] = "double",
@@ -89,7 +89,7 @@ public static string GetTypeString(Type type)
8989
if (type == null)
9090
return "null";
9191

92-
if (TypeStringDic.TryGetValue(type, out var typeStr))
92+
if (_typeStringDic.TryGetValue(type, out var typeStr))
9393
return typeStr;
9494

9595
return string.Empty;
@@ -102,18 +102,21 @@ public static string GetTypeString(object value)
102102

103103
public static IEnumerable<SolTypeDesc> GetSupportedTypes()
104104
{
105-
yield return new SolTypeDesc(typeof(int));
106-
yield return new SolTypeDesc(typeof(double));
107-
yield return new SolTypeDesc(typeof(bool));
108-
yield return new SolTypeDesc(typeof(string));
109-
yield return new SolTypeDesc(typeof(DateTime));
110-
yield return new SolTypeDesc(typeof(SolArray));
111-
yield return new SolTypeDesc(typeof(SolObject));
112-
yield return new SolTypeDesc(typeof(byte[]));
113-
yield return new SolTypeDesc(typeof(SolXml));
114-
yield return new SolTypeDesc(typeof(SolXmlDoc));
115-
yield return new SolTypeDesc(typeof(SolUndefined));
116-
yield return new SolTypeDesc(null);
105+
return new[]
106+
{
107+
new SolTypeDesc(typeof(int)),
108+
new SolTypeDesc(typeof(double)),
109+
new SolTypeDesc(typeof(bool)),
110+
new SolTypeDesc(typeof(string)),
111+
new SolTypeDesc(typeof(DateTime)),
112+
new SolTypeDesc(typeof(SolArray)),
113+
new SolTypeDesc(typeof(SolObject)),
114+
new SolTypeDesc(typeof(byte[])),
115+
new SolTypeDesc(typeof(SolXml)),
116+
new SolTypeDesc(typeof(SolXmlDoc)),
117+
new SolTypeDesc(typeof(SolUndefined)),
118+
new SolTypeDesc(null)
119+
};
117120
}
118121

119122
public static object GetDefaultValueOfType(Type type)

CefFlashBrowser/ViewModels/BrowserWindowViewModel.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using SimpleMvvm.Command;
66
using System;
77
using System.Diagnostics;
8+
using System.IO;
89

910
namespace CefFlashBrowser.ViewModels
1011
{
@@ -57,8 +58,11 @@ private static string GetWebBrowserTitle(IWebBrowser browser)
5758
public void CreateShortcut(IWebBrowser browser)
5859
{
5960
var title = GetWebBrowserTitle(browser);
60-
foreach (var item in "\\/:*?\"<>|.")
61+
62+
foreach (var item in Path.GetInvalidFileNameChars())
63+
{
6164
title = title.Replace(item, '_');
65+
}
6266

6367
var sfd = new Microsoft.Win32.SaveFileDialog()
6468
{

CefFlashBrowser/ViewModels/MainWindowViewModel.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using CefFlashBrowser.Models;
22
using CefFlashBrowser.Models.Data;
3-
using CefFlashBrowser.Sol;
43
using CefFlashBrowser.Utils;
54
using SimpleMvvm;
65
using SimpleMvvm.Command;

CefFlashBrowser/ViewModels/SolSaveManagerViewModel.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using CefFlashBrowser.Models;
22
using CefFlashBrowser.Models.Data;
3-
using CefFlashBrowser.Sol;
43
using CefFlashBrowser.Utils;
54
using SimpleMvvm;
65
using SimpleMvvm.Command;

0 commit comments

Comments
 (0)