Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
DataEditorX
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
DataEditorX
Commits
253da578
Commit
253da578
authored
May 11, 2018
by
Yumekaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace text
parent
1b0a5bfc
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
141 additions
and
15 deletions
+141
-15
DataEditorX/Core/Mse/MseMaker.cs
DataEditorX/Core/Mse/MseMaker.cs
+95
-14
DataEditorX/DataEditForm.Designer.cs
DataEditorX/DataEditForm.Designer.cs
+12
-1
DataEditorX/DataEditForm.cs
DataEditorX/DataEditForm.cs
+32
-0
DataEditorX/data/language_chinese.txt
DataEditorX/data/language_chinese.txt
+1
-0
DataEditorX/data/language_english.txt
DataEditorX/data/language_english.txt
+1
-0
No files found.
DataEditorX/Core/Mse/MseMaker.cs
View file @
253da578
...
...
@@ -863,20 +863,101 @@ public Card[] ReadCards(string set, bool repalceOld)
}
#
endregion
#
region
test
public
void
testPendulum
(
string
desc
){
if
(
string
.
IsNullOrEmpty
(
desc
)){
public
void
testPendulum
(
string
desc
)
{
List
<
string
>
table
=
GetMPText
(
desc
);
if
(
table
==
null
&&
table
.
Count
!=
2
)
{
MessageBox
.
Show
(
"desc is null"
,
"info"
);
}
else
{
string
ptext
=
GetDesc
(
desc
,
cfg
.
regx_pendulum
);
MessageBox
.
Show
(
reItalic
(
ptext
),
"pendulum"
);
string
text
=
GetDesc
(
desc
,
cfg
.
regx_monster
);
}
else
{
MessageBox
.
Show
(
reItalic
(
table
[
0
]),
"Monster Effect"
);
MessageBox
.
Show
(
reItalic
(
table
[
1
]),
"Pendulum Effect"
);
}
}
public
List
<
string
>
GetMPText
(
string
desc
)
{
if
(
string
.
IsNullOrEmpty
(
desc
))
{
MessageBox
.
Show
(
"desc is null"
,
"info"
);
return
null
;
}
else
{
string
ptext
=
null
;
string
text
=
null
;
if
(
Regex
.
IsMatch
(
desc
,
"【灵摆】"
))
{
ptext
=
GetDesc
(
desc
,
@"\A←[ ]*\d*[ ]*【灵摆】[ ]*\d*[ ]*→[\r\n]*([\S\s]*?)[\r\n]*【"
);
text
=
GetDesc
(
desc
,
@"【[^【】\r\n]{3,}】[\r\n]*([\S\s]*?)\z"
);
}
else
{
ptext
=
GetDesc
(
desc
,
@"\A[\S\s]*?[\r\n]*【灵摆效果】[\r\n]*([\S\s]*?)\z"
);
text
=
GetDesc
(
desc
,
@"\A([\S\s]*?)[\r\n]*【灵摆效果】[\r\n]*[\S\s]*?\z"
);
}
if
(
string
.
IsNullOrEmpty
(
text
))
text
=
desc
;
MessageBox
.
Show
(
reItalic
(
text
),
"effect"
);
List
<
string
>
val
=
new
List
<
string
>();
val
.
Add
(
text
);
val
.
Add
(
ptext
);
return
val
;
}
}
public
string
ConvertPTextOld
(
string
text
,
string
ptext
,
bool
normal
,
int
pscale_l
,
int
pscale_r
)
{
string
str
=
normal
?
"【怪兽描述】"
:
"【怪兽效果】"
;
if
(
string
.
IsNullOrEmpty
(
ptext
))
return
string
.
Format
(
"←{0} 【灵摆】 {1}→\r\n{2}\r\n{3}"
,
pscale_l
,
pscale_r
,
str
,
text
);
else
return
string
.
Format
(
"←{0} 【灵摆】 {1}→\r\n{2}\r\n{3}\r\n{4}"
,
pscale_l
,
pscale_r
,
ptext
,
str
,
text
);
}
public
string
ConvertPTextNew
(
string
text
,
string
ptext
)
{
if
(
string
.
IsNullOrEmpty
(
ptext
))
return
text
;
else
return
string
.
Format
(
"{0}\r\n\r\n【灵摆效果】\r\n{1}"
,
text
,
ptext
);
}
public
string
ReplaceText
(
string
text
,
string
name
)
{
// pendulum format
if
(
Regex
.
IsMatch
(
text
,
@"【灵摆】"
))
{
List
<
string
>
table
=
GetMPText
(
text
);
if
(
table
!=
null
)
text
=
ConvertPTextNew
(
table
[
0
],
table
[
1
]);
}
// give
text
=
text
.
Replace
(
"给与"
,
"给予"
);
// set name
text
=
Regex
.
Replace
(
text
,
@"名字带有「([^「」]+)」的"
,
"「$1」"
);
if
(
Regex
.
IsMatch
(
text
,
"①"
))
{
// this card name
string
thisname
=
string
.
Format
(
"「{0}」"
,
name
);
text
=
Regex
.
Replace
(
text
,
thisname
+
@"在1回合"
,
"这个卡名的卡在1回合"
);
text
=
Regex
.
Replace
(
text
,
thisname
+
@"在决斗中"
,
"这个卡名的卡在决斗中"
);
text
=
Regex
.
Replace
(
text
,
thisname
+
@"的效果1回合"
,
"这个卡名的效果1回合"
);
text
=
Regex
.
Replace
(
text
,
thisname
+
@"的效果在决斗中"
,
"这个卡名的效果在决斗中"
);
text
=
Regex
.
Replace
(
text
,
thisname
+
@"的怪兽效果1回合"
,
"这个卡名的怪兽效果1回合"
);
text
=
Regex
.
Replace
(
text
,
thisname
+
@"的怪兽效果在决斗中"
,
"这个卡名的怪兽效果在决斗中"
);
text
=
Regex
.
Replace
(
text
,
thisname
+
@"的灵摆效果1回合"
,
"这个卡名的灵摆效果1回合"
);
text
=
Regex
.
Replace
(
text
,
thisname
+
@"的灵摆效果在决斗中"
,
"这个卡名的灵摆效果在决斗中"
);
text
=
Regex
.
Replace
(
text
,
thisname
+
@"的([①②③④⑤⑥⑦⑧⑨⑩]+)的"
,
"这个卡名的$1的"
);
text
=
Regex
.
Replace
(
text
,
thisname
+
@"的([①②③④⑤⑥⑦⑧⑨⑩]+)的"
,
"这个卡名的$1的"
);
text
=
Regex
.
Replace
(
text
,
@"作为([①②③④⑤⑥⑦⑧⑨⑩]+)的"
,
"$1的"
);
}
return
text
;
}
#
endregion
}
}
DataEditorX/DataEditForm.Designer.cs
View file @
253da578
...
...
@@ -75,6 +75,7 @@ private void InitializeComponent()
this
.
tsep1
=
new
System
.
Windows
.
Forms
.
ToolStripSeparator
();
this
.
menuitem_cancelTask
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
menuitem_autoreturn
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
menuitem_replace
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
menuitem_help
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
menuitem_about
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
menuitem_language
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
...
...
@@ -318,7 +319,9 @@ private void InitializeComponent()
this
.
menuitem_convertimage
,
this
.
tsep1
,
this
.
menuitem_cancelTask
,
this
.
menuitem_autoreturn
});
this
.
menuitem_autoreturn
,
this
.
menuitem_replace
});
this
.
menu_data
.
Name
=
"menu_data"
;
this
.
menu_data
.
Size
=
new
System
.
Drawing
.
Size
(
62
,
21
);
this
.
menu_data
.
Text
=
"Data(&T)"
;
...
...
@@ -441,6 +444,13 @@ private void InitializeComponent()
this
.
menuitem_autoreturn
.
Text
=
"*Auto return"
;
this
.
menuitem_autoreturn
.
Click
+=
new
System
.
EventHandler
(
this
.
Menuitem_autoreturnClick
);
//
// menuitem_replace
//
this
.
menuitem_replace
.
Name
=
"menuitem_replace"
;
this
.
menuitem_replace
.
Size
=
new
System
.
Drawing
.
Size
(
228
,
22
);
this
.
menuitem_replace
.
Text
=
"*Auto replace"
;
this
.
menuitem_replace
.
Click
+=
new
System
.
EventHandler
(
this
.
Menuitem_replaceClick
);
//
// menuitem_help
//
this
.
menuitem_help
.
DropDownItems
.
AddRange
(
new
System
.
Windows
.
Forms
.
ToolStripItem
[]
{
...
...
@@ -1324,6 +1334,7 @@ private void InitializeComponent()
private
System
.
Windows
.
Forms
.
ToolStripMenuItem
menuitem_export_select_sql
;
private
System
.
Windows
.
Forms
.
ToolStripMenuItem
menuitem_export_all_sql
;
private
System
.
Windows
.
Forms
.
ToolStripMenuItem
menuitem_autoreturn
;
private
System
.
Windows
.
Forms
.
ToolStripMenuItem
menuitem_replace
;
private
System
.
Windows
.
Forms
.
Label
lb_markers
;
private
DFlowLayoutPanel
pl_markers
;
private
System
.
Windows
.
Forms
.
TextBox
tb_link
;
...
...
DataEditorX/DataEditForm.cs
View file @
253da578
...
...
@@ -1784,6 +1784,38 @@ void Menuitem_autoreturnClick(object sender, EventArgs e)
}
}
void
Menuitem_replaceClick
(
object
sender
,
EventArgs
e
)
{
if
(!
CheckOpen
())
return
;
using
(
SaveFileDialog
dlg
=
new
SaveFileDialog
())
{
dlg
.
Title
=
LanguageHelper
.
GetMsg
(
LMSG
.
SelectDataBasePath
);
dlg
.
Filter
=
LanguageHelper
.
GetMsg
(
LMSG
.
CdbType
);
if
(
dlg
.
ShowDialog
()
==
DialogResult
.
OK
)
{
Card
[]
cards
=
DataBase
.
Read
(
nowCdbFile
,
true
,
""
);
int
count
=
cards
.
Length
;
if
(
cards
==
null
||
cards
.
Length
==
0
)
return
;
if
(
DataBase
.
Create
(
dlg
.
FileName
))
{
//
int
len
=
MyConfig
.
readInteger
(
MyConfig
.
TAG_AUTO_LEN
,
30
);
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
if
(
cards
[
i
].
desc
!=
null
)
{
cards
[
i
].
desc
=
tasker
.
MseHelper
.
ReplaceText
(
cards
[
i
].
desc
,
cards
[
i
].
name
);
}
}
DataBase
.
CopyDB
(
dlg
.
FileName
,
false
,
cards
);
MyMsg
.
Show
(
LMSG
.
CopyCardsToDBIsOK
);
}
}
}
}
private
void
text2LinkMarks
(
string
text
)
{
try
{
...
...
DataEditorX/data/language_chinese.txt
View file @
253da578
...
...
@@ -69,6 +69,7 @@ DataEditForm.mainMenu.menuitem_checkupdate 检查更新
DataEditForm.mainMenu.menuitem_autocheckupdate 自动检查更新
DataEditForm.mainMenu.menuitem_github 源码
DataEditForm.mainMenu.menuitem_autoreturn (特殊功能)中文自动换行
DataEditForm.mainMenu.menuitem_replace (特殊功能)批量替换文本
#
MainForm.mainMenu.menuitem_file 文件(&F)
MainForm.mainMenu.menuitem_open 打开
...
...
DataEditorX/data/language_english.txt
View file @
253da578
...
...
@@ -13,6 +13,7 @@ CodeEditForm.mainMenu.menuitem_setcard Set DataBase
CodeEditForm.mainMenu.menuitem_help Help(&H)
CodeEditForm.mainMenu.menuitem_about About
DataEditForm.mainMenu.menuitem_autoreturn (*)Text auto return
DataEditForm.mainMenu.menuitem_replace (*)...
#
DataEditForm.pl_bottom.btn_img Import Img
DataEditForm.pl_main.lb_types Card type
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment