質問編集履歴

1

ソースコードの添付

2020/05/25 22:58

投稿

montai21
montai21

スコア15

test CHANGED
File without changes
test CHANGED
@@ -6,62 +6,254 @@
6
6
 
7
7
  #アドバイスいただきたいこと
8
8
 
9
- 事象に挙げた内容を踏まえ、強制ログオフが起きないようにしつつ、ダウンロード処理を行うにはどのようにすればよいでしょうか?
10
-
11
- ダウンロード処理にファイル共有し、コピーを行っているのですが、ftpダウンロードの方が負荷が少ないでしょうか?
12
-
13
-
14
-
15
- #コンソールログ
16
-
17
- ```
18
-
19
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'item' not found. Available parameters are [collection, list]
20
-
21
- ```
22
-
23
-
24
-
25
- #xml
26
-
27
- ```
28
-
29
- <delete id="deleteById" parameterType="list">
30
-
31
- <![CDATA[
32
-
33
- DELETE FROM
34
-
35
- tbl_schedule
36
-
37
- WHERE task_id IN
38
-
39
- <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
40
-
41
- #{item}
42
-
43
- </foreach>
44
-
45
- ]]>
46
-
47
- </delete>
48
-
49
- ```
50
-
51
-
52
-
53
- #Java
54
-
55
- ```
56
-
57
- void deleteById(List<String> taskIdList);
58
-
59
- ```
60
-
61
-
62
-
63
- ##参考にしたサイト
64
-
65
- ・[https://mybatis.org/mybatis-3/ja/dynamic-sql.html](https://mybatis.org/mybatis-3/ja/dynamic-sql.html)
66
-
67
- ・[https://qiita.com/5zm/items/0864d6641c65f976d415](https://qiita.com/5zm/items/0864d6641c65f976d415)
9
+ 0. 事象に挙げた内容を踏まえ、強制ログオフが起きないようにしつつ、ダウンロード処理を行うにはどのようにすればよいでしょうか?
10
+
11
+ 0. ダウンロード処理にファイル共有し、コピーを行っているのですが、ftpダウンロードの方が負荷が少ないでしょうか?
12
+
13
+ 0. タイマースレッドを用いて、マウスイベントを定期的に出力しているのですが、以下のコードの書き方があまりよくないのでしょうか。
14
+
15
+
16
+
17
+ #Form
18
+
19
+ ```
20
+
21
+ using System;
22
+
23
+ using System.Diagnostics;
24
+
25
+ using System.IO;
26
+
27
+ using System.Windows.Forms;
28
+
29
+
30
+
31
+ namespace AidleStatusDisableApp
32
+
33
+ {
34
+
35
+ public partial class Form1 : Form
36
+
37
+ {
38
+
39
+ public Form1()
40
+
41
+ {
42
+
43
+ InitializeComponent();
44
+
45
+ }
46
+
47
+
48
+
49
+ private void button1_Click(object sender, EventArgs e)
50
+
51
+ {
52
+
53
+ const string commandMount = @"/c net use \servername\kyouyu password /user:user /PERSISTENT:NO";
54
+
55
+ ExecuteCommand(commandMount);
56
+
57
+ CopyFiles(@".\test.txt", @"\servername\kyouyu\testbigfile");
58
+
59
+ }
60
+
61
+
62
+
63
+ private void button2_Click(object sender, EventArgs e)
64
+
65
+ {
66
+
67
+
68
+
69
+ }
70
+
71
+
72
+
73
+ public void ExecuteCommand(string command)
74
+
75
+ {
76
+
77
+ using (var p = new Process())
78
+
79
+ {
80
+
81
+ //ComSpec(cmd.exe)のパスを取得して、FileNameプロパティに指定
82
+
83
+ p.StartInfo.FileName = System.Environment.GetEnvironmentVariable("ComSpec");
84
+
85
+ ////ウィンドウを表示しないようにする
86
+
87
+ p.StartInfo.CreateNoWindow = true;
88
+
89
+ //コマンドラインを指定("/c"は実行後閉じるために必要)
90
+
91
+ p.StartInfo.Arguments = command;
92
+
93
+ //起動
94
+
95
+ p.Start();
96
+
97
+ p.WaitForExit();
98
+
99
+ }
100
+
101
+ }
102
+
103
+
104
+
105
+ public void CopyFiles(string srcfile, string dstfile)
106
+
107
+ {
108
+
109
+ File.AppendAllText(@".\log.txt", "コピーを開始します。" + DateTime.Now + Environment.NewLine);
110
+
111
+ System.IO.File.Copy(srcfile, dstfile, true);
112
+
113
+ File.AppendAllText(@".\log.txt", "コピーを終了します。" + DateTime.Now + Environment.NewLine);
114
+
115
+ }
116
+
117
+ }
118
+
119
+ }
120
+
121
+
122
+
123
+ ```
124
+
125
+
126
+
127
+ #Program
128
+
129
+ ```
130
+
131
+ using System;
132
+
133
+ using System.Runtime.InteropServices;
134
+
135
+ using System.Threading;
136
+
137
+ using System.Windows.Forms;
138
+
139
+ using System.Threading.Timer
140
+
141
+
142
+
143
+ namespace AidleStatusDisableApp
144
+
145
+ {
146
+
147
+ public static class Program
148
+
149
+ {
150
+
151
+ const int MOUSEEVENTF_MOVED = 0x0001;
152
+
153
+ [STAThread]
154
+
155
+ public static void Main()
156
+
157
+ {
158
+
159
+ TimerCallback callback = state =>
160
+
161
+ {
162
+
163
+ INPUT[] input = new INPUT[1]; // イベントを格納
164
+
165
+ // ドラッグ操作の準備 (イベントの定義 = 相対座標へ移動)
166
+
167
+ input[0].mi.dx = 0; // 相対座標で0 つまり動かさない
168
+
169
+ input[0].mi.dy = 0; // 相対座標で0 つまり動かさない
170
+
171
+ input[0].mi.dwFlags = MOUSEEVENTF_MOVED;
172
+
173
+ // ドラッグ操作の実行 (イベントの生成)
174
+
175
+ SendInput(1, input, Marshal.SizeOf(input[0]));
176
+
177
+ };
178
+
179
+
180
+
181
+ // タイマー起動(0.5秒後に処理実行、1秒おきに繰り返し)
182
+
183
+ Timer MyTimer = new System.Threading.Timer(callback, null, 500, 1000);
184
+
185
+ Application.EnableVisualStyles();
186
+
187
+ Application.SetCompatibleTextRenderingDefault(false);
188
+
189
+ Application.Run(new Form1());
190
+
191
+
192
+
193
+ }
194
+
195
+
196
+
197
+ [DllImport("user32.dll")]
198
+
199
+ extern static uint SendInput(
200
+
201
+ uint nInputs, // INPUT 構造体の数(イベント数)
202
+
203
+ INPUT[] pInputs, // INPUT 構造体
204
+
205
+ int cbSize // INPUT 構造体のサイズ
206
+
207
+ );
208
+
209
+
210
+
211
+ [StructLayout(LayoutKind.Sequential)]
212
+
213
+ struct INPUT
214
+
215
+ {
216
+
217
+ public int type; // 0 = INPUT_MOUSE(デフォルト), 1 = INPUT_KEYBOARD
218
+
219
+ public MOUSEINPUT mi;
220
+
221
+ }
222
+
223
+ [StructLayout(LayoutKind.Sequential)]
224
+
225
+ struct MOUSEINPUT
226
+
227
+ {
228
+
229
+ public int dx;
230
+
231
+ public int dy;
232
+
233
+ public int mouseData; // amount of wheel movement
234
+
235
+ public int dwFlags;
236
+
237
+ public int time; // time stamp for the event
238
+
239
+ public IntPtr dwExtraInfo;
240
+
241
+ }
242
+
243
+ }
244
+
245
+ }
246
+
247
+
248
+
249
+ ```
250
+
251
+
252
+
253
+
254
+
255
+ ##環境
256
+
257
+ .Net Framework 4.6
258
+
259
+ Windows 10