|
|
|
@ -7,6 +7,7 @@ using Newtonsoft.Json; |
|
|
|
|
using Newtonsoft.Json.Linq; |
|
|
|
|
using SparkClient.Model.Entity; |
|
|
|
|
using SparkClient.Model.Helper; |
|
|
|
|
using SparkClient.ViewModel.Configuration.SettingsPages; |
|
|
|
|
|
|
|
|
|
namespace SparkClient.ViewModel.Configuration; |
|
|
|
|
|
|
|
|
@ -16,6 +17,8 @@ public class AlgorithmConfigVM : BaseViewModel |
|
|
|
|
public ICommand BeautifyJsonCommand { get; } |
|
|
|
|
public ICommand UglifyJsonCommand { get; } |
|
|
|
|
|
|
|
|
|
private bool _isEnabled; |
|
|
|
|
public bool IsEnabled { get { return _isEnabled; } set { _isEnabled = value; OnPropertyChanged(nameof(IsEnabled)); } } |
|
|
|
|
|
|
|
|
|
private string _AlgorithmConfigJson; |
|
|
|
|
public string AlgorithmConfigJson { get { return _AlgorithmConfigJson; } set { _AlgorithmConfigJson = value; OnPropertyChanged("AlgorithmConfigJson"); } } |
|
|
|
@ -44,7 +47,7 @@ public class AlgorithmConfigVM : BaseViewModel |
|
|
|
|
sb.Append(row["json"].ToString()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(sb.Length>0) |
|
|
|
|
if (sb.Length > 0) |
|
|
|
|
{ |
|
|
|
|
AlgorithmConfigJson = JToken.Parse(sb.ToString()).ToString(); |
|
|
|
|
} |
|
|
|
@ -63,7 +66,7 @@ public class AlgorithmConfigVM : BaseViewModel |
|
|
|
|
DataBaseHelper.ExecuteNonQuery(deleteSql); |
|
|
|
|
int order = 0; |
|
|
|
|
int insertCount = 0; |
|
|
|
|
while (temp.Length>2000) |
|
|
|
|
while (temp.Length > 2000) |
|
|
|
|
{ |
|
|
|
|
AlgorithmConfigEntity entity = new AlgorithmConfigEntity() |
|
|
|
|
{ |
|
|
|
@ -80,7 +83,7 @@ public class AlgorithmConfigVM : BaseViewModel |
|
|
|
|
}; |
|
|
|
|
insertCount += DataBaseHelper.ExecuteNonQuery(sql, sqliteParameters); |
|
|
|
|
} |
|
|
|
|
if (temp.Length>0) |
|
|
|
|
if (temp.Length > 0) |
|
|
|
|
{ |
|
|
|
|
AlgorithmConfigEntity entity = new AlgorithmConfigEntity() |
|
|
|
|
{ |
|
|
|
@ -107,7 +110,17 @@ public class AlgorithmConfigVM : BaseViewModel |
|
|
|
|
DataBaseHelper.rollback(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void IsEnabledByRole (){ |
|
|
|
|
string PERMISSIONS = Settings.SelectValueByName("PERMISSIONS"); |
|
|
|
|
if ("admin".Equals(PERMISSIONS)) |
|
|
|
|
{ |
|
|
|
|
IsEnabled = true; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
IsEnabled = false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/// <summary> |
|
|
|
|
/// 美化JSON |
|
|
|
|
/// </summary> |
|
|
|
@ -122,8 +135,6 @@ public class AlgorithmConfigVM : BaseViewModel |
|
|
|
|
{ |
|
|
|
|
Growl.ErrorGlobal(ex.Message); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|