### 2021-02-13更新

------
#### SuperDesign    V2.0.2102.0101
*.[更换]更换高亮控件。
*.[新增]打包时可以依据项目来决定是否混淆。
This commit is contained in:
鑫Intel 2021-02-13 09:17:49 +08:00
parent e9f5ca3c3c
commit abae178120
35 changed files with 1783 additions and 1616 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>

Binary file not shown.

View File

@ -1,7 +1,20 @@
### 2020-12-15更新
### 2021-02-13更新
------
#### SuperDesign V2.0.2102.0101
*.[更换]更换高亮控件。
*.[新增]打包时可以依据项目来决定是否混淆。
### 2020-12-17更新
------
#### SuperDesign V2.0.2012.1701
- *.[改进]当以json模式post数据时,自动转码json中的中文。
- *.[改进]修复json查看器括号折叠不正确的BUG。
### 2020-12-15更新
------
#### SuperDesign V2.0.2012.1501
*.[修复]修复部分情况下打包时无法识别软件路径从而无法识别版本号的BUG。
- *.[修复]修复部分情况下打包时无法识别软件路径从而无法识别版本号的BUG。
### 2020-12-10更新
------
#### SuperDesign V2.0.2012.1001

View File

@ -1,5 +1,4 @@
using ICSharpCode.TextEditor;
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
@ -7,7 +6,6 @@ using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using XmlPad;
namespace ryProcessManager.hezuo
{
@ -28,65 +26,62 @@ namespace ryProcessManager.hezuo
}
private void Find_Click(object sender, EventArgs e)
{
if (!(base.SourceControl is ICSharpCode.TextEditor.TextEditorControl)) { return; }
var rich_txt = (ICSharpCode.TextEditor.TextEditorControl)base.SourceControl;
FindAndReplaceForm _findForm = new FindAndReplaceForm();
TextEditorControl editor = rich_txt;
if (editor == null) return;
_findForm.ShowFor(editor, false);
_findForm.ReplaceMode = false;
if (!(base.SourceControl is FastColoredTextBoxNS.FastColoredTextBox)) { return; }
var rich_txt = (FastColoredTextBoxNS.FastColoredTextBox)base.SourceControl;
rich_txt.ShowFindDialog();
}
private void SelectAll_Click(object sender, EventArgs e)
{
if (!(base.SourceControl is ICSharpCode.TextEditor.TextEditorControl)) { return; }
//var rich_txt = (ICSharpCode.TextEditor.TextEditorControl)base.SourceControl;
Thread th = new Thread(sendkey);
th.Start();
void sendkey()
{
Thread.Sleep(100);
this.Invoke(new Action(() =>
{
SendKeys.SendWait("^a");
}));
}
if (!(base.SourceControl is FastColoredTextBoxNS.FastColoredTextBox)) { return; }
var rich_txt = (FastColoredTextBoxNS.FastColoredTextBox)base.SourceControl;
rich_txt.SelectAll();
//Thread th = new Thread(sendkey);
//th.Start();
//void sendkey()
//{
// Thread.Sleep(100);
// this.Invoke(new Action(() =>
// {
// SendKeys.SendWait("^a");
// }));
//}
}
private void Undo_Click(object sender, EventArgs e)
{
if(!(base.SourceControl is ICSharpCode.TextEditor.TextEditorControl)) { return; }
var rich_txt = (ICSharpCode.TextEditor.TextEditorControl)base.SourceControl;
if(!(base.SourceControl is FastColoredTextBoxNS.FastColoredTextBox)) { return; }
var rich_txt = (FastColoredTextBoxNS.FastColoredTextBox)base.SourceControl;
rich_txt.Undo();
}
private void Redo_Click(object sender, EventArgs e)
{
if (!(base.SourceControl is ICSharpCode.TextEditor.TextEditorControl)) { return; }
var rich_txt = (ICSharpCode.TextEditor.TextEditorControl)base.SourceControl;
if (!(base.SourceControl is FastColoredTextBoxNS.FastColoredTextBox)) { return; }
var rich_txt = (FastColoredTextBoxNS.FastColoredTextBox)base.SourceControl;
rich_txt.Redo();
}
private void Cut_Click(object sender, EventArgs e)
{
if (!(base.SourceControl is ICSharpCode.TextEditor.TextEditorControl)) { return; }
var rich_txt = (ICSharpCode.TextEditor.TextEditorControl)base.SourceControl;
ryCommon.RyFiles.CopyToClip(rich_txt.ActiveTextAreaControl.SelectionManager.SelectedText);
rich_txt.ActiveTextAreaControl.TextArea.InsertString("");
if (!(base.SourceControl is FastColoredTextBoxNS.FastColoredTextBox)) { return; }
var rich_txt = (FastColoredTextBoxNS.FastColoredTextBox)base.SourceControl;
rich_txt.Cut();
}
private void Copy_Click(object sender, EventArgs e)
{
if (!(base.SourceControl is ICSharpCode.TextEditor.TextEditorControl)) { return; }
var rich_txt = (ICSharpCode.TextEditor.TextEditorControl)base.SourceControl;
ryCommon.RyFiles.CopyToClip(rich_txt.ActiveTextAreaControl.SelectionManager.SelectedText);
if (!(base.SourceControl is FastColoredTextBoxNS.FastColoredTextBox)) { return; }
var rich_txt = (FastColoredTextBoxNS.FastColoredTextBox)base.SourceControl;
var ss = rich_txt.SelectedText;
rich_txt.Copy();
}
private void Paste_Click(object sender, EventArgs e)
{
if (!(base.SourceControl is ICSharpCode.TextEditor.TextEditorControl)) { return; }
var rich_txt = (ICSharpCode.TextEditor.TextEditorControl)base.SourceControl;
rich_txt.ActiveTextAreaControl.TextArea.InsertString(Clipboard.GetText().Replace("\r\n", "\r").Replace("\r", "\r\n"));
if (!(base.SourceControl is FastColoredTextBoxNS.FastColoredTextBox)) { return; }
var rich_txt = (FastColoredTextBoxNS.FastColoredTextBox)base.SourceControl;
rich_txt.Paste();
}
private void Del_Click(object sender, EventArgs e)
{
if (!(base.SourceControl is ICSharpCode.TextEditor.TextEditorControl)) { return; }
var rich_txt = (ICSharpCode.TextEditor.TextEditorControl)base.SourceControl;
rich_txt.ActiveTextAreaControl.TextArea.InsertString("");
if (!(base.SourceControl is FastColoredTextBoxNS.FastColoredTextBox)) { return; }
var rich_txt = (FastColoredTextBoxNS.FastColoredTextBox)base.SourceControl;
rich_txt.SelectedText="";
}
public ToolStripSeparator AddSeparatorMenu()
{
@ -106,8 +101,8 @@ namespace ryProcessManager.hezuo
private void ContextMenuStripRichText_Opening(object sender, CancelEventArgs e)
{
if (!(base.SourceControl is ICSharpCode.TextEditor.TextEditorControl)) { return; }
var rich_txt = (ICSharpCode.TextEditor.TextEditorControl)base.SourceControl;
if (!(base.SourceControl is FastColoredTextBoxNS.FastColoredTextBox)) { return; }
var rich_txt = (FastColoredTextBoxNS.FastColoredTextBox)base.SourceControl;
for (int i = 0; i < base.Items.Count; i++)
{
var item = base.Items[i];
@ -115,25 +110,25 @@ namespace ryProcessManager.hezuo
switch(item.Tag.ToString())
{
case "undo":
item.Enabled = rich_txt.EnableUndo;
item.Enabled = rich_txt.UndoEnabled && !rich_txt.ReadOnly;
break;
case "redo":
item.Enabled = rich_txt.EnableRedo;
item.Enabled = rich_txt.RedoEnabled && !rich_txt.ReadOnly;
break;
case "cut":
item.Enabled = (rich_txt.ActiveTextAreaControl.SelectionManager.SelectedText != "" && !rich_txt.IsReadOnly) ? true : false;
item.Enabled = (rich_txt.SelectedText != "" && !rich_txt.ReadOnly) ? true : false;
break;
case "copy":
item.Enabled = rich_txt.ActiveTextAreaControl.SelectionManager.SelectedText != "" ? true : false;
item.Enabled = rich_txt.SelectedText != "" ? true : false;
break;
case "paste":
item.Enabled = !rich_txt.IsReadOnly;
item.Enabled = !rich_txt.ReadOnly;
break;
case "del":
item.Enabled =(rich_txt.ActiveTextAreaControl.SelectionManager.SelectedText != "" && !rich_txt.IsReadOnly) ? true : false;
item.Enabled =(rich_txt.SelectedText != "" && !rich_txt.ReadOnly) ? true : false;
break;
case "selectall":
item.Enabled = rich_txt.ActiveTextAreaControl.SelectionManager.SelectedText != rich_txt.Text ? true : false;
item.Enabled = rich_txt.SelectedText != rich_txt.Text ? true : false;
break;
}
}

View File

@ -21,8 +21,8 @@ namespace XmlPad
}
TextEditorSearcher _search;
TextEditorControl _editor;
TextEditorControl Editor
FastColoredTextBoxNS.FastColoredTextBox _editor;
FastColoredTextBoxNS.FastColoredTextBox Editor
{
get { return _editor; }
set
@ -43,7 +43,7 @@ namespace XmlPad
this.Text = text;
}
public void ShowFor(TextEditorControl editor, bool replaceMode)
public void ShowFor(FastColoredTextBoxNS.FastColoredTextBox editor, bool replaceMode)
{
Editor = editor;

View File

@ -1,6 +1,5 @@
using DotNet4.Utilities;
using HtmlAgilityPack;
using ICSharpCode.TextEditor.Document;
using Microsoft.Win32;
using ryCommon;
using ryCommonDb;

View File

@ -468,6 +468,7 @@ namespace 开发辅助工具.Manager
ryCommon.Ini ini = new ryCommon.Ini(bf_folder + "\\查看项目.ryp");
var eng_name = ini.ReadIni("project", "engname");
var proglang = ini.ReadIni("project", "proglang");
var confuse = ini.ReadIni("project", "confuse",1);
var ouput_folder = bf_folder + "\\Bin\\" + com_mode + "\\" + eng_name;
if(!System.IO.Directory.Exists(ouput_folder))
{
@ -479,7 +480,7 @@ namespace 开发辅助工具.Manager
FileVersionInfo fileVerInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(ouput_folder + "\\" + eng_name + ".exe");
file_ver = fileVerInfo.ProductVersion;
}
if (proglang == "c#")
if (proglang == "c#" && confuse==1)
{
ShowState("正在进行混淆...");
if (System.IO.File.Exists(bf_folder + "\\Bin\\混淆_" + com_mode + ".nrproj"))
@ -487,11 +488,11 @@ namespace 开发辅助工具.Manager
var cmd = Read_Prog(ReactorPath, "-project \"" + bf_folder + "\\Bin\\混淆_" + com_mode + ".nrproj\"");
MessageBox.Show(cmd, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
ShowState("正在清理不重要的缓存...");
ryCommon.RyFiles.DeleteFile(ouput_folder + "\\Secure\\*.pdb");
ShowState("复制混淆文件到底包目录...");
ryCommon.RyFiles.CopyFile(ouput_folder + "\\Secure\\*", bf_folder + "\\Publish\\OriginalFiles\\");
}
ShowState("正在清理不重要的缓存...");
ryCommon.RyFiles.DeleteFile(ouput_folder + "\\Secure\\*.pdb");
ShowState("复制混淆文件到底包目录...");
ryCommon.RyFiles.CopyFile(ouput_folder + "\\Secure\\*", bf_folder + "\\Publish\\OriginalFiles\\");
#region
ShowState("复制自定义规则文件到底包目录...");
var Publish = ryCommon.RyFiles.ReadAllLines(bf_folder + "\\Publish\\Publish.set");
@ -533,6 +534,8 @@ namespace 开发辅助工具.Manager
}
#endregion
ShowState("正在打包...");
if (System.IO.File.Exists(bf_folder + "\\Publish\\Green\\" + eng_name + ".zip"))
{ RyFiles.DeleteFile(bf_folder + "\\Publish\\Green\\" + eng_name + ".zip"); }
var cmd2 = Read_Prog(WinRARPath, "-r -ep1 a \"" + bf_folder + "\\Publish\\Green\\" + eng_name + ".zip\" \"" + bf_folder + "\\Publish\\OriginalFiles\\\"");
RyFiles.CopyFile(bf_folder + "\\Publish\\Green\\" + eng_name + ".zip", bf_folder + "\\Publish\\Green\\HistoryVer\\" + eng_name + "_" + file_ver + ".zip");
ShowState("打包完成...");

View File

@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.2012.1701")]
[assembly: AssemblyFileVersion("2.0.2012.1701")]
[assembly: AssemblyVersion("2.0.2102.0101")]
[assembly: AssemblyFileVersion("2.0.2102.0101")]

View File

@ -8,8 +8,9 @@
<OutputType>WinExe</OutputType>
<RootNamespace>SuperDesign</RootNamespace>
<AssemblyName>SuperDesign</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
@ -20,6 +21,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -29,17 +31,19 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>gaim_48px_29650_easyicon.net.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="FastColoredTextBox, Version=2.7.2.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Bin\Debug\SuperDesign\FastColoredTextBox.dll</HintPath>
</Reference>
<Reference Include="HtmlAgilityPack">
<HintPath>..\..\Bin\Debug\SupperDesign\HtmlAgilityPack.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.TextEditor">
<HintPath>..\..\Bin\Debug\SupperDesign\ICSharpCode.TextEditor.dll</HintPath>
</Reference>
<Reference Include="MGdUI">
<HintPath>..\..\Bin\Debug\SupperDesign\MGdUI.dll</HintPath>
</Reference>
@ -99,12 +103,6 @@
<Compile Include="Controls\ContextMenuStripRichText.Designer.cs">
<DependentUpon>ContextMenuStripRichText.cs</DependentUpon>
</Compile>
<Compile Include="Controls\FindAndReplaceForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Controls\FindAndReplaceForm.designer.cs">
<DependentUpon>FindAndReplaceForm.cs</DependentUpon>
</Compile>
<Compile Include="Controls\FrmInsertUnixTime.cs">
<SubType>Form</SubType>
</Compile>
@ -129,7 +127,6 @@
<Compile Include="Controls\MenuRight.Designer.cs">
<DependentUpon>MenuRight.cs</DependentUpon>
</Compile>
<Compile Include="Controls\MingFolding.cs" />
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
@ -279,9 +276,6 @@
<EmbeddedResource Include="Controls\ContextMenuStripRichText.resx">
<DependentUpon>ContextMenuStripRichText.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\FindAndReplaceForm.resx">
<DependentUpon>FindAndReplaceForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\FrmInsertUnixTime.resx">
<DependentUpon>FrmInsertUnixTime.cs</DependentUpon>
</EmbeddedResource>
@ -367,6 +361,7 @@
<EmbeddedResource Include="Tools\FrmXpath.resx">
<DependentUpon>FrmXpath.cs</DependentUpon>
</EmbeddedResource>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>

View File

@ -31,8 +31,7 @@
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmJson));
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.textEditorControl1 = new ICSharpCode.TextEditor.TextEditorControl();
this.contextMenuStripHighlightText1 = new ryProcessManager.hezuo.ContextMenuStripHighlightText();
this.textEditorControl1 = new FastColoredTextBoxNS.FastColoredTextBox();
this.treeView1 = new System.Windows.Forms.TreeView();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -40,6 +39,7 @@
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuStripHighlightText1 = new ryProcessManager.hezuo.ContextMenuStripHighlightText();
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.BtnFormat = new System.Windows.Forms.ToolStripButton();
this.BtnPasteJson = new System.Windows.Forms.ToolStripButton();
@ -70,22 +70,16 @@
this.splitContainer1.Size = new System.Drawing.Size(800, 491);
this.splitContainer1.SplitterDistance = 400;
this.splitContainer1.TabIndex = 0;
//
// textEditorControl1
//
this.textEditorControl1.AutoScrollMinSize = new System.Drawing.Size(27, 14);
this.textEditorControl1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textEditorControl1.ContextMenuStrip = this.contextMenuStripHighlightText1;
this.textEditorControl1.Cursor = System.Windows.Forms.Cursors.IBeam;
this.textEditorControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.textEditorControl1.IsReadOnly = false;
this.textEditorControl1.Font = new System.Drawing.Font("Courier New", 9.75F);
this.textEditorControl1.Location = new System.Drawing.Point(0, 0);
this.textEditorControl1.Name = "textEditorControl1";
this.textEditorControl1.Size = new System.Drawing.Size(400, 491);
this.textEditorControl1.TabIndex = 22;
this.textEditorControl1.TextChanged += new System.EventHandler(this.textEditorControl1_TextChanged);
//
// contextMenuStripHighlightText1
//
this.contextMenuStripHighlightText1.Name = "contextMenuStripHighlightText1";
this.contextMenuStripHighlightText1.Size = new System.Drawing.Size(101, 186);
this.textEditorControl1.TabIndex = 23;
//
// treeView1
//
@ -145,6 +139,11 @@
this.ToolStripMenuItem.Text = "折叠";
this.ToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click);
//
// contextMenuStripHighlightText1
//
this.contextMenuStripHighlightText1.Name = "contextMenuStripHighlightText1";
this.contextMenuStripHighlightText1.Size = new System.Drawing.Size(101, 186);
//
// toolStrip1
//
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -231,7 +230,6 @@
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private ICSharpCode.TextEditor.TextEditorControl textEditorControl1;
private System.Windows.Forms.TreeView treeView1;
private ryProcessManager.hezuo.ContextMenuStripHighlightText contextMenuStripHighlightText1;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
@ -246,5 +244,6 @@
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
private System.Windows.Forms.ToolStripButton CopyJsonByCHS;
private FastColoredTextBoxNS.FastColoredTextBox textEditorControl1;
}
}

