-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.uka
169 lines (127 loc) · 3.77 KB
/
main.uka
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
//pluginのエラーは通知が起きない。
version {
"origin/1.0"
}
OnPluginLoad.Self {
}
OnPluginUnload.Self {
}
//テスト用メニューでも作るか。
//"\![raiseplugin,DBdiary,OnCallInputBeautifulDiary,before_text,after_text]"
//"\![raiseplugin,DBdiary,OnCallInputDirtyDiary,before_text,after_text]"
//"\![raiseplugin,DBdiary,OnGetBeautifulDiary,yyyymmdd,before_text,after_text,notWrite,notExist]"
//お前今日日記書いたん?
//"\![raiseplugin,DBdiary,OnCheckWrittenDiary]"
//OnRecieveCheckWrittenDiary {
// reference[0]
//}
OnCheckWrittenDiary {
_res = ""
_LocalDay = "%(day)"
if ( TOINT(_LocalDay) < 10 ) {
_LocalDay = "0" + TOSTR(_LocalDay)
}
_LocalMonth = "%(month)"
if ( TOINT(_LocalMonth) < 10 ) {
_LocalMonth = "0" + TOSTR(_LocalMonth)
}
_FileName = "./Diary/" + "%(year)%(_LocalMonth)%(_LocalDay)" + ".txt"
//テキストが存在する。
//空ではない。
FCHARSET( "UTF-8" )
_devnull = FOPEN( _FileName , "r" )
if ( _devnull == "0" ) {
//日記が存在しないよ
_res = "notExist"
} else {
_DiaryText = FREAD( _FileName )
FCLOSE( _FileName )
if ( _DiaryText == "-1" || _DiaryText == "" ) {
//"何も書いてないよ。"
_res = "notWrite"
} else {
_res = _DiaryText
}
}
res_event = 'OnRecieveCheckWrittenDiary'
res_reference[0] = _res
}
//保存先を取得して消すときのサポートを
OnMenuExec {
}
//日記テキスト入力用。
OnCallInputBeautifulDiary {
_before = reference[0]
_after = reference[1]
_text = _before + "\![open,inputbox,OnInputBeautifulDiary]" + _after
_text
}
OnCallInputDirtyDiary {
_before = reference[0]
_after = reference[1]
_text = _before + "\![open,inputbox,OnInputDirtyDiary]" + _after
_text
}
//日記内容取得用。
OnGetBeautifulDiary {
_Day = reference[0]
_before = reference[1]
_after = reference[2]
_notWrite = reference[3]
_notExist = reference[4]
//読み込めなかった場合どうしようか。
_FileName = "./Diary/" + TOSTR( _Day ) + ".txt"
FCHARSET( "UTF-8" )
_devnull = FOPEN( _FileName , "r" )
if ( _devnull == "0" ) {
//日記が存在しないよ
_aa = _notExist + _FileName
_aa
} else {
_DiaryText = FREAD( _FileName )
FCLOSE( _FileName )
if ( _DiaryText == "-1" || _DiaryText == "" ) {
//"何も書いてないよ。"
_notWrite
} else {
_text = _before + _DiaryText + _after
_text
}
}
}
OnInputBeautifulDiary {
_str = TOSTR( reference[0] )
if ( _str != "" ) {
_LocalDay = "%(day)"
if ( TOINT(_LocalDay) < 10 ) {
_LocalDay = "0" + TOSTR(_LocalDay)
}
_LocalMonth = "%(month)"
if ( TOINT(_LocalMonth) < 10 ) {
_LocalMonth = "0" + TOSTR(_LocalMonth)
}
_FileName = "./Diary/" + "%(year)%(_LocalMonth)%(_LocalDay)" + ".txt"
FCHARSET( "UTF-8" )
_devnull = FOPEN( _FileName , "a" )
FWRITE( _FileName , _str )
FCLOSE( _FileName )
}
}
OnInputDirtyDiary {
_str = TOSTR( reference[0] )
if ( _str != "" ) {
_LocalDay = "%(day)"
if ( TOINT(_LocalDay) < 10 ) {
_LocalDay = "0" + TOSTR(_LocalDay)
}
_LocalMonth = "%(month)"
if ( TOINT(_LocalMonth) < 10 ) {
_LocalMonth = "0" + TOSTR(_LocalMonth)
}
_FileName = "./Diary/" + "%(year)%(_LocalMonth)%(_LocalDay)" + _str + ".txt"
FCHARSET( "UTF-8" )
_devnull = FOPEN( _FileName , "a" )
FWRITE( _FileName , "Dirty Diary" )
FCLOSE( _FileName )
}
}