### 2024-12-20 星期五更新
------ #### SuperDesign V3.0.2412.2001 - *.[新增]新增程序更新日志设置和自动发布功能。 - *.[修复]修复Post数据格式不正确时双击文本框会导致软件闪退的BUG。
This commit is contained in:
1 parent
03bcb8c5fd
commit
993f1ca1a9
349 files changed
+81977
-13873
No files matched your search
@@ -0,0 +1,62 @@
|
||||
using 开发辅助工具.Tools.SmartEditor;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace RySmartEditor
|
||||
{
|
||||
public class Init
|
||||
{
|
||||
public static void Show(string[] args)
|
||||
{
|
||||
if (args.Length >= 2)
|
||||
{
|
||||
if (args[0] == "edit")
|
||||
{
|
||||
string ProjectPath = args[1];
|
||||
OpenEditor(ProjectPath);
|
||||
}
|
||||
}
|
||||
else if(args.Length == 1)
|
||||
{
|
||||
if (args[0] == "edit" || System.IO.File.Exists(args[0]))
|
||||
{
|
||||
OpenEditor(args[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenEditor("edit");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenEditor("edit");
|
||||
//Application.Run(new FrmMainEditor());
|
||||
}
|
||||
}
|
||||
static void OpenEditor(string path)
|
||||
{
|
||||
object mainHandle = QuickMsg.RyMemoryShare.ReadFromMemory(1024, typeof(Int64), "SmartEditor");
|
||||
if (mainHandle != null && (long)mainHandle != 0)
|
||||
{
|
||||
var handle = new IntPtr((long)mainHandle);
|
||||
if (path == "edit")
|
||||
{
|
||||
ryControls.Win32.SendMessage(handle, 17189, 100, 100);//让界面显示
|
||||
}
|
||||
else
|
||||
{
|
||||
ryConfig.MsgManager.SendMsg(handle, 1666, path);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Application.Run(new FrmMainEditor(path == "edit" ? "" : path));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,364 @@
|
||||
using ryCommon;
|
||||
using ryCommonDb;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using static ryCommonDb.DataProvider;
|
||||
|
||||
namespace 开发辅助工具.Manager
|
||||
{
|
||||
public class Itrycn_Db
|
||||
{
|
||||
public static bool IsCloseConfirm = true;
|
||||
public static string Sys_SQLConn = "<app>\\SysDb\\Tools.dat|";
|
||||
public static string User_SQLConn = "<app>\\UserDb\\MyDb.dat|";
|
||||
public static string History_SQLConn = "<app>\\UserDb\\history.dat|";
|
||||
public static ryCommonDb.DataProvider.DataProviderType dataType = ryCommonDb.DataProvider.DataProviderType.SQLiteDataProvider;
|
||||
public static IDbInterface CreateDataProvider(DataProviderType dataProviderType)
|
||||
{
|
||||
switch (dataProviderType)
|
||||
{
|
||||
//case DataProviderType.OdbcDataProvider:
|
||||
// return new OdbcDataProvider();
|
||||
//case DataProviderType.OleDbDataProvider:
|
||||
// return new OleDbDataProvider();
|
||||
//case DataProviderType.OracleDataProvider:
|
||||
// return new OracleDataProvider();
|
||||
case DataProviderType.SQLiteDataProvider:
|
||||
return new SQLiteDataProvider();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 判断WinSCP是否在运行
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static bool WinSCP_IsRunning() {
|
||||
var exist = false;
|
||||
try {
|
||||
var proc_list = Process.GetProcessesByName("WinSCP");
|
||||
for (int i = 0; i < proc_list.Length; i++) {
|
||||
var path = proc_list[i].GetPath();
|
||||
if (path.Length > 0) {
|
||||
if (path.IndexOfEx(Application.StartupPath) < 0) {
|
||||
exist = true; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch {
|
||||
|
||||
}
|
||||
if (!exist) {
|
||||
//RyForm.get
|
||||
}
|
||||
return exist;
|
||||
}
|
||||
public static void DeleteFiles(string dir, string filter)
|
||||
{
|
||||
var files = System.IO.Directory.GetFiles(dir, filter);
|
||||
for (int i = 0; i < files.Length; i++)
|
||||
{
|
||||
ryCommon.RyFiles.DeleteFile(files[i]);
|
||||
}
|
||||
ryCommon.RyFiles.DeleteFile(dir + "\\" + filter);
|
||||
var dirs = System.IO.Directory.GetDirectories(dir);
|
||||
for (int i = 0; i < dirs.Length; i++)
|
||||
{
|
||||
DeleteFiles(dirs[i], filter);
|
||||
}
|
||||
}
|
||||
public static void CreateSysTable()
|
||||
{
|
||||
IDbInterface db = CreateDataProvider(dataType);
|
||||
if (db.ConnDb(Sys_SQLConn) == 1)
|
||||
{
|
||||
#region 工具表
|
||||
RyQuickSQL mySQL = new RyQuickSQL("Tools");
|
||||
mySQL.AddField("Name", "");
|
||||
mySQL.AddField("Des", "");
|
||||
mySQL.AddField("Keys", "");
|
||||
mySQL.AddField("Addr", "");
|
||||
mySQL.AddField("PY", "");
|
||||
mySQL.AddField("Sort", 0);
|
||||
mySQL.AddField("addTime",DateTime.Now);
|
||||
db.CreateDb(mySQL);
|
||||
#endregion
|
||||
//
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取设置
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="defValue"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetSetting(string name, string defValue)
|
||||
{
|
||||
var result = defValue;
|
||||
IDbInterface db = CreateDataProvider(dataType);
|
||||
if (db.ConnDb(User_SQLConn) == 1)
|
||||
{
|
||||
RyQuickSQL mySQL = new RyQuickSQL("Settings");
|
||||
mySQL.AddField("Name", name);
|
||||
var ds = db.ReadData("select * from Settings where Name=@Name", mySQL);
|
||||
if (ds.HaveData())
|
||||
{
|
||||
result = ds.GetRow(0)["Value"].ToString();
|
||||
}
|
||||
ds.Dispose();
|
||||
}
|
||||
db.Free();
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// 设置设置
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="defValue"></param>
|
||||
/// <returns></returns>
|
||||
public static int SetSetting(string name, string value)
|
||||
{
|
||||
var result = 0;
|
||||
IDbInterface db = CreateDataProvider(dataType);
|
||||
if (db.ConnDb(User_SQLConn) == 1)
|
||||
{
|
||||
RyQuickSQL mySQL = new RyQuickSQL("Settings");
|
||||
mySQL.AddField("Name", name);
|
||||
mySQL.AddField("Value", value);
|
||||
result= db.ExecuteNonQuery(mySQL.GetUpdateSQL()+ " where Name=@Name", mySQL);
|
||||
if (result==0)
|
||||
{
|
||||
mySQL.AddField("addTime", DateTime.Now);
|
||||
result = db.ExecuteNonQuery(mySQL.GetInsertSQL(), mySQL);
|
||||
}
|
||||
}
|
||||
db.Free();
|
||||
return result;
|
||||
}
|
||||
public static void CreateDb()
|
||||
{
|
||||
CreateSysTable();
|
||||
CreateUserTable();
|
||||
CreateHistoryTable();
|
||||
}
|
||||
public static void CreateUserTable()
|
||||
{
|
||||
IDbInterface db = CreateDataProvider(dataType);
|
||||
if (db.ConnDb(User_SQLConn) == 1)
|
||||
{
|
||||
#region Url表
|
||||
RyQuickSQL mySQL = new RyQuickSQL("Urls");
|
||||
mySQL.AddField("Name", "");
|
||||
mySQL.AddField("Url", "");
|
||||
mySQL.AddField("Cookie", "");
|
||||
mySQL.AddField("Postdata", "");
|
||||
mySQL.AddField("Method", "");
|
||||
mySQL.AddField("Header", "");
|
||||
mySQL.AddField("Referer", "");
|
||||
mySQL.AddField("ContentType", "");
|
||||
mySQL.AddField("Encoding", "");
|
||||
mySQL.AddField("IsFav", 0);
|
||||
mySQL.AddField("Des", "");
|
||||
mySQL.AddField("ClickCount", 0);//点击次数
|
||||
mySQL.AddField("editTime", DateTime.Now);
|
||||
mySQL.AddField("addTime", DateTime.Now);
|
||||
db.CreateDb(mySQL);
|
||||
#endregion
|
||||
#region 启动表
|
||||
mySQL.Clear();
|
||||
mySQL.TableName = "Starts"; ;
|
||||
mySQL.AddField("Addr", "");
|
||||
mySQL.AddField("Name", "");
|
||||
mySQL.AddField("ClickCount", 0);//点击次数
|
||||
mySQL.AddField("editTime", DateTime.Now);
|
||||
mySQL.AddField("addTime", DateTime.Now);
|
||||
db.CreateDb(mySQL);
|
||||
#endregion
|
||||
#region 变量表
|
||||
mySQL.Clear();
|
||||
mySQL.TableName = "VarInfo"; ;
|
||||
mySQL.AddField("VarName", "");
|
||||
mySQL.AddField("VarValue", "");
|
||||
mySQL.AddField("Des", "");//备注
|
||||
mySQL.AddField("editTime", DateTime.Now);
|
||||
mySQL.AddField("addTime", DateTime.Now);
|
||||
db.CreateDb(mySQL);
|
||||
#endregion
|
||||
#region API表
|
||||
mySQL.Clear();
|
||||
mySQL.TableName = "api";
|
||||
mySQL.AddField("Name", "");
|
||||
mySQL.AddField("Url", "");
|
||||
mySQL.AddField("APIName", "");
|
||||
mySQL.AddField("Postdata", "");
|
||||
mySQL.AddField("desc", "");
|
||||
mySQL.AddField("ClickCount", 0);//点击次数
|
||||
mySQL.AddField("editTime", DateTime.Now);
|
||||
mySQL.AddField("addTime", DateTime.Now);
|
||||
if (db.CreateDb(mySQL) == 1)
|
||||
{
|
||||
db.ExecuteNonQuery("CREATE INDEX index_APIName ON api(APIName); ");
|
||||
db.ExecuteNonQuery("CREATE INDEX index_APIUrl ON api(Url); ");
|
||||
}
|
||||
#endregion
|
||||
#region FTP表
|
||||
mySQL.Clear();
|
||||
mySQL.TableName = "FTP";
|
||||
mySQL.AddField("name", "");
|
||||
mySQL.AddField("ip", "");
|
||||
mySQL.AddField("port", 0);
|
||||
mySQL.AddField("remoteDir", "");
|
||||
mySQL.AddField("username", "");
|
||||
mySQL.AddField("pwd", "");
|
||||
mySQL.AddField("encrypt", 0);
|
||||
mySQL.AddField("des", "");
|
||||
mySQL.AddField("addTime", DateTime.Now);
|
||||
mySQL.AddField("editTime", DateTime.Now);
|
||||
db.CreateDb(mySQL);
|
||||
#endregion
|
||||
#region Site表
|
||||
mySQL.Clear();
|
||||
mySQL.TableName = "Site";
|
||||
mySQL.AddField("name", "");
|
||||
mySQL.AddField("localPath", "");
|
||||
mySQL.AddField("ftpId", 0);
|
||||
mySQL.AddField("ftpDir", "");
|
||||
mySQL.AddField("addTime", DateTime.Now);
|
||||
mySQL.AddField("editTime", DateTime.Now);
|
||||
db.CreateDb(mySQL);
|
||||
#endregion
|
||||
#region FavGroup表
|
||||
mySQL.Clear();
|
||||
mySQL.TableName = "FavGroup";
|
||||
mySQL.AddField("name", "");
|
||||
mySQL.AddField("addTime", DateTime.Now);
|
||||
mySQL.AddField("editTime", DateTime.Now);
|
||||
db.CreateDb(mySQL);
|
||||
#endregion
|
||||
#region FavFiles表
|
||||
mySQL.Clear();
|
||||
mySQL.TableName = "FavFiles";
|
||||
mySQL.AddField("name", "");
|
||||
mySQL.AddField("FilePath", "");
|
||||
mySQL.AddField("FindText", "");
|
||||
mySQL.AddField("GroupId", 1);
|
||||
mySQL.AddField("addTime", DateTime.Now);
|
||||
mySQL.AddField("editTime", DateTime.Now);
|
||||
db.CreateDb(mySQL);
|
||||
#endregion
|
||||
#region 设置表
|
||||
mySQL.Clear();
|
||||
mySQL.TableName = "Settings";
|
||||
mySQL.AddField("Name", "");
|
||||
mySQL.AddField("Value", "");//值
|
||||
mySQL.AddField("addTime", DateTime.Now);
|
||||
if (db.CreateDb(mySQL) == 1)
|
||||
{
|
||||
db.ExecuteNonQuery("CREATE INDEX index_Name ON Settings(Name); ");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
public static void CreateHistoryTable()
|
||||
{
|
||||
IDbInterface db = CreateDataProvider(dataType);
|
||||
if (db.ConnDb(History_SQLConn) == 1)
|
||||
{
|
||||
#region 标签文件表
|
||||
RyQuickSQL mySQL = new RyQuickSQL("Files");
|
||||
mySQL.AddField("FilePath", "");
|
||||
mySQL.AddField("editTime", DateTime.Now);
|
||||
mySQL.AddField("addTime", DateTime.Now);
|
||||
if (db.CreateDb(mySQL) == 1)
|
||||
{
|
||||
db.ExecuteNonQuery("CREATE INDEX index_FilePath ON Files(FilePath); ");
|
||||
}
|
||||
#endregion
|
||||
#region 历史记录表
|
||||
mySQL.Clear();
|
||||
mySQL.TableName = "History"; ;
|
||||
mySQL.AddField("fileid", 0);
|
||||
mySQL.AddField("name", "");
|
||||
mySQL.AddField("size", 0L);
|
||||
mySQL.AddField("content", "");
|
||||
mySQL.AddField("addTime", DateTime.Now);
|
||||
db.CreateDb(mySQL);
|
||||
#endregion
|
||||
#region 设置表
|
||||
mySQL.Clear();
|
||||
mySQL.TableName = "Settings";
|
||||
mySQL.AddField("Name", "");
|
||||
mySQL.AddField("Value", "");//值
|
||||
mySQL.AddField("addTime", DateTime.Now);
|
||||
if (db.CreateDb(mySQL) == 1)
|
||||
{
|
||||
db.ExecuteNonQuery("CREATE INDEX index_Name ON Settings(Name); ");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 添加历史记录
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="content"></param>
|
||||
public static void AddHistory(string path, string content)
|
||||
{
|
||||
new Thread(Start).Start();
|
||||
void Start()
|
||||
{
|
||||
IDbInterface db = CreateDataProvider(dataType);
|
||||
if (db.ConnDb(History_SQLConn) == 1)
|
||||
{
|
||||
var isadd = false;
|
||||
RyQuickSQL mySQL = new RyQuickSQL("Files");
|
||||
mySQL.AddField("FilePath", path);
|
||||
mySQL.AddField("editTime", DateTime.Now);
|
||||
if (db.ExecuteNonQuery(mySQL.GetUpdateSQL() + " where FilePath=@FilePath", mySQL) == 0)
|
||||
{
|
||||
mySQL.AddField("addTime", DateTime.Now);
|
||||
db.Insert(mySQL);
|
||||
isadd = true;
|
||||
}
|
||||
var ds = db.ReadData("select * from Files where FilePath=@FilePath", mySQL);
|
||||
if (ds.HaveData())
|
||||
{
|
||||
var fileid = ds.GetFirstRowData()["id"].ToInt();
|
||||
var issame = false;
|
||||
if (!isadd)
|
||||
{
|
||||
var ds_his = db.ReadData("select * from History where fileid=" + fileid + " order by addTime desc limit 1");
|
||||
if (ds_his.HaveData())
|
||||
{
|
||||
if (ds_his.GetFirstRowData()["content"].ToString() == content)
|
||||
{
|
||||
issame = true;
|
||||
}
|
||||
}
|
||||
ds_his.Dispose();
|
||||
}
|
||||
if (!issame)
|
||||
{
|
||||
mySQL.Clear();
|
||||
mySQL.TableName = "History";
|
||||
mySQL.AddField("fileid", fileid);
|
||||
mySQL.AddField("size", content.Length);
|
||||
mySQL.AddField("content", content);
|
||||
mySQL.AddField("addTime", DateTime.Now);
|
||||
db.Insert(mySQL);
|
||||
}
|
||||
}
|
||||
ds.Dispose();
|
||||
}
|
||||
db.Free();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,74 @@
|
||||
#region License
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2018 Denis Ivanov
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
#endregion
|
||||
|
||||
namespace Jsbeautifier
|
||||
{
|
||||
using System;
|
||||
|
||||
public class BeautifierFlags
|
||||
{
|
||||
public BeautifierFlags(string mode)
|
||||
{
|
||||
PreviousMode = "BLOCK";
|
||||
Mode = mode;
|
||||
VarLine = false;
|
||||
VarLineTainted = false;
|
||||
VarLineReindented = false;
|
||||
InHtmlComment = false;
|
||||
IfLine = false;
|
||||
ChainExtraIndentation = 0;
|
||||
InCase = false;
|
||||
InCaseStatement = false;
|
||||
CaseBody = false;
|
||||
IndentationLevel = 0;
|
||||
TernaryDepth = 0;
|
||||
}
|
||||
|
||||
public string PreviousMode { get; set; }
|
||||
|
||||
public string Mode { get; set; }
|
||||
|
||||
public bool VarLine { get; set; }
|
||||
|
||||
public bool VarLineTainted { get; set; }
|
||||
|
||||
public bool VarLineReindented { get; set; }
|
||||
|
||||
public bool InHtmlComment { get; set; }
|
||||
|
||||
public bool IfLine { get; set; }
|
||||
|
||||
public int ChainExtraIndentation { get; set; }
|
||||
|
||||
public bool InCase { get; set; }
|
||||
|
||||
public bool InCaseStatement { get; set; }
|
||||
|
||||
public bool CaseBody { get; set; }
|
||||
|
||||
public int IndentationLevel { get; set; }
|
||||
|
||||
public int TernaryDepth { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
#region License
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2018 Denis Ivanov
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
#endregion
|
||||
|
||||
namespace Jsbeautifier
|
||||
{
|
||||
public class BeautifierOptions
|
||||
{
|
||||
public BeautifierOptions()
|
||||
{
|
||||
IndentSize = 4;
|
||||
IndentChar = ' ';
|
||||
IndentWithTabs = false;
|
||||
PreserveNewlines = true;
|
||||
MaxPreserveNewlines = 10.0f;
|
||||
JslintHappy = false;
|
||||
BraceStyle = BraceStyle.Collapse;
|
||||
KeepArrayIndentation = false;
|
||||
KeepFunctionIndentation = false;
|
||||
EvalCode = false;
|
||||
WrapLineLength = 0;
|
||||
BreakChainedMethods = false;
|
||||
}
|
||||
|
||||
public uint IndentSize { get; set; }
|
||||
|
||||
public char IndentChar { get; set; }
|
||||
|
||||
public bool IndentWithTabs { get; set; }
|
||||
|
||||
public bool PreserveNewlines { get; set; }
|
||||
|
||||
public float MaxPreserveNewlines { get; set; }
|
||||
|
||||
public bool JslintHappy { get; set; }
|
||||
|
||||
public BraceStyle BraceStyle { get; set; }
|
||||
|
||||
public bool KeepArrayIndentation { get; set; }
|
||||
|
||||
public bool KeepFunctionIndentation { get; set; }
|
||||
|
||||
public bool EvalCode { get; set; }
|
||||
|
||||
public int WrapLineLength { get; set; }
|
||||
|
||||
public bool BreakChainedMethods { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#region License
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2018 Denis Ivanov
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
#endregion
|
||||
|
||||
namespace Jsbeautifier
|
||||
{
|
||||
public enum BraceStyle
|
||||
{
|
||||
Expand, Collapse, EndExpand
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using ryCommon;
|
||||
using QuickMsg;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
|
||||
namespace ryConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// 流程软件通信类
|
||||
/// </summary>
|
||||
public class MsgManager
|
||||
{
|
||||
|
||||
[DllImport("user32.dll", EntryPoint = "GetParent", SetLastError = true)]
|
||||
private static extern IntPtr GetParent(IntPtr hWnd);
|
||||
|
||||
[DllImport("user32.dll", EntryPoint = "GetWindowThreadProcessId")]
|
||||
private static extern uint GetWindowThreadProcessId(IntPtr hWnd, ref uint lpdwProcessId);
|
||||
|
||||
[DllImport("user32.dll", EntryPoint = "IsWindow")]
|
||||
private static extern bool IsWindow(IntPtr hWnd);
|
||||
private const int WM_COPYDATA = 0x004A;
|
||||
public struct COPYDATASTRUCT
|
||||
{
|
||||
public IntPtr dwData;
|
||||
public int cData;
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string lpData;
|
||||
}
|
||||
[DllImport("User32.dll", EntryPoint = "SendMessage")]
|
||||
private static extern int SendMessage(IntPtr hwnd, int msg, int wParam, ref COPYDATASTRUCT IParam);
|
||||
/// <summary>
|
||||
/// 向指定句柄发送消息
|
||||
/// </summary>
|
||||
/// <param name="handle"></param>
|
||||
/// <param name="wParam"></param>
|
||||
/// <param name="str">要发送的文字内容</param>
|
||||
public static void SendMsg(IntPtr handle, int wParam, string str)
|
||||
{
|
||||
byte[] arr = System.Text.Encoding.Default.GetBytes(str);
|
||||
int len = arr.Length;
|
||||
COPYDATASTRUCT cdata;
|
||||
cdata.dwData = (IntPtr)100;
|
||||
cdata.lpData = str;
|
||||
cdata.cData = len + 1;
|
||||
SendMessage(handle, WM_COPYDATA, wParam, ref cdata);
|
||||
}
|
||||
/// <summary>
|
||||
/// 发送消息到文本编辑器
|
||||
/// </summary>
|
||||
/// <param name="wParam">附带信息</param>
|
||||
/// <param name="str">要发送的文字内容</param>
|
||||
public static void SendMsgToEditor(string str)
|
||||
{
|
||||
object mainHandle = QuickMsg.RyMemoryShare.ReadFromMemory(1024, typeof(Int64), "SmartEditor");
|
||||
if (mainHandle != null)
|
||||
{
|
||||
SendMsg((IntPtr)mainHandle.ToInt64(), 0, str);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 发送消息到指定的内存ID窗口
|
||||
/// </summary>
|
||||
/// <param name="MemoryId">内存ID</param>
|
||||
/// <param name="wParam">附带信息标识</param>
|
||||
/// <param name="str">发送的内容</param>
|
||||
public static void SendMsg(string MemoryId, int wParam, string str)
|
||||
{
|
||||
if (MemoryId == null || MemoryId.Length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
object mainHandle = QuickMsg.RyMemoryShare.ReadFromMemory(1024, typeof(Int64), MemoryId);
|
||||
if (mainHandle != null && (long)mainHandle != 0)
|
||||
{
|
||||
SendMsg((IntPtr)mainHandle.ToInt64(), wParam, str);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取消息字符串内容
|
||||
/// </summary>
|
||||
/// <param name="m"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetMsg(Message m)
|
||||
{
|
||||
COPYDATASTRUCT cdata = new COPYDATASTRUCT();
|
||||
Type mytype = cdata.GetType();
|
||||
cdata = (COPYDATASTRUCT)m.GetLParam(mytype);
|
||||
return cdata.lpData;
|
||||
}
|
||||
/// <summary>
|
||||
/// 通知已打开的编辑器,显示界面
|
||||
/// </summary>
|
||||
public static void ShowEditorUI()
|
||||
{
|
||||
object mainHandle = QuickMsg.RyMemoryShare.ReadFromMemory(1024, typeof(Int64), "SmartEditor");
|
||||
if (mainHandle != null && (long)mainHandle != 0)
|
||||
{
|
||||
ryControls.Win32.SendMessage(new IntPtr((long)mainHandle), 17189, 100, 100);//让界面显示
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user