View File

@ -1,4 +1,4 @@
using ICSharpCode.TextEditor.Document;
using FastColoredTextBoxNS;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
@ -8,6 +8,7 @@ using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
@ -18,7 +19,51 @@ namespace 开发辅助工具.Tools
public FrmJson()
{
InitializeComponent();
textEditorControl1.Document.FoldingManager.FoldingStrategy = new JackWangCUMT.WinForm.MingFolding();
textEditorControl1.ClearStylesBuffer();
textEditorControl1.Range.ClearStyle(StyleIndex.All);
textEditorControl1.AddStyle(new MarkerStyle(new SolidBrush(Color.FromArgb(40, Color.Gray))));
textEditorControl1.AutoIndentNeeded -= fctb_AutoIndentNeeded;
textEditorControl1.Language = Language.JSON;
textEditorControl1.OnSyntaxHighlight(new TextChangedEventArgs(textEditorControl1.Range));
}
private void fctb_AutoIndentNeeded(object sender, AutoIndentEventArgs args)
{
//block {}
if (Regex.IsMatch(args.LineText, @"^[^""']*\{.*\}[^""']*$"))
return;
//start of block {}
if (Regex.IsMatch(args.LineText, @"^[^""']*\{"))
{
args.ShiftNextLines = args.TabLength;
return;
}
//end of block {}
if (Regex.IsMatch(args.LineText, @"}[^""']*$"))
{
args.Shift = -args.TabLength;
args.ShiftNextLines = -args.TabLength;
return;
}
//label
if (Regex.IsMatch(args.LineText, @"^\s*\w+\s*:\s*($|//)") &&
!Regex.IsMatch(args.LineText, @"^\s*default\s*:"))
{
args.Shift = -args.TabLength;
return;
}
//some statements: case, default
if (Regex.IsMatch(args.LineText, @"^\s*(case|default)\b.*:\s*($|//)"))
{
args.Shift = -args.TabLength / 2;
return;
}
//is unclosed operator in previous line ?
if (Regex.IsMatch(args.PrevLineText, @"^\s*(if|for|foreach|while|[\}\s]*else)\b[^{]*$"))
if (!Regex.IsMatch(args.PrevLineText, @"(;\s*$)|(;\s*//)"))//operator is unclosed
{
args.Shift = args.TabLength;
return;
}
}
private void LoadTreeList(TreeNodeCollection nodes,JObject jo)
{
@ -66,15 +111,15 @@ namespace 开发辅助工具.Tools
}
}
}
private void BtnFormat_Click(object sender, EventArgs e)
private void Format(string text)
{
string json_text = textEditorControl1.Text;
string json_text = text;
treeView1.Nodes.Clear();
//if (Manager.Json.IsJson(json_text))
{
try
{
textEditorControl1.Document.TextContent = Manager.Json.ConvertJsonString(json_text);
textEditorControl1.Text = Manager.Json.ConvertJsonString(json_text);
textEditorControl1.Refresh();
JObject jo = null;
if (Manager.Json.IsArray(json_text))
@ -106,7 +151,8 @@ namespace 开发辅助工具.Tools
node2.Tag = new JsonInfo() { name = item.Name, value = item.Value.ToString() };
Scan(node2.Nodes, (JObject)JsonConvert.DeserializeObject(item.Value.ToString()));
}
else {
else
{
var node = nodes.Add(item.Name + ":" + item.Value + "|" + item.Value.Type.ToString());
node.Tag = new JsonInfo() { name = item.Name, value = item.Value.ToString() };
}
@ -165,7 +211,7 @@ namespace 开发辅助工具.Tools
// treeView1.Nodes.Add(jo..ToString());
//}
}
catch(Exception ex)
catch (Exception ex)
{
MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
@ -177,9 +223,13 @@ namespace 开发辅助工具.Tools
// textEditorControl1.Refresh();
//}
}
private void BtnFormat_Click(object sender, EventArgs e)
{
Format(textEditorControl1.Text);
}
public void LoadJson(string json_text)
{
textEditorControl1.Document.TextContent = json_text;
textEditorControl1.Text = json_text;
textEditorControl1.Refresh();
BtnFormat.PerformClick();
}
@ -200,11 +250,7 @@ namespace 开发辅助工具.Tools
private void BtnPasteJson_Click(object sender, EventArgs e)
{
textEditorControl1.BeginUpdate();
textEditorControl1.Document.TextContent = Clipboard.GetText();
textEditorControl1.Refresh();
textEditorControl1.EndUpdate();
BtnFormat.PerformClick();
Format(Clipboard.GetText());
}
private void BtnCopyJson_Click(object sender, EventArgs e)
@ -214,7 +260,6 @@ namespace 开发辅助工具.Tools
private void FrmJson_Load(object sender, EventArgs e)
{
textEditorControl1.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy("JSON");
}
private void TreeView1_MouseDown(object sender, MouseEventArgs e)
@ -252,11 +297,6 @@ namespace 开发辅助工具.Tools
MessageBox.Show(ex.Message, "出错", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void textEditorControl1_TextChanged(object sender, EventArgs e)
{
textEditorControl1.Document.FoldingManager.UpdateFoldings(null, null);
}
}
public class JsonInfo
{

View File

@ -120,6 +120,7 @@
<metadata name="contextMenuStripHighlightText1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>262, 17</value>
</metadata>

View File

@ -47,9 +47,9 @@
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.BtnUpdateVer = new ryControls.ButtonEx();
this.BtnUpdateDllVer = new ryControls.ButtonEx();
this.BtnRepairFolder = new ryControls.ButtonEx();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.BtnRepairFolder = new ryControls.ButtonEx();
((System.ComponentModel.ISupportInitialize)(this.table1)).BeginInit();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
@ -235,6 +235,18 @@
this.BtnUpdateDllVer.UseVisualStyleBackColor = true;
this.BtnUpdateDllVer.Click += new System.EventHandler(this.BtnUpdateDllVer_Click);
//
// BtnRepairFolder
//
this.BtnRepairFolder.BaseColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(76)))), ((int)(((byte)(95)))));
this.BtnRepairFolder.Location = new System.Drawing.Point(531, 20);
this.BtnRepairFolder.Name = "BtnRepairFolder";
this.BtnRepairFolder.Size = new System.Drawing.Size(111, 34);
this.BtnRepairFolder.TabIndex = 30;
this.BtnRepairFolder.Text = "修复毕方文件结构";
this.toolTip1.SetToolTip(this.BtnRepairFolder, "将当前毕方项目中缺失的一些文件和文件夹进行重新创建。");
this.BtnRepairFolder.UseVisualStyleBackColor = true;
this.BtnRepairFolder.Click += new System.EventHandler(this.BtnRepairFolder_Click);
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
@ -266,18 +278,6 @@
this.groupBox2.TabStop = false;
this.groupBox2.Text = "快速代码";
//
// BtnRepairFolder
//
this.BtnRepairFolder.BaseColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(76)))), ((int)(((byte)(95)))));
this.BtnRepairFolder.Location = new System.Drawing.Point(531, 20);
this.BtnRepairFolder.Name = "BtnRepairFolder";
this.BtnRepairFolder.Size = new System.Drawing.Size(111, 34);
this.BtnRepairFolder.TabIndex = 30;
this.BtnRepairFolder.Text = "修复毕方文件结构";
this.toolTip1.SetToolTip(this.BtnRepairFolder, "将当前毕方项目中缺失的一些文件和文件夹进行重新创建。");
this.BtnRepairFolder.UseVisualStyleBackColor = true;
this.BtnRepairFolder.Click += new System.EventHandler(this.BtnRepairFolder_Click);
//
// FrmProject
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);

View File

@ -126,10 +126,4 @@
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>285, 17</value>
</metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>285, 17</value>
</metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>285, 17</value>
</metadata>
</root>

View File

@ -30,24 +30,12 @@
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmStrCount));
this.textEditorControl1 = new ICSharpCode.TextEditor.TextEditorControl();
this.contextMenuStripHighlightText1 = new ryProcessManager.hezuo.ContextMenuStripHighlightText();
this.menuRight1 = new ryPaiban.Model.MenuRight(this.components);
this.TxtFromCode = new ryControls.Controls.RichTextBox2();
this.fastColoredTextBox1 = new FastColoredTextBoxNS.FastColoredTextBox();
this.SuspendLayout();
//
// textEditorControl1
//
this.textEditorControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textEditorControl1.ContextMenuStrip = this.contextMenuStripHighlightText1;
this.textEditorControl1.IsReadOnly = false;
this.textEditorControl1.Location = new System.Drawing.Point(12, 216);
this.textEditorControl1.Name = "textEditorControl1";
this.textEditorControl1.Size = new System.Drawing.Size(812, 267);
this.textEditorControl1.TabIndex = 19;
//
// contextMenuStripHighlightText1
//
this.contextMenuStripHighlightText1.Name = "contextMenuStripHighlightText1";
@ -56,7 +44,7 @@
// menuRight1
//
this.menuRight1.Name = "menuRight1";
this.menuRight1.Size = new System.Drawing.Size(173, 48);
this.menuRight1.Size = new System.Drawing.Size(185, 92);
this.menuRight1.SourceContent = this;
//
// TxtFromCode
@ -75,13 +63,27 @@
this.TxtFromCode.Text = "";
this.TxtFromCode.TextChanged += new System.EventHandler(this.TxtFromCode_TextChanged);
//
// fastColoredTextBox1
//
this.fastColoredTextBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.fastColoredTextBox1.AutoScrollMinSize = new System.Drawing.Size(27, 14);
this.fastColoredTextBox1.ContextMenuStrip = this.contextMenuStripHighlightText1;
this.fastColoredTextBox1.Cursor = System.Windows.Forms.Cursors.IBeam;
this.fastColoredTextBox1.Font = new System.Drawing.Font("Courier New", 9.75F);
this.fastColoredTextBox1.Location = new System.Drawing.Point(12, 216);
this.fastColoredTextBox1.Name = "fastColoredTextBox1";
this.fastColoredTextBox1.Size = new System.Drawing.Size(812, 277);
this.fastColoredTextBox1.TabIndex = 31;
//
// FrmStrCount
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(836, 495);
this.Controls.Add(this.fastColoredTextBox1);
this.Controls.Add(this.TxtFromCode);
this.Controls.Add(this.textEditorControl1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "FrmStrCount";
this.TabPageContextMenuStrip = this.menuRight1;
@ -91,9 +93,9 @@
}
#endregion
private ICSharpCode.TextEditor.TextEditorControl textEditorControl1;
private ryProcessManager.hezuo.ContextMenuStripHighlightText contextMenuStripHighlightText1;
private ryPaiban.Model.MenuRight menuRight1;
private ryControls.Controls.RichTextBox2 TxtFromCode;
private FastColoredTextBoxNS.FastColoredTextBox fastColoredTextBox1;
}
}

View File

@ -1,5 +1,4 @@
using ICSharpCode.TextEditor.Document;
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@ -16,7 +15,7 @@ namespace 开发辅助工具.Tools
public FrmStrCount()
{
InitializeComponent();
textEditorControl1.IsReadOnly = true;
fastColoredTextBox1.ReadOnly = true;
}
private void TxtFromCode_TextChanged(object sender, EventArgs e)
@ -30,7 +29,7 @@ namespace 开发辅助工具.Tools
resultStr += "\r\n汉字数: " + HanziCount.ToString() + "个(汉字算一个字符)";
resultStr += "\r\n英文数量: " + engCount.ToString() + "个";
resultStr += "\r\n数字数量: " + NumCount.ToString() + "个";
textEditorControl1.Text = resultStr;
fastColoredTextBox1.Text = resultStr;
}
}
}

View File

@ -123,6 +123,7 @@
<metadata name="menuRight1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>262, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>

View File

@ -33,11 +33,10 @@
this.RbStrToC = new System.Windows.Forms.RadioButton();
this.RbStrToJS = new System.Windows.Forms.RadioButton();
this.RbStrToQuickJS = new System.Windows.Forms.RadioButton();
this.textEditorControl1 = new ICSharpCode.TextEditor.TextEditorControl();
this.contextMenuStripHighlightText1 = new ryProcessManager.hezuo.ContextMenuStripHighlightText();
this.RbStrToASP = new System.Windows.Forms.RadioButton();
this.menuRight1 = new ryPaiban.Model.MenuRight(this.components);
this.TxtFromCode = new ryControls.Controls.RichTextBox2();
this.fastColoredTextBox1 = new FastColoredTextBoxNS.FastColoredTextBox();
this.contextMenuStripHighlightText1 = new ryProcessManager.hezuo.ContextMenuStripHighlightText();
this.SuspendLayout();
//
// RbStrToC
@ -75,23 +74,6 @@
this.RbStrToQuickJS.UseVisualStyleBackColor = true;
this.RbStrToQuickJS.CheckedChanged += new System.EventHandler(this.RbStrToQuickJS_CheckedChanged);
//
// textEditorControl1
//
this.textEditorControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textEditorControl1.ContextMenuStrip = this.contextMenuStripHighlightText1;
this.textEditorControl1.IsReadOnly = false;
this.textEditorControl1.Location = new System.Drawing.Point(12, 238);
this.textEditorControl1.Name = "textEditorControl1";
this.textEditorControl1.Size = new System.Drawing.Size(812, 245);
this.textEditorControl1.TabIndex = 19;
//
// contextMenuStripHighlightText1
//
this.contextMenuStripHighlightText1.Name = "contextMenuStripHighlightText1";
this.contextMenuStripHighlightText1.Size = new System.Drawing.Size(101, 186);
//
// RbStrToASP
//
this.RbStrToASP.AutoSize = true;
@ -102,12 +84,6 @@
this.RbStrToASP.Text = "字符串转Asp代码";
this.RbStrToASP.UseVisualStyleBackColor = true;
//
// menuRight1
//
this.menuRight1.Name = "menuRight1";
this.menuRight1.Size = new System.Drawing.Size(173, 48);
this.menuRight1.SourceContent = this;
//
// TxtFromCode
//
this.TxtFromCode.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
@ -125,20 +101,38 @@
this.TxtFromCode.TextChanged += new System.EventHandler(this.TxtFromCode_TextChanged);
this.TxtFromCode.DoubleClick += new System.EventHandler(this.TxtFromCode_DoubleClick);
//
// fastColoredTextBox1
//
this.fastColoredTextBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.fastColoredTextBox1.AutoScrollMinSize = new System.Drawing.Size(27, 14);
this.fastColoredTextBox1.ContextMenuStrip = this.contextMenuStripHighlightText1;
this.fastColoredTextBox1.Cursor = System.Windows.Forms.Cursors.IBeam;
this.fastColoredTextBox1.Font = new System.Drawing.Font("Courier New", 9.75F);
this.fastColoredTextBox1.Location = new System.Drawing.Point(12, 238);
this.fastColoredTextBox1.Name = "fastColoredTextBox1";
this.fastColoredTextBox1.Size = new System.Drawing.Size(812, 255);
this.fastColoredTextBox1.TabIndex = 32;
//
// contextMenuStripHighlightText1
//
this.contextMenuStripHighlightText1.Name = "contextMenuStripHighlightText1";
this.contextMenuStripHighlightText1.Size = new System.Drawing.Size(101, 186);
//
// FrmStrToCode
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(836, 495);
this.Controls.Add(this.fastColoredTextBox1);
this.Controls.Add(this.TxtFromCode);
this.Controls.Add(this.RbStrToASP);
this.Controls.Add(this.textEditorControl1);
this.Controls.Add(this.RbStrToQuickJS);
this.Controls.Add(this.RbStrToJS);
this.Controls.Add(this.RbStrToC);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "FrmStrToCode";
this.TabPageContextMenuStrip = this.menuRight1;
this.Text = "字符串转代码";
this.ResumeLayout(false);
this.PerformLayout();
@ -149,10 +143,10 @@
private System.Windows.Forms.RadioButton RbStrToC;
private System.Windows.Forms.RadioButton RbStrToJS;
private System.Windows.Forms.RadioButton RbStrToQuickJS;
private ICSharpCode.TextEditor.TextEditorControl textEditorControl1;
private ryProcessManager.hezuo.ContextMenuStripHighlightText contextMenuStripHighlightText1;
private System.Windows.Forms.RadioButton RbStrToASP;
private ryPaiban.Model.MenuRight menuRight1;
private ryControls.Controls.RichTextBox2 TxtFromCode;
private FastColoredTextBoxNS.FastColoredTextBox fastColoredTextBox1;
private ryProcessManager.hezuo.ContextMenuStripHighlightText contextMenuStripHighlightText1;
}
}

View File

@ -1,4 +1,4 @@
using ICSharpCode.TextEditor.Document;
using FastColoredTextBoxNS;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -6,6 +6,7 @@ using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
@ -16,22 +17,66 @@ namespace 开发辅助工具.Tools
public FrmStrToCode()
{
InitializeComponent();
textEditorControl1.IsReadOnly = true;
fastColoredTextBox1.ReadOnly = true;
fastColoredTextBox1.ClearStylesBuffer();
fastColoredTextBox1.Range.ClearStyle(StyleIndex.All);
fastColoredTextBox1.AddStyle(new MarkerStyle(new SolidBrush(Color.FromArgb(40, Color.Gray))));
fastColoredTextBox1.AutoIndentNeeded -= fctb_AutoIndentNeeded;
fastColoredTextBox1.Language = Language.JSON;
fastColoredTextBox1.OnSyntaxHighlight(new TextChangedEventArgs(fastColoredTextBox1.Range));
}
private void fctb_AutoIndentNeeded(object sender, AutoIndentEventArgs args)
{
//block {}
if (Regex.IsMatch(args.LineText, @"^[^""']*\{.*\}[^""']*$"))
return;
//start of block {}
if (Regex.IsMatch(args.LineText, @"^[^""']*\{"))
{
args.ShiftNextLines = args.TabLength;
return;
}
//end of block {}
if (Regex.IsMatch(args.LineText, @"}[^""']*$"))
{
args.Shift = -args.TabLength;
args.ShiftNextLines = -args.TabLength;
return;
}
//label
if (Regex.IsMatch(args.LineText, @"^\s*\w+\s*:\s*($|//)") &&
!Regex.IsMatch(args.LineText, @"^\s*default\s*:"))
{
args.Shift = -args.TabLength;
return;
}
//some statements: case, default
if (Regex.IsMatch(args.LineText, @"^\s*(case|default)\b.*:\s*($|//)"))
{
args.Shift = -args.TabLength / 2;
return;
}
//is unclosed operator in previous line ?
if (Regex.IsMatch(args.PrevLineText, @"^\s*(if|for|foreach|while|[\}\s]*else)\b[^{]*$"))
if (!Regex.IsMatch(args.PrevLineText, @"(;\s*$)|(;\s*//)"))//operator is unclosed
{
args.Shift = args.TabLength;
return;
}
}
private void Convert()
{
StringBuilder builder = new StringBuilder();
string format = "C#";
if (RbStrToC.Checked)
{
builder.Append(" StringBuilder sb = new StringBuilder();\r\n");
builder.Append(" sb.Append(\"" + TxtFromCode.Text.Trim().Replace("\"", "\\\"").Replace("\r\n", "\n").Replace("\n", "\");\r\n sb.Append(\"") + "\");");
format = "C#";
fastColoredTextBox1.Language = FastColoredTextBoxNS.Language.CSharp;
}
else if (RbStrToJS.Checked)
{
builder.Append("var sb=\"" + this.TxtFromCode.Text.Trim().Replace("\"", "\\\"").Replace("\r\n", "\n").Replace("\n", "\";\r\n sb=sb+\"") + "\";");
format = "JavaScript";
fastColoredTextBox1.Language = FastColoredTextBoxNS.Language.JS;
}
else if (RbStrToQuickJS.Checked)
{
@ -39,15 +84,14 @@ namespace 开发辅助工具.Tools
builder = new StringBuilder(builder.ToString().Replace("script", "scr\"+\"ipt") + " document.write(sb);");
builder.Insert(0, "<script>\r\n");
builder.Append ("\r\n</script>");
format = "HTML";
fastColoredTextBox1.Language = FastColoredTextBoxNS.Language.HTML;
}
else if (RbStrToASP.Checked)
{
builder.Append("sb=\"" + this.TxtFromCode.Text.Trim().Replace("\"", "\"\"").Replace("\r\n", "\n").Replace("\n", "\" & vbCrLf \r\nsb=sb & \"") + "\"");
format = "ASP/XHTML";
fastColoredTextBox1.Language = FastColoredTextBoxNS.Language.VB;
}
textEditorControl1.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy(format);
textEditorControl1.Text = builder.ToString();
fastColoredTextBox1.Text = builder.ToString();
}
private void RbStrToC_CheckedChanged(object sender, EventArgs e)

