on dragEnter
set the acceptDrop to true
end dragEnter
on dragDrop
put dragData["files"] into tPath
put base64decode(url("binfile:/" & tPath)) into tData
if the target is "field " & quote & "heibunText" & quote and \
char 1 to 7 of tData is not "Salted_" then
put textdecode(url ("binfile:/" & tPath), "utf-8") into fld "heibunText"
else
if the target is "field " & quote & "angoText" & quote and \
char 1 to 7 of tData is "Salted_" then
put tData into fld "angoText"
exit to top
end if
else
beep
exit to top
end if
end dragDrop
on closeCard
-- btn "putEmpty"は ボタン「すべて空白」
send mouseUp to btn "putEmpty"
end closeCard
-- 検索のためのコマンド
on findTtext
put the text of fld "tFind" into tString
find string tString in fld "heibunText"
if the result is "not found" then
beep
set the hilitedLine of fld "heibunText" to 0
end if
end findTtext
ボタン「暗号文に変換」
on mouseUp
if the num of chars of fld "openPass" < 8 then
beep
answer "パスワードは8文字以上です"
exit to top
else
put fld "openPass" into tKey
end if
put base64Encode(the unicodeText of fld "heibunText") into tData
encrypt tData using "blowfish" with tkey at "128" bit
if the result is not empty then
beep
answer "トラブルが発生しました。暗号化できません。"
put false into gAnotherPass
exit to top
else
put it into fld "angoText"
end if
end mouseUp
ボタン「暗号文を平文に」
on mouseUp
if the num of chars of fld "openPass" < 8 then
beep
answer "パスワードは8文字以上です"
exit to top
else
put fld "openPass" into tKey
end if
put fld "angoText" into tAngobun
decrypt tAngobun using "blowfish" with tkey at "128" bit
if the result is not empty then
beep
answer "トラブルが発生しました。暗号化できません。"
put false into gAnotherPass
exit to top
else
put unidecode(base64Decode(it)) into fld "heibunText"
end if
end mouseUp
ボタン「Save 暗号」
on mouseUp
ask file "Save 暗号File:" with "ango.txt"
if it is not "" then
put base64Encode(fld "angoText") into url("binfile:" & it)
end if
end mouseUp
ボタン「すべて空白」
on mouseUp
put "" into fld "heibunText"
put "" into fld "angoText"
put "" into fld "openPass"
put "" into fld "tFind"
end mouseUp
フィールド「tFind」
on returnInField
findTtext
end returnInField
on enterInField
returnInField
end enterInField