添加项目文件。
This commit is contained in:
1 parent
05e131ca4e
commit
514d6f5255
1162 files changed
+81255
No files matched your search
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core
|
||||
{
|
||||
public class CS
|
||||
{
|
||||
public string Key { get; set; }
|
||||
public string Value { get; set; }
|
||||
public DBTypeEnum? DbType { get; set; }
|
||||
public string Version { get; set; }
|
||||
public string DbContext { get; set; }
|
||||
|
||||
public ConstructorInfo DcConstructor;
|
||||
private static List<ConstructorInfo> _cis;
|
||||
public static List<ConstructorInfo> Cis
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_cis == null)
|
||||
{
|
||||
var AllAssembly = Utils.GetAllAssembly();
|
||||
_cis = new List<ConstructorInfo>();
|
||||
if (AllAssembly != null)
|
||||
{
|
||||
foreach (var ass in AllAssembly)
|
||||
{
|
||||
try
|
||||
{
|
||||
var t = ass.GetExportedTypes().Where(x => typeof(DbContext).IsAssignableFrom(x) && x.Name != "DbContext" && x.Name != "FrameworkContext" && x.Name != "EmptyContext").ToList();
|
||||
foreach (var st in t)
|
||||
{
|
||||
var ci = st.GetConstructor(new Type[] { typeof(CS) });
|
||||
if (ci != null)
|
||||
{
|
||||
_cis.Add(ci);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
return _cis;
|
||||
}
|
||||
}
|
||||
|
||||
private static List<ConstructorInfo> _cisFull;
|
||||
public static List<ConstructorInfo> CisFull
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_cisFull == null)
|
||||
{
|
||||
var AllAssembly = Utils.GetAllAssembly();
|
||||
_cisFull = new List<ConstructorInfo>();
|
||||
if (AllAssembly != null)
|
||||
{
|
||||
foreach (var ass in AllAssembly)
|
||||
{
|
||||
try
|
||||
{
|
||||
var t = ass.GetExportedTypes().Where(x => typeof(DbContext).IsAssignableFrom(x) && x.Name != "DbContext" && x.Name != "FrameworkContext" && x.Name != "EmptyContext").ToList();
|
||||
foreach (var st in t)
|
||||
{
|
||||
var ci = st.GetConstructor(new Type[] { typeof(string), typeof(DBTypeEnum) });
|
||||
if (ci != null)
|
||||
{
|
||||
_cisFull.Add(ci);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
return _cisFull;
|
||||
}
|
||||
}
|
||||
|
||||
public IDataContext CreateDC()
|
||||
{
|
||||
if (DcConstructor == null)
|
||||
{
|
||||
string dcname = DbContext;
|
||||
if (string.IsNullOrEmpty(dcname))
|
||||
{
|
||||
dcname = "DataContext";
|
||||
}
|
||||
DcConstructor = Cis.Where(x => x.DeclaringType.Name.ToLower() == dcname.ToLower()).FirstOrDefault();
|
||||
if (DcConstructor == null)
|
||||
{
|
||||
DcConstructor = Cis.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
return (IDataContext)DcConstructor?.Invoke(new object[] { this });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,537 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using WalkingTec.Mvvm.Core.ConfigOptions;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Configs
|
||||
/// </summary>
|
||||
public class Configs
|
||||
{
|
||||
#region ConnectionStrings
|
||||
|
||||
private List<CS> _connectStrings;
|
||||
|
||||
/// <summary>
|
||||
/// ConnectionStrings
|
||||
/// </summary>
|
||||
public List<CS> Connections
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_connectStrings == null)
|
||||
{
|
||||
_connectStrings = new List<CS>();
|
||||
}
|
||||
return _connectStrings;
|
||||
}
|
||||
set
|
||||
{
|
||||
_connectStrings = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Domains
|
||||
|
||||
private Dictionary<string, Domain> _domains;
|
||||
|
||||
/// <summary>
|
||||
/// ConnectionStrings
|
||||
/// </summary>
|
||||
public Dictionary<string, Domain> Domains
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_domains == null)
|
||||
{
|
||||
_domains = new Dictionary<string, Domain>();
|
||||
}
|
||||
return _domains;
|
||||
}
|
||||
set
|
||||
{
|
||||
_domains = new Dictionary<string, Domain>();
|
||||
foreach (var domain in value)
|
||||
{
|
||||
_domains.Add(domain.Key.ToLower(), domain.Value);
|
||||
}
|
||||
foreach (var item in _domains)
|
||||
{
|
||||
if (item.Value != null)
|
||||
{
|
||||
item.Value.Name = item.Key;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool? _hasMainHost;
|
||||
public bool HasMainHost
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_hasMainHost == null)
|
||||
{
|
||||
_mainHost = Domains?.Where(x => x.Key.ToLower() == "mainhost").Select(x => x.Value.Address).FirstOrDefault();
|
||||
_hasMainHost = !string.IsNullOrEmpty(_mainHost);
|
||||
}
|
||||
return _hasMainHost == true;
|
||||
}
|
||||
}
|
||||
|
||||
private string _mainHost;
|
||||
public string MainHost
|
||||
{
|
||||
get
|
||||
{
|
||||
_mainHost = Domains?.Where(x => x.Key.ToLower() == "mainhost").Select(x => x.Value.Address).FirstOrDefault();
|
||||
if(_mainHost != null)
|
||||
{
|
||||
_mainHost = _mainHost.Trim();
|
||||
if(_mainHost.EndsWith('/') || _mainHost.EndsWith('\\'))
|
||||
{
|
||||
_mainHost = _mainHost[0..^1];
|
||||
}
|
||||
}
|
||||
return _mainHost;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region QuickDebug
|
||||
|
||||
private bool? _isQuickDebug;
|
||||
|
||||
/// <summary>
|
||||
/// Is debug mode
|
||||
/// </summary>
|
||||
public bool IsQuickDebug
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isQuickDebug ?? false;
|
||||
}
|
||||
set
|
||||
{
|
||||
_isQuickDebug = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Tenant
|
||||
|
||||
private bool? _enableTenant;
|
||||
|
||||
/// <summary>
|
||||
/// Is debug mode
|
||||
/// </summary>
|
||||
public bool EnableTenant
|
||||
{
|
||||
get
|
||||
{
|
||||
return _enableTenant ?? false;
|
||||
}
|
||||
set
|
||||
{
|
||||
_enableTenant = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public string ErrorHandler { get; set; } = "/_Framework/Error";
|
||||
|
||||
#region Cookie prefix
|
||||
|
||||
private string _cookiePre;
|
||||
|
||||
/// <summary>
|
||||
/// Cookie prefix
|
||||
/// </summary>
|
||||
public string CookiePre
|
||||
{
|
||||
get
|
||||
{
|
||||
return _cookiePre ?? string.Empty;
|
||||
}
|
||||
set
|
||||
{
|
||||
_cookiePre = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PageMode
|
||||
|
||||
private PageModeEnum? _pageMode;
|
||||
|
||||
/// <summary>
|
||||
/// PageMode
|
||||
/// </summary>
|
||||
public PageModeEnum PageMode
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_pageMode == null)
|
||||
{
|
||||
_pageMode = PageModeEnum.Single;
|
||||
}
|
||||
return _pageMode.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
_pageMode = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region TabMode
|
||||
|
||||
private TabModeEnum? _tabMode;
|
||||
|
||||
/// <summary>
|
||||
/// TabMode
|
||||
/// </summary>
|
||||
public TabModeEnum TabMode
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_tabMode == null)
|
||||
{
|
||||
_tabMode = TabModeEnum.Default;
|
||||
}
|
||||
return _tabMode.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
_tabMode = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region BlazorMode
|
||||
|
||||
private BlazorModeEnum? _blazorMode;
|
||||
|
||||
/// <summary>
|
||||
/// TabMode
|
||||
/// </summary>
|
||||
public BlazorModeEnum BlazorMode
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_blazorMode == null)
|
||||
{
|
||||
_blazorMode = BlazorModeEnum.Server;
|
||||
}
|
||||
return _blazorMode.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
_blazorMode = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Custom settings
|
||||
|
||||
private Dictionary<string, string> _appSettings;
|
||||
|
||||
/// <summary>
|
||||
/// Custom settings
|
||||
/// </summary>
|
||||
public Dictionary<string, string> AppSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_appSettings == null)
|
||||
{
|
||||
_appSettings = new Dictionary<string, string>();
|
||||
}
|
||||
return _appSettings;
|
||||
}
|
||||
set
|
||||
{
|
||||
_appSettings = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region FileOptions
|
||||
|
||||
private FileUploadOptions _fileUploadOptions;
|
||||
|
||||
/// <summary>
|
||||
/// FileOptions
|
||||
/// </summary>
|
||||
public FileUploadOptions FileUploadOptions
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_fileUploadOptions == null)
|
||||
{
|
||||
_fileUploadOptions = new FileUploadOptions()
|
||||
{
|
||||
UploadLimit = DefaultConfigConsts.DEFAULT_UPLOAD_LIMIT,
|
||||
SaveFileMode = "database",
|
||||
Settings = new Dictionary<string, List<FileHandlerOptions>>()
|
||||
};
|
||||
}
|
||||
return _fileUploadOptions;
|
||||
}
|
||||
set
|
||||
{
|
||||
_fileUploadOptions = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region UIOptions
|
||||
|
||||
private UIOptions _uiOptions;
|
||||
|
||||
/// <summary>
|
||||
/// UIOptions
|
||||
/// </summary>
|
||||
public UIOptions UIOptions
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_uiOptions == null)
|
||||
{
|
||||
_uiOptions = new UIOptions();
|
||||
if (_uiOptions.DataTable == null)
|
||||
_uiOptions.DataTable = new UIOptions.DataTableOptions
|
||||
{
|
||||
RPP = DefaultConfigConsts.DEFAULT_RPP
|
||||
};
|
||||
|
||||
if (_uiOptions.ComboBox == null)
|
||||
_uiOptions.ComboBox = new UIOptions.ComboBoxOptions
|
||||
{
|
||||
DefaultEnableSearch = DefaultConfigConsts.DEFAULT_COMBOBOX_DEFAULT_ENABLE_SEARCH
|
||||
};
|
||||
|
||||
if (_uiOptions.DateTime == null)
|
||||
_uiOptions.DateTime = new UIOptions.DateTimeOptions
|
||||
{
|
||||
DefaultReadonly = DefaultConfigConsts.DEFAULT_DATETIME_DEFAULT_READONLY
|
||||
};
|
||||
|
||||
if (_uiOptions.SearchPanel == null)
|
||||
_uiOptions.SearchPanel = new UIOptions.SearchPanelOptions
|
||||
{
|
||||
DefaultExpand = DefaultConfigConsts.DEFAULT_SEARCHPANEL_DEFAULT_EXPAND
|
||||
};
|
||||
}
|
||||
return _uiOptions;
|
||||
}
|
||||
set
|
||||
{
|
||||
_uiOptions = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Is FileAttachment public
|
||||
|
||||
private bool? _isFilePublic;
|
||||
|
||||
/// <summary>
|
||||
/// Is FileAttachment public
|
||||
/// </summary>
|
||||
public bool IsFilePublic
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isFilePublic ?? false;
|
||||
}
|
||||
set
|
||||
{
|
||||
_isFilePublic = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region UEditorOptions
|
||||
|
||||
private UEditorOptions _ueditorOptions;
|
||||
|
||||
/// <summary>
|
||||
/// UEditor配置
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public UEditorOptions UEditorOptions
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_ueditorOptions == null)
|
||||
{
|
||||
_ueditorOptions = new UEditorOptions();
|
||||
}
|
||||
return _ueditorOptions;
|
||||
}
|
||||
set
|
||||
{
|
||||
_ueditorOptions = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Cors configs
|
||||
|
||||
private Cors _cors;
|
||||
|
||||
/// <summary>
|
||||
/// Cors configs
|
||||
/// </summary>
|
||||
public Cors CorsOptions
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_cors == null)
|
||||
{
|
||||
_cors = new Cors();
|
||||
_cors.Policy = new List<CorsPolicy>();
|
||||
}
|
||||
return _cors;
|
||||
}
|
||||
set
|
||||
{
|
||||
_cors = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Support Languages
|
||||
|
||||
private string _languages;
|
||||
|
||||
/// <summary>
|
||||
/// Support Languages
|
||||
/// </summary>
|
||||
public string Languages
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty((_languages)))
|
||||
{
|
||||
_languages = "zh";
|
||||
}
|
||||
return _languages;
|
||||
}
|
||||
set
|
||||
{
|
||||
_languages = value;
|
||||
}
|
||||
}
|
||||
|
||||
private List<CultureInfo> _supportLanguages;
|
||||
public List<CultureInfo> SupportLanguages
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_supportLanguages == null)
|
||||
{
|
||||
_supportLanguages = new List<CultureInfo>();
|
||||
var lans = Languages.Split(",");
|
||||
foreach (var lan in lans)
|
||||
{
|
||||
_supportLanguages.Add(new CultureInfo(lan));
|
||||
}
|
||||
|
||||
}
|
||||
return _supportLanguages;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public string HostRoot { get; set; } = "";
|
||||
|
||||
|
||||
#region CookieOption configs
|
||||
|
||||
private CookieOption _cookieOption;
|
||||
|
||||
/// <summary>
|
||||
/// Cors configs
|
||||
/// </summary>
|
||||
public CookieOption CookieOptions
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_cookieOption == null)
|
||||
{
|
||||
_cookieOption = new CookieOption();
|
||||
}
|
||||
return _cookieOption;
|
||||
}
|
||||
set
|
||||
{
|
||||
_cookieOption = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region JwtOption configs
|
||||
|
||||
private JwtOption _jwtOption;
|
||||
|
||||
/// <summary>
|
||||
/// Cors configs
|
||||
/// </summary>
|
||||
public JwtOption JwtOptions
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_jwtOption == null)
|
||||
{
|
||||
_jwtOption = new JwtOption();
|
||||
}
|
||||
return _jwtOption;
|
||||
}
|
||||
set
|
||||
{
|
||||
_jwtOption = value;
|
||||
if (_jwtOption.SecurityKey.Length < 18)
|
||||
{
|
||||
var count = 18 - _jwtOption.SecurityKey.Length;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
_jwtOption.SecurityKey += "x";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public IDataContext CreateDC(string csName = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(csName))
|
||||
{
|
||||
csName = "default";
|
||||
}
|
||||
var cs = Connections.FirstOrDefault(x => x.Key.ToLower() == csName.ToLower());
|
||||
return cs?.CreateDC();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core
|
||||
{
|
||||
public class CookieOption
|
||||
{
|
||||
public string Issuer { get; set; } = "http://localhost";
|
||||
public string Audience { get; set; } = "http://localhost";
|
||||
public int Expires { get; set; } = 3600;
|
||||
public bool SlidingExpiration { get; set; } = true;
|
||||
public string LoginPath { get; set; } = "/Login/Login";
|
||||
public string LogoutPath { get; set; } = "/Login/Logout";
|
||||
public string AccessDeniedPath { get; set; } = "/Login/Login";
|
||||
public string Domain { get; set; } = "";
|
||||
public string ReturnUrlParameter { get; set; } = CookieAuthenticationDefaults.ReturnUrlParameter;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core
|
||||
{
|
||||
public class Cors
|
||||
{
|
||||
public bool EnableAll { get; set; }
|
||||
public List<CorsPolicy> Policy { get; set; }
|
||||
}
|
||||
|
||||
public class CorsPolicy
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Domain { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// DFS
|
||||
/// </summary>
|
||||
public class DFS
|
||||
{
|
||||
/// <summary>
|
||||
/// StorageMaxConnection
|
||||
/// </summary>
|
||||
public int? StorageMaxConnection { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// TrackerMaxConnection
|
||||
/// </summary>
|
||||
public int? TrackerMaxConnection { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ConnectionTimeout
|
||||
/// </summary>
|
||||
public int? ConnectionTimeout { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ConnectionLifeTime
|
||||
/// </summary>
|
||||
public int? ConnectionLifeTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Trackers
|
||||
/// </summary>
|
||||
public List<DFSTracker> Trackers { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace WalkingTec.Mvvm.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// DFSTracker
|
||||
/// </summary>
|
||||
public class DFSTracker
|
||||
{
|
||||
/// <summary>
|
||||
/// IP
|
||||
/// </summary>
|
||||
public string IP { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Port
|
||||
/// </summary>
|
||||
public int Port { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
namespace WalkingTec.Mvvm.Core.ConfigOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// DefaultConfigConsts
|
||||
/// </summary>
|
||||
public static class DefaultConfigConsts
|
||||
{
|
||||
/// <summary>
|
||||
/// 默认上传路径
|
||||
/// </summary>
|
||||
public const string DEFAULT_UPLOAD_DIR = ".\\upload";
|
||||
|
||||
/// <summary>
|
||||
/// 默认列表行数
|
||||
/// </summary>
|
||||
public const int DEFAULT_RPP = 20;
|
||||
|
||||
/// <summary>
|
||||
/// 默认上传文件限制
|
||||
/// </summary>
|
||||
public const int DEFAULT_UPLOAD_LIMIT = 20 * 1024 * 1024;
|
||||
|
||||
/// <summary>
|
||||
/// 默认允许ComboBox搜索
|
||||
/// </summary>
|
||||
public const bool DEFAULT_COMBOBOX_DEFAULT_ENABLE_SEARCH = true;
|
||||
|
||||
/// <summary>
|
||||
/// 默认开启DateTime只读
|
||||
/// </summary>
|
||||
public const bool DEFAULT_DATETIME_DEFAULT_READONLY = true;
|
||||
|
||||
/// <summary>
|
||||
/// 默认展开SearchPanel内容
|
||||
/// </summary>
|
||||
public const bool DEFAULT_SEARCHPANEL_DEFAULT_EXPAND = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core.ConfigOptions
|
||||
{
|
||||
public class Domain
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Address { get; set; }
|
||||
|
||||
public string InnerAddress { get; set; }
|
||||
|
||||
public string EntryUrl { get; set; }
|
||||
|
||||
public string Url
|
||||
{
|
||||
get
|
||||
{
|
||||
var rv = Address;
|
||||
if (string.IsNullOrEmpty(rv) == false && rv.ToLower().StartsWith("http://") == false && rv.ToLower().StartsWith("https://") == false)
|
||||
{
|
||||
rv = "http://" + rv;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
public string InnerUrl
|
||||
{
|
||||
get
|
||||
{
|
||||
var rv = InnerAddress;
|
||||
if (string.IsNullOrEmpty(rv) == false && rv.ToLower().StartsWith("http://") == false && rv.ToLower().StartsWith("https://") == false)
|
||||
{
|
||||
rv = "http://" + rv;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core.ConfigOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// FileOptions
|
||||
/// </summary>
|
||||
public class FileUploadOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件保存位置
|
||||
/// </summary>
|
||||
public string SaveFileMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上传文件限制 单位字节 默认 20 * 1024 * 1024 = 20971520 bytes
|
||||
/// </summary>
|
||||
public long UploadLimit { get; set; } = 20971520;
|
||||
|
||||
|
||||
public Dictionary<string, List<FileHandlerOptions>> Settings { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class FileHandlerOptions
|
||||
{
|
||||
public string GroupName { get; set; }
|
||||
public string GroupLocation { get; set; }
|
||||
public string ServerUrl { get; set; }
|
||||
|
||||
public string Key { get; set; }
|
||||
public string Secret { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System.Text;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core
|
||||
{
|
||||
public class JwtOption
|
||||
{
|
||||
public string Issuer { get; set; } = "http://localhost";
|
||||
public string Audience { get; set; } = "http://localhost";
|
||||
public int Expires { get; set; } = 3600;
|
||||
public string SecurityKey { get; set; } = "wtm";
|
||||
public string LoginPath { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace WalkingTec.Mvvm.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// KV
|
||||
/// </summary>
|
||||
public class KV
|
||||
{
|
||||
/// <summary>
|
||||
/// Key
|
||||
/// </summary>
|
||||
public string Key { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Value
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,386 @@
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace WalkingTec.Mvvm.Core.ConfigOptions
|
||||
{
|
||||
public class UEditorOptions
|
||||
{
|
||||
#region 上传图片配置项
|
||||
/// <summary>
|
||||
/// 执行上传图片的action名称
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("imageActionName")]
|
||||
public string ImageActionName { get; set; } = "UploadForLayUIUEditor";
|
||||
|
||||
/// <summary>
|
||||
/// 提交的图片表单名称
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("imageFieldName")]
|
||||
public string ImageFieldName { get; set; } = "FileID";
|
||||
|
||||
/// <summary>
|
||||
/// 上传大小限制,单位B
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("imageMaxSize")]
|
||||
public int ImageMaxSize { get; set; } = 2048000;
|
||||
|
||||
/// <summary>
|
||||
/// 上传图片格式显示
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("imageAllowFiles")]
|
||||
public string[] ImageAllowFiles { get; set; } = new string[] { ".png", ".jpg", ".jpeg", ".gif", ".bmp" };
|
||||
|
||||
/// <summary>
|
||||
/// 是否压缩图片,默认是true
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("imageCompressEnable")]
|
||||
public bool ImageCompressEnable { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 图片压缩最长边限制
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("imageCompressBorder")]
|
||||
public int ImageCompressBorder { get; set; } = 1600;
|
||||
|
||||
/// <summary>
|
||||
/// 插入的图片浮动方式
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("imageInsertAlign")]
|
||||
public string ImageInsertAlign { get; set; } = "none";
|
||||
|
||||
/// <summary>
|
||||
/// 图片访问路径前缀 默认返回全路径
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("imageUrlPrefix")]
|
||||
public string ImageUrlPrefix { get; set; } = string.Empty;
|
||||
|
||||
/* {filename} 会替换成原文件名,配置这项需要注意中文乱码问题 */
|
||||
/* {rand:6} 会替换成随机数,后面的数字是随机数的位数 */
|
||||
/* {time} 会替换成时间戳 */
|
||||
/* {yyyy} 会替换成四位年份 */
|
||||
/* {yy} 会替换成两位年份 */
|
||||
/* {mm} 会替换成两位月份 */
|
||||
/* {dd} 会替换成两位日期 */
|
||||
/* {hh} 会替换成两位小时 */
|
||||
/* {ii} 会替换成两位分钟 */
|
||||
/* {ss} 会替换成两位秒 */
|
||||
/* 非法字符 \ : * ? " < > | */
|
||||
/* 具请体看线上文档: fex.baidu.com/ueditor/#use-format_upload_filename */
|
||||
|
||||
/// <summary>
|
||||
/// 上传保存路径,可以自定义保存路径和文件名格式
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("imagePathFormat")]
|
||||
public string ImagePathFormat { get; set; } = "upload/image/{yyyy}{mm}{dd}/{time}{rand:6}";
|
||||
|
||||
#endregion
|
||||
|
||||
#region 涂鸦图片上传配置项
|
||||
|
||||
/// <summary>
|
||||
/// 执行上传涂鸦的action名称
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("scrawlActionName")]
|
||||
public string ScrawlActionName { get; set; } = "UploadForLayUIUEditor";
|
||||
|
||||
/// <summary>
|
||||
/// 提交的图片表单名称
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("scrawlFieldName")]
|
||||
public string ScrawlFieldName { get; set; } = "FileID";
|
||||
|
||||
/// <summary>
|
||||
/// 上传保存路径,可以自定义保存路径和文件名格式
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("scrawlPathFormat")]
|
||||
public string ScrawlPathFormat { get; set; } = "upload/image/{yyyy}{mm}{dd}/{time}{rand:6}";
|
||||
|
||||
/// <summary>
|
||||
/// 上传大小限制,单位B
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("scrawlMaxSize")]
|
||||
public int ScrawlMaxSize { get; set; } = 2048000;
|
||||
|
||||
/// <summary>
|
||||
/// 图片访问路径前缀
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("scrawlUrlPrefix")]
|
||||
public string ScrawlUrlPrefix { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 插入的图片浮动方式
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("scrawlInsertAlign")]
|
||||
public string ScrawlInsertAlign { get; set; } = "none";
|
||||
#endregion
|
||||
|
||||
#region 截图工具上传
|
||||
|
||||
/// <summary>
|
||||
/// 执行上传截图的action名称
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("snapscreenActionName")]
|
||||
public string SnapscreenActionName { get; set; } = "UploadForLayUIUEditor";
|
||||
|
||||
/// <summary>
|
||||
/// 上传保存路径,可以自定义保存路径和文件名格式
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("snapscreenPathFormat")]
|
||||
public string SnapscreenPathFormat { get; set; } = "upload/image/{yyyy}{mm}{dd}/{time}{rand:6}";
|
||||
|
||||
/// <summary>
|
||||
/// 图片访问路径前缀
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("snapscreenUrlPrefix")]
|
||||
public string SnapscreenUrlPrefix { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 插入的图片浮动方式
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("snapscreenInsertAlign")]
|
||||
public string SnapscreenInsertAlign { get; set; } = "none";
|
||||
#endregion
|
||||
|
||||
#region 抓取远程图片配置
|
||||
|
||||
[JsonPropertyName("catcherLocalDomain")]
|
||||
public string[] CatcherLocalDomain { get; set; } = new string[] { "127.0.0.1", "localhost", "img.baidu.com" };
|
||||
|
||||
/// <summary>
|
||||
/// 执行抓取远程图片的action名称
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("catcherActionName")]
|
||||
public string CatcherActionName { get; set; } = "catchimage";
|
||||
|
||||
/// <summary>
|
||||
/// 提交的图片列表表单名称
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("catcherFieldName")]
|
||||
public string CatcherFieldName { get; set; } = "source";
|
||||
|
||||
/// <summary>
|
||||
/// 上传保存路径,可以自定义保存路径和文件名格式
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("catcherPathFormat")]
|
||||
public string CatcherPathFormat { get; set; } = "upload/image/{yyyy}{mm}{dd}/{time}{rand:6}";
|
||||
|
||||
/// <summary>
|
||||
/// 图片访问路径前缀
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("catcherUrlPrefix")]
|
||||
public string CatcherUrlPrefix { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 上传大小限制,单位B
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("catcherMaxSize")]
|
||||
public int CatcherMaxSize { get; set; } = 2048000;
|
||||
|
||||
/// <summary>
|
||||
/// 抓取图片格式显示
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("catcherAllowFiles")]
|
||||
public string[] CatcherAllowFiles { get; set; } = new string[] { ".png", ".jpg", ".jpeg", ".gif", ".bmp" };
|
||||
#endregion
|
||||
|
||||
#region 上传视频配置
|
||||
|
||||
/// <summary>
|
||||
/// 执行上传视频的action名称
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("videoActionName")]
|
||||
public string VideoActionName { get; set; } = "UploadForLayUIUEditor";
|
||||
|
||||
/// <summary>
|
||||
/// 提交的视频表单名称
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("videoFieldName")]
|
||||
public string VideoFieldName { get; set; } = "FileID";
|
||||
|
||||
/// <summary>
|
||||
/// 上传保存路径,可以自定义保存路径和文件名格式
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("videoPathFormat")]
|
||||
public string VideoPathFormat { get; set; } = "upload/video/{yyyy}{mm}{dd}/{time}{rand:6}";
|
||||
|
||||
/// <summary>
|
||||
/// 视频访问路径前缀
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("videoUrlPrefix")]
|
||||
public string VideoUrlPrefix { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 上传大小限制,单位B,默认100MB
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("videoMaxSize")]
|
||||
public int VideoMaxSize { get; set; } = 102400000;
|
||||
|
||||
/// <summary>
|
||||
/// 上传视频格式显示
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("videoAllowFiles")]
|
||||
public string[] VideoAllowFiles { get; set; } = new string[] { ".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg", ".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid" };
|
||||
|
||||
#endregion
|
||||
|
||||
#region 上传文件配置
|
||||
|
||||
/// <summary>
|
||||
/// controller里,执行上传视频的action名称
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("fileActionName")]
|
||||
public string FileActionName { get; set; } = "UploadForLayUIUEditor";
|
||||
|
||||
/// <summary>
|
||||
/// 提交的文件表单名称
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("fileFieldName")]
|
||||
public string FileFieldName { get; set; } = "FileID";
|
||||
|
||||
/// <summary>
|
||||
/// 上传保存路径,可以自定义保存路径和文件名格式
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("filePathFormat")]
|
||||
public string FilePathFormat { get; set; } = "upload/file/{yyyy}{mm}{dd}/{time}{rand:6}";
|
||||
|
||||
/// <summary>
|
||||
/// 文件访问路径前缀
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("fileUrlPrefix")]
|
||||
public string FileUrlPrefix { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 上传大小限制,单位B,默认50MB
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("fileMaxSize")]
|
||||
public int FileMaxSize { get; set; } = 51200000;
|
||||
|
||||
/// <summary>
|
||||
/// 上传文件格式显示
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("fileAllowFiles")]
|
||||
public string[] FileAllowFiles { get; set; } = new string[] { ".png", ".jpg", ".jpeg", ".gif", ".bmp", ".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg", ".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid", ".rar", ".zip", ".tar", ".gz", ".7z", ".bz2", ".cab", ".iso", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".txt", ".md", ".xml" };
|
||||
|
||||
#endregion
|
||||
|
||||
#region 列出指定目录下的图片
|
||||
|
||||
/// <summary>
|
||||
/// 执行图片管理的action名称
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("imageManagerActionName")]
|
||||
public string ImageManagerActionName { get; set; } = "listimage";
|
||||
|
||||
/// <summary>
|
||||
/// 指定要列出图片的目录
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("imageManagerListPath")]
|
||||
public string ImageManagerListPath { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 每次列出文件数量
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("imageManagerListSize")]
|
||||
public int ImageManagerListSize { get; set; } = 20;
|
||||
|
||||
/// <summary>
|
||||
/// 图片访问路径前缀
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("imageManagerUrlPrefix")]
|
||||
public string ImageManagerUrlPrefix { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 插入的图片浮动方式
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("imageManagerInsertAlign")]
|
||||
public string ImageManagerInsertAlign { get; set; } = "none";
|
||||
|
||||
/// <summary>
|
||||
/// 列出的文件类型
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("imageManagerAllowFiles")]
|
||||
public string[] ImageManagerAllowFiles { get; set; } = new string[] { ".png", ".jpg", ".jpeg", ".gif", ".bmp" };
|
||||
#endregion
|
||||
|
||||
#region 列出指定目录下的文件
|
||||
|
||||
/// <summary>
|
||||
/// 执行文件管理的action名称
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("fileManagerActionName")]
|
||||
public string FileManagerActionName { get; set; } = "listfile";
|
||||
|
||||
/// <summary>
|
||||
/// 指定要列出文件的目录
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("fileManagerListPath")]
|
||||
public string FileManagerListPath { get; set; } = "upload/file";
|
||||
|
||||
/// <summary>
|
||||
/// 文件访问路径前缀
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("fileManagerUrlPrefix")]
|
||||
public string FileManagerUrlPrefix { get; set; } = "/ueditor/net/";
|
||||
|
||||
/// <summary>
|
||||
/// 每次列出文件数量
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("fileManagerListSize")]
|
||||
public int FileManagerListSize { get; set; } = 20;
|
||||
|
||||
/// <summary>
|
||||
/// 列出的文件类型
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonPropertyName("fileManagerAllowFiles")]
|
||||
public string[] FileManagerAllowFiles { get; set; } = new string[] { ".png", ".jpg", ".jpeg", ".gif", ".bmp", ".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg", ".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid", ".rar", ".zip", ".tar", ".gz", ".7z", ".bz2", ".cab", ".iso", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".txt", ".md", ".xml" };
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
namespace WalkingTec.Mvvm.Core.ConfigOptions
|
||||
{
|
||||
public class UIOptions
|
||||
{
|
||||
public DataTableOptions DataTable { get; set; }
|
||||
public ComboBoxOptions ComboBox { get; set; }
|
||||
public DateTimeOptions DateTime { get; set; }
|
||||
public SearchPanelOptions SearchPanel { get; set; }
|
||||
|
||||
public class DataTableOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// 默认列表行数
|
||||
/// </summary>
|
||||
public int RPP { get; set; }
|
||||
|
||||
public bool ShowPrint { get; set; }
|
||||
|
||||
public bool ShowFilter { get; set; }
|
||||
}
|
||||
|
||||
public class ComboBoxOptions
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 默认允许ComboBox搜索
|
||||
/// </summary>
|
||||
public bool DefaultEnableSearch { get; set; }
|
||||
}
|
||||
|
||||
public class DateTimeOptions
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 默认开启DateTime只读
|
||||
/// </summary>
|
||||
public bool DefaultReadonly { get; set; }
|
||||
}
|
||||
|
||||
public class SearchPanelOptions
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 默认展开SearchPanel内容
|
||||
/// </summary>
|
||||
public bool DefaultExpand { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user