View File

@ -120,9 +120,7 @@
<metadata name="contextMenuStripHighlightText1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="menuRight1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>262, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>

View File

@ -37,7 +37,7 @@
this.RichHtml = new System.Windows.Forms.RichTextBox();
this.contextMenuStripRichText1 = new ryProcessManager.hezuo.ContextMenuStripRichText();
this.tabPage12 = new System.Windows.Forms.TabPage();
this.Te_Format = new ICSharpCode.TextEditor.TextEditorControl();
this.Te_Format = new FastColoredTextBoxNS.FastColoredTextBox();
this.contextMenuStripHighlightText1 = new ryProcessManager.hezuo.ContextMenuStripHighlightText();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.RichCookie = new System.Windows.Forms.RichTextBox();
@ -186,16 +186,14 @@
//
// Te_Format
//
this.Te_Format.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.Te_Format.AutoScrollMinSize = new System.Drawing.Size(27, 14);
this.Te_Format.ContextMenuStrip = this.contextMenuStripHighlightText1;
this.Te_Format.IsReadOnly = false;
this.Te_Format.Cursor = System.Windows.Forms.Cursors.IBeam;
this.Te_Format.Dock = System.Windows.Forms.DockStyle.Fill;
this.Te_Format.Location = new System.Drawing.Point(3, 3);
this.Te_Format.Name = "Te_Format";
this.Te_Format.Size = new System.Drawing.Size(870, 279);
this.Te_Format.TabIndex = 0;
this.Te_Format.TextChanged += new System.EventHandler(this.Te_Format_TextChanged);
this.Te_Format.Size = new System.Drawing.Size(875, 274);
this.Te_Format.TabIndex = 24;
//
// contextMenuStripHighlightText1
//
@ -855,7 +853,6 @@
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.RichTextBox RichHtml;
private System.Windows.Forms.TabPage tabPage12;
private ICSharpCode.TextEditor.TextEditorControl Te_Format;
private System.Windows.Forms.TabPage tabPage4;
private System.Windows.Forms.RichTextBox RichCookie;
private System.Windows.Forms.TabPage tabPage5;
@ -907,5 +904,6 @@
private ExtendedWebBrowser2.ExtendedWebBrowser extendedWebBrowser1;
private System.Windows.Forms.CheckBox ChkHtmlPreview;
private System.Windows.Forms.CheckBox ChkNoPreview;
private FastColoredTextBoxNS.FastColoredTextBox Te_Format;
}
}

View File

