source: EcnlProtoTool/trunk/webapp/webmrbc/Arduino/SdBlock.cs@ 273

Last change on this file since 273 was 273, checked in by coas-nagasima, 7 years ago

ソフトウェア情報を追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-csharp
File size: 11.5 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4
5namespace WebMrbc
6{
7 public class SdExistsBlock : Block
8 {
9 public const string type_name = "sd_exists";
10
11 public SdExistsBlock()
12 : base(type_name)
13 {
14 }
15
16 public void init()
17 {
18 this.appendDummyInput()
19 .appendField("ファイルが存在するかどうか調べる");
20 this.appendValueInput("FILENAME")
21 .setCheck("String");
22 this.setInputsInline(true);
23 this.setOutput(true, "Boolean");
24 this.setColour(160);
25 this.setTooltip("");
26 this.setHelpUrl("http://www.example.com/");
27 }
28 }
29
30 public class SdMkdirBlock : Block
31 {
32 public const string type_name = "sd_mkdir";
33
34 public SdMkdirBlock()
35 : base(type_name)
36 {
37 }
38
39 public void init()
40 {
41 this.appendDummyInput()
42 .appendField("ディレクトリを作成する");
43 this.appendValueInput("DIRNAME")
44 .setCheck("String");
45 this.setInputsInline(true);
46 this.setOutput(true, "Boolean");
47 this.setColour(160);
48 this.setTooltip("");
49 this.setHelpUrl("http://www.example.com/");
50 }
51 }
52
53 public class SdRemoveBlock : Block
54 {
55 public const string type_name = "sd_remove";
56
57 public SdRemoveBlock()
58 : base(type_name)
59 {
60 }
61
62 public void init()
63 {
64 this.appendDummyInput()
65 .appendField("ファイルを削除する");
66 this.appendValueInput("FILENAME")
67 .setCheck("String");
68 this.setInputsInline(true);
69 this.setOutput(true, "Boolean");
70 this.setColour(160);
71 this.setTooltip("");
72 this.setHelpUrl("http://www.example.com/");
73 }
74 }
75
76 public class SdCopyBlock : Block
77 {
78 public const string type_name = "sd_copy";
79
80 public SdCopyBlock()
81 : base(type_name)
82 {
83 }
84
85 public void init()
86 {
87 this.appendDummyInput()
88 .appendField("ファイルをコピーする");
89 this.appendValueInput("SRC_FILENAME")
90 .setCheck("String")
91 .appendField("コピー元ファイル名");
92 this.appendValueInput("DST_FILENAME")
93 .setCheck("String")
94 .appendField("コピー先ファイル名");
95 this.setInputsInline(true);
96 this.setOutput(true, "Boolean");
97 this.setColour(160);
98 this.setTooltip("");
99 this.setHelpUrl("http://www.example.com/");
100 }
101 }
102
103 public class SdRmdirBlock : Block
104 {
105 public const string type_name = "sd_rmdir";
106
107 public SdRmdirBlock()
108 : base(type_name)
109 {
110 }
111
112 public void init()
113 {
114 this.appendDummyInput()
115 .appendField("ディレクトリを削除する");
116 this.appendValueInput("DIRNAME")
117 .setCheck("String");
118 this.setInputsInline(true);
119 this.setOutput(true, "Boolean");
120 this.setColour(160);
121 this.setTooltip("");
122 this.setHelpUrl("http://www.example.com/");
123 }
124 }
125
126 public class SdOpenBlock : Block
127 {
128 public const string type_name = "sd_open";
129
130 public SdOpenBlock()
131 : base(type_name)
132 {
133 }
134
135 public void init()
136 {
137 this.appendDummyInput()
138 .appendField("ファイルをオープンします")
139 .appendField(App.TargetBoard.SdFileHandles(), "SD_FILE_NO");
140 this.appendValueInput("FILENAME")
141 .setCheck("String")
142 .appendField("ファイル名");
143 this.appendDummyInput()
144 .appendField("モード")
145 .appendField(new FieldDropdown(new[] {
146 new[] { "Read", "READ" },
147 new[] { "Append", "APPEND" },
148 new[] { "New Create", "NEW_CREATE" }
149 }), "SD_OPEN_MODE");
150 this.setInputsInline(true);
151 this.setOutput(true, "Boolean");
152 this.setColour(160);
153 this.setTooltip("");
154 this.setHelpUrl("http://www.example.com/");
155 }
156 }
157
158 public class SdCloseBlock : Block
159 {
160 public const string type_name = "sd_close";
161
162 public SdCloseBlock()
163 : base(type_name)
164 {
165 }
166
167 public void init()
168 {
169 this.appendDummyInput()
170 .appendField("ファイルをクローズします")
171 .appendField(App.TargetBoard.SdFileHandles(), "SD_FILE_NO");
172 this.setInputsInline(true);
173 this.setOutput(true, "Boolean");
174 this.setColour(160);
175 this.setTooltip("");
176 this.setHelpUrl("http://www.example.com/");
177 }
178 }
179
180 public class SdReadBlock : Block
181 {
182 public const string type_name = "sd_read";
183
184 public SdReadBlock()
185 : base(type_name)
186 {
187 }
188
189 public void init()
190 {
191 this.appendDummyInput()
192 .appendField("ファイルから1バイト読み込みます")
193 .appendField(App.TargetBoard.SdFileHandles(), "SD_FILE_NO");
194 this.setInputsInline(true);
195 this.setOutput(true, "Number");
196 this.setColour(160);
197 this.setTooltip("");
198 this.setHelpUrl("http://www.example.com/");
199 }
200 }
201
202 public class SdSeekBlock : Block
203 {
204 public const string type_name = "sd_seek";
205
206 public SdSeekBlock()
207 : base(type_name)
208 {
209 }
210
211 public void init()
212 {
213 this.appendDummyInput()
214 .appendField("ファイルの読み出し位置を移動する")
215 .appendField(App.TargetBoard.SdFileHandles(), "SD_FILE_NO");
216 this.appendValueInput("POSITION")
217 .setCheck("Number")
218 .appendField("バイト数");
219 this.setInputsInline(true);
220 this.setOutput(true, "Boolean");
221 this.setColour(160);
222 this.setTooltip("");
223 this.setHelpUrl("http://www.example.com/");
224 }
225 }
226
227 public class SdWriteBlock : Block
228 {
229 public const string type_name = "sd_write";
230
231 public SdWriteBlock()
232 : base(type_name)
233 {
234 }
235
236 public void init()
237 {
238 this.appendDummyInput()
239 .appendField("ファイルにバイナリデータを書き込む")
240 .appendField(App.TargetBoard.SdFileHandles(), "SD_FILE_NO");
241 this.appendValueInput("DATA")
242 .setCheck("String")
243 .appendField("データ");
244 this.appendValueInput("LENGTH")
245 .setCheck("Number")
246 .appendField("データサイズ");
247 this.setInputsInline(true);
248 this.setOutput(true, "Boolean");
249 this.setColour(160);
250 this.setTooltip("");
251 this.setHelpUrl("http://www.example.com/");
252 }
253 }
254
255 public class SdFlushBlock : Block
256 {
257 public const string type_name = "sd_flush";
258
259 public SdFlushBlock()
260 : base(type_name)
261 {
262 }
263
264 public void init()
265 {
266 this.appendDummyInput()
267 .appendField("ファイルの書き込みをフラッシュします")
268 .appendField(App.TargetBoard.SdFileHandles(), "SD_FILE_NO");
269 this.setPreviousStatement(true, null);
270 this.setNextStatement(true, null);
271 this.setColour(160);
272 this.setTooltip("");
273 this.setHelpUrl("http://www.example.com/");
274 }
275 }
276
277 public class SdSizeBlock : Block
278 {
279 public const string type_name = "sd_size";
280
281 public SdSizeBlock()
282 : base(type_name)
283 {
284 }
285
286 public void init()
287 {
288 this.appendDummyInput()
289 .appendField("ファイルのサイズを取得します")
290 .appendField(App.TargetBoard.SdFileHandles(), "SD_FILE_NO");
291 this.setOutput(true, "Number");
292 this.setColour(160);
293 this.setTooltip("");
294 this.setHelpUrl("http://www.example.com/");
295 }
296 }
297
298 public class SdPositionBlock : Block
299 {
300 public const string type_name = "sd_position";
301
302 public SdPositionBlock()
303 : base(type_name)
304 {
305 }
306 public void init()
307 {
308 this.appendDummyInput()
309 .appendField("ファイルのseek位置を取得します")
310 .appendField(App.TargetBoard.SdFileHandles(), "SD_FILE_NO");
311 this.setOutput(true, "Number");
312 this.setColour(160);
313 this.setTooltip("");
314 this.setHelpUrl("http://www.example.com/");
315 }
316 }
317
318 partial class Ruby
319 {
320 public node sd_exists(SdExistsBlock block)
321 {
322 var value_filename = valueToCode(block, "FILENAME");
323 var c = new const_node(this, intern("SD"));
324 var p = new node[] {
325 value_filename,
326 };
327 return new call_node(this, c, intern("exists"), p, null);
328 }
329
330 public node sd_mkdir(SdMkdirBlock block)
331 {
332 var value_filename = valueToCode(block, "DIRNAME");
333 var c = new const_node(this, intern("SD"));
334 var p = new node[] {
335 value_filename,
336 };
337 return new call_node(this, c, intern("mkdir"), p, null);
338 }
339
340 public node sd_remove(SdRemoveBlock block)
341 {
342 var value_filename = valueToCode(block, "FILENAME");
343 var c = new const_node(this, intern("SD"));
344 var p = new node[] {
345 value_filename,
346 };
347 return new call_node(this, c, intern("remove"), p, null);
348 }
349
350 public node sd_copy(SdCopyBlock block)
351 {
352 var value_src_filename = valueToCode(block, "SRC_FILENAME");
353 var value_dst_filename = valueToCode(block, "DST_FILENAME");
354 var c = new const_node(this, intern("SD"));
355 var p = new node[] {
356 value_src_filename,
357 value_dst_filename,
358 };
359 return new call_node(this, c, intern("copy"), p, null);
360 }
361
362 public node sd_rmdir(SdRmdirBlock block)
363 {
364 var value_filename = valueToCode(block, "DIRNAME");
365 var c = new const_node(this, intern("SD"));
366 var p = new node[] {
367 value_filename,
368 };
369 return new call_node(this, c, intern("rmdir"), p, null);
370 }
371
372 public node sd_open(SdOpenBlock block)
373 {
374 var dropdown_sd_file_no = block.getFieldValue("SD_FILE_NO");
375 var value_filename = valueToCode(block, "FILENAME");
376 var dropdown_sd_open_mode = block.getFieldValue("SD_OPEN_MODE");
377 var c = new const_node(this, intern("SD"));
378 var p = new node[] {
379 new int_node(this, App.TargetBoard.SdFileHandlerNameToNum(dropdown_sd_file_no)),
380 value_filename,
381 new int_node(this, App.TargetBoard.SdOpenModeNameToNum(dropdown_sd_open_mode)),
382 };
383 return new call_node(this, c, intern("open"), p, null);
384 }
385
386 public node sd_close(SdCloseBlock block)
387 {
388 var dropdown_sd_file_no = block.getFieldValue("SD_FILE_NO");
389 var c = new const_node(this, intern("SD"));
390 var p = new node[] {
391 new int_node(this, App.TargetBoard.SdFileHandlerNameToNum(dropdown_sd_file_no)),
392 };
393 return new call_node(this, c, intern("close"), p, null);
394 }
395
396 public node sd_read(SdReadBlock block)
397 {
398 var dropdown_sd_file_no = block.getFieldValue("SD_FILE_NO");
399 var c = new const_node(this, intern("SD"));
400 var p = new node[] {
401 new int_node(this, App.TargetBoard.SdFileHandlerNameToNum(dropdown_sd_file_no)),
402 };
403 return new call_node(this, c, intern("read"), p, null);
404 }
405
406 public node sd_seek(SdSeekBlock block)
407 {
408 var dropdown_sd_file_no = block.getFieldValue("SD_FILE_NO");
409 var value_position = valueToCode(block, "POSITION");
410 var c = new const_node(this, intern("SD"));
411 var p = new node[] {
412 new int_node(this, App.TargetBoard.SdFileHandlerNameToNum(dropdown_sd_file_no)),
413 value_position,
414 };
415 return new call_node(this, c, intern("seek"), p, null);
416 }
417
418 public node sd_write(SdWriteBlock block)
419 {
420 var dropdown_sd_file_no = block.getFieldValue("SD_FILE_NO");
421 var value_data = valueToCode(block, "DATA");
422 var value_length = valueToCode(block, "LENGTH");
423 var c = new const_node(this, intern("SD"));
424 var p = new node[] {
425 new int_node(this, App.TargetBoard.SdFileHandlerNameToNum(dropdown_sd_file_no)),
426 value_data,
427 value_length,
428 };
429 return new call_node(this, c, intern("write"), p, null);
430 }
431
432 public node sd_flush(SdFlushBlock block)
433 {
434 var dropdown_sd_file_no = block.getFieldValue("SD_FILE_NO");
435 var c = new const_node(this, intern("SD"));
436 var p = new node[] {
437 new int_node(this, App.TargetBoard.SdFileHandlerNameToNum(dropdown_sd_file_no)),
438 };
439 return new call_node(this, c, intern("flush"), p, null);
440 }
441
442 public node sd_size(SdSizeBlock block)
443 {
444 var dropdown_sd_file_no = block.getFieldValue("SD_FILE_NO");
445 var c = new const_node(this, intern("SD"));
446 var p = new node[] {
447 new int_node(this, App.TargetBoard.SdFileHandlerNameToNum(dropdown_sd_file_no)),
448 };
449 return new call_node(this, c, intern("size"), p, null);
450 }
451
452 public node sd_position(SdPositionBlock block)
453 {
454 var dropdown_sd_file_no = block.getFieldValue("SD_FILE_NO");
455 var c = new const_node(this, intern("SD"));
456 var p = new node[] {
457 new int_node(this, App.TargetBoard.SdFileHandlerNameToNum(dropdown_sd_file_no)),
458 };
459 return new call_node(this, c, intern("position"), p, null);
460 }
461 }
462}
Note: See TracBrowser for help on using the repository browser.