@ -1,5 +1,5 @@
using DotNet4.Utilities;
using ICSharpCode.TextEditor.Document;
using FastColoredTextBoxNS;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using ryCommon;
@ -11,7 +11,9 @@ using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
@ -26,11 +28,55 @@ namespace 开发辅助工具.Tools
InitializeComponent();
LoadPram();
tabControl2.SelectedTab = tabPage12;
Te_Format.Document.FoldingManager.FoldingStrategy = new JackWangCUMT.WinForm.MingFolding();
Te_Format.ClearStylesBuffer();
Te_Format.Range.ClearStyle(StyleIndex.All);
Te_Format.AddStyle(new MarkerStyle(new SolidBrush(Color.FromArgb(40, Color.Gray))));
Te_Format.AutoIndentNeeded -= fctb_AutoIndentNeeded;
Te_Format.Language = Language.JSON;
Te_Format.OnSyntaxHighlight(new TextChangedEventArgs(Te_Format.Range));
}
private void fctb_AutoIndentNeeded(object sender, AutoIndentEventArgs args)
{
//block {}
if (Regex.IsMatch(args.LineText, @"^[^""']*\{.*\}[^""']*$"))
return;
//start of block {}
if (Regex.IsMatch(args.LineText, @"^[^""']*\{"))
{
args.ShiftNextLines = args.TabLength;
return;
}
//end of block {}
if (Regex.IsMatch(args.LineText, @"}[^""']*$"))
{
args.Shift = -args.TabLength;
args.ShiftNextLines = -args.TabLength;
return;
}
//label
if (Regex.IsMatch(args.LineText, @"^\s*\w+\s*:\s*($|//)") &&
!Regex.IsMatch(args.LineText, @"^\s*default\s*:"))
{
args.Shift = -args.TabLength;
return;
}
//some statements: case, default
if (Regex.IsMatch(args.LineText, @"^\s*(case|default)\b.*:\s*($|//)"))
{
args.Shift = -args.TabLength / 2;
return;
}
//is unclosed operator in previous line ?
if (Regex.IsMatch(args.PrevLineText, @"^\s*(if|for|foreach|while|[\}\s]*else)\b[^{]*$"))
if (!Regex.IsMatch(args.PrevLineText, @"(;\s*$)|(;\s*//)"))//operator is unclosed
{
args.Shift = args.TabLength;
return;
}
}
private void LoadPram()
{
Te_Format.IsReadOnly = true;
Te_Format.ReadOnly = true;
CbbContentType.SelectedIndex = 0;
CbbUserAgent.SelectedIndex = 0;
CbbEncoding.SelectedIndex = 0;
@ -266,7 +312,7 @@ namespace 开发辅助工具.Tools
this.RichHtml.Text = result.Html;
if (Manager.Json.IsJson(result.Html))
{
Te_Format.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy("JSON");
Te_Format.Language = Language.JSON;
Te_Format.Text = Manager.Json.ConvertJsonString(result.Html);
AddUrl("", TxtUrl.Text);
}
@ -283,7 +329,7 @@ namespace 开发辅助工具.Tools
if (_html.Length > 0) { _html += "\r\n"; }
_html += _format_html[i];
}
Te_Format.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy("HTML");
Te_Format.Language = Language.HTML;
try
{
Te_Format.Text = JJCCX.Xml.HtmlFormater.ConvertToXml(_html, true);
@ -411,6 +457,7 @@ namespace 开发辅助工具.Tools
private void FrmWebGet_Load(object sender, EventArgs e)
{
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; //加上这一句
contextMenuStripHighlightText1.AddSeparatorMenu();
contextMenuStripHighlightText1.AddMenu("将选中的内容作为Json分析", "").Click += AnalyJson_Click;
for (int i = 0; i < this.Controls.Count; i++)
@ -441,8 +488,8 @@ namespace 开发辅助工具.Tools
ContextMenuStrip menu =(ContextMenuStrip) (((ToolStripMenuItem)sender).Owner);
switch(menu.SourceControl)
{
case ICSharpCode.TextEditor.TextEditorControl rich_txt:
var SelectedText= rich_txt.ActiveTextAreaControl.SelectionManager.SelectedText;
case FastColoredTextBox rich_txt:
var SelectedText= rich_txt.SelectedText;
if (SelectedText == "") { SelectedText = rich_txt.Text; }
//if (Manager.Json.IsJson(SelectedText))
{
@ -550,7 +597,7 @@ namespace 开发辅助工具.Tools
builder.Append(" return Bitmap.FromStream(ms,true);\r\n");
builder.Append(" }\r\n");
RichHtml.Text = builder.ToString();
Te_Format.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy("C#");
Te_Format.Language = Language.CSharp;
Te_Format.Text= builder.ToString();
}
@ -785,11 +832,6 @@ namespace 开发辅助工具.Tools
{
ChkHtmlPreview.Enabled = !ChkNoPreview.Checked;
}
private void Te_Format_TextChanged(object sender, EventArgs e)
{
Te_Format.Document.FoldingManager.UpdateFoldings(null, null);
}
}
public class UserAgentInfo
{

View File

@ -31,14 +31,14 @@
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmXpath));
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.TxtXML = new ryControls.Controls.RichTextBox2();
this.panelEx1 = new ryControls.PanelEx();
this.textEditorControl1 = new ICSharpCode.TextEditor.TextEditorControl();
this.contextMenuStripHighlightText1 = new ryProcessManager.hezuo.ContextMenuStripHighlightText();
this.RySearchXpath = new ryControls.rySearch();
this.label1 = new System.Windows.Forms.Label();
this.CbbXMLType = new ryControls.RyComboBox();
this.menuRight1 = new ryPaiban.Model.MenuRight(this.components);
this.TxtXML = new ryControls.Controls.RichTextBox2();
this.fastColoredTextBox1 = new FastColoredTextBoxNS.FastColoredTextBox();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@ -67,33 +67,38 @@
this.splitContainer1.SplitterWidth = 2;
this.splitContainer1.TabIndex = 13;
//
// TxtXML
//
this.TxtXML.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.TxtXML.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.TxtXML.DetectUrls = false;
this.TxtXML.EmptyText = "待匹配的XML或HTML内容";
this.TxtXML.ForeColor = System.Drawing.Color.Black;
this.TxtXML.Location = new System.Drawing.Point(3, 3);
this.TxtXML.Name = "TxtXML";
this.TxtXML.OnlyInputText = true;
this.TxtXML.Size = new System.Drawing.Size(868, 139);
this.TxtXML.TabIndex = 32;
this.TxtXML.Text = "";
this.TxtXML.DoubleClick += new System.EventHandler(this.TxtXML_DoubleClick);
//
// panelEx1
//
this.panelEx1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panelEx1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(213)))), ((int)(((byte)(216)))), ((int)(((byte)(223)))));
this.panelEx1.Controls.Add(this.textEditorControl1);
this.panelEx1.Controls.Add(this.fastColoredTextBox1);
this.panelEx1.Location = new System.Drawing.Point(2, 3);
this.panelEx1.Name = "panelEx1";
this.panelEx1.Padding = new System.Windows.Forms.Padding(2);
this.panelEx1.RoundeStyle = ryControls.RoundStyle.None;
this.panelEx1.Size = new System.Drawing.Size(869, 326);
this.panelEx1.Size = new System.Drawing.Size(869, 322);
this.panelEx1.TabIndex = 8;
this.panelEx1.TileBackColor = System.Drawing.Color.White;
//
// textEditorControl1
//
this.textEditorControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textEditorControl1.ContextMenuStrip = this.contextMenuStripHighlightText1;
this.textEditorControl1.IsReadOnly = false;
this.textEditorControl1.Location = new System.Drawing.Point(5, 5);
this.textEditorControl1.Name = "textEditorControl1";
this.textEditorControl1.Size = new System.Drawing.Size(859, 316);
this.textEditorControl1.TabIndex = 5;
//
// contextMenuStripHighlightText1
//
this.contextMenuStripHighlightText1.Name = "contextMenuStripHighlightText1";
@ -139,25 +144,20 @@
// menuRight1
//
this.menuRight1.Name = "menuRight1";
this.menuRight1.Size = new System.Drawing.Size(173, 48);
this.menuRight1.Size = new System.Drawing.Size(185, 92);
this.menuRight1.SourceContent = this;
//
// TxtXML
// fastColoredTextBox1
//
this.TxtXML.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.TxtXML.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.TxtXML.DetectUrls = false;
this.TxtXML.EmptyText = "待匹配的XML或HTML内容";
this.TxtXML.ForeColor = System.Drawing.Color.Black;
this.TxtXML.Location = new System.Drawing.Point(3, 3);
this.TxtXML.Name = "TxtXML";
this.TxtXML.OnlyInputText = true;
this.TxtXML.Size = new System.Drawing.Size(868, 139);
this.TxtXML.TabIndex = 32;
this.TxtXML.Text = "";
this.TxtXML.DoubleClick += new System.EventHandler(this.TxtXML_DoubleClick);
this.fastColoredTextBox1.AutoScrollMinSize = new System.Drawing.Size(27, 14);
this.fastColoredTextBox1.ContextMenuStrip = this.contextMenuStripHighlightText1;
this.fastColoredTextBox1.Cursor = System.Windows.Forms.Cursors.IBeam;
this.fastColoredTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.fastColoredTextBox1.Font = new System.Drawing.Font("Courier New", 9.75F);
this.fastColoredTextBox1.Location = new System.Drawing.Point(2, 2);
this.fastColoredTextBox1.Name = "fastColoredTextBox1";
this.fastColoredTextBox1.Size = new System.Drawing.Size(865, 318);
this.fastColoredTextBox1.TabIndex = 0;
//
// FrmXpath
//
@ -187,12 +187,12 @@
private System.Windows.Forms.SplitContainer splitContainer1;
private ryControls.PanelEx panelEx1;
private ICSharpCode.TextEditor.TextEditorControl textEditorControl1;
private ryControls.rySearch RySearchXpath;
private System.Windows.Forms.Label label1;
private ryControls.RyComboBox CbbXMLType;
private ryProcessManager.hezuo.ContextMenuStripHighlightText contextMenuStripHighlightText1;
private ryPaiban.Model.MenuRight menuRight1;
private ryControls.Controls.RichTextBox2 TxtXML;
private FastColoredTextBoxNS.FastColoredTextBox fastColoredTextBox1;
}
}

View File

@ -1,5 +1,5 @@
using HtmlAgilityPack;
using ICSharpCode.TextEditor.Document;
using FastColoredTextBoxNS;
using HtmlAgilityPack;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -7,6 +7,7 @@ using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
@ -18,18 +19,62 @@ namespace 开发辅助工具.Tools
{
InitializeComponent();
CbbXMLType.SelectedIndex = 0;
textEditorControl1.IsReadOnly = true;
fastColoredTextBox1.ReadOnly = true;
fastColoredTextBox1.ClearStylesBuffer();
fastColoredTextBox1.Range.ClearStyle(StyleIndex.All);
fastColoredTextBox1.AddStyle(new MarkerStyle(new SolidBrush(Color.FromArgb(40, Color.Gray))));
fastColoredTextBox1.AutoIndentNeeded -= fctb_AutoIndentNeeded;
fastColoredTextBox1.Language = Language.JSON;
fastColoredTextBox1.OnSyntaxHighlight(new TextChangedEventArgs(fastColoredTextBox1.Range));
}
private void fctb_AutoIndentNeeded(object sender, AutoIndentEventArgs args)
{
//block {}
if (Regex.IsMatch(args.LineText, @"^[^""']*\{.*\}[^""']*$"))
return;
//start of block {}
if (Regex.IsMatch(args.LineText, @"^[^""']*\{"))
{
args.ShiftNextLines = args.TabLength;
return;
}
//end of block {}
if (Regex.IsMatch(args.LineText, @"}[^""']*$"))
{
args.Shift = -args.TabLength;
args.ShiftNextLines = -args.TabLength;
return;
}
//label
if (Regex.IsMatch(args.LineText, @"^\s*\w+\s*:\s*($|//)") &&
!Regex.IsMatch(args.LineText, @"^\s*default\s*:"))
{
args.Shift = -args.TabLength;
return;
}
//some statements: case, default
if (Regex.IsMatch(args.LineText, @"^\s*(case|default)\b.*:\s*($|//)"))
{
args.Shift = -args.TabLength / 2;
return;
}
//is unclosed operator in previous line ?
if (Regex.IsMatch(args.PrevLineText, @"^\s*(if|for|foreach|while|[\}\s]*else)\b[^{]*$"))
if (!Regex.IsMatch(args.PrevLineText, @"(;\s*$)|(;\s*//)"))//operator is unclosed
{
args.Shift = args.TabLength;
return;
}
}
private void RySearchXpath_OnSearch(object sender, EventArgs e)
{
string text = "";
string format = "XML";
try
{
if (CbbXMLType.SelectedIndex == 0)
{
format = "XML";
fastColoredTextBox1.Language = Language.XML;
System.Xml.XmlDocument xml = new System.Xml.XmlDocument();
xml.LoadXml(TxtXML.Text);
var node = xml.SelectNodes(RySearchXpath.Text);
@ -44,7 +89,7 @@ namespace 开发辅助工具.Tools
}
else if (CbbXMLType.SelectedIndex == 1)
{
format = "HTML";
fastColoredTextBox1.Language = Language.HTML;
HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument();
htmlDoc.LoadHtml(TxtXML.Text);
HtmlNodeCollection anchors = htmlDoc.DocumentNode.SelectNodes(RySearchXpath.Text);
@ -62,8 +107,7 @@ namespace 开发辅助工具.Tools
{
MessageBox.Show(ex.Message, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
textEditorControl1.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy(format);
textEditorControl1.Text = text;
fastColoredTextBox1.Text = text;
}
private void FrmXpath_Load(object sender, EventArgs e)

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>