@@ -151,38 +151,43 @@ private void SetUpNumberWithFraction()
151
151
{
152
152
numberFormat = Resources . numberformatN6 ;
153
153
}
154
+ return ;
154
155
}
155
- else
156
+ if ( toolStripMenuItemDecimalSeparatorTo0 . Checked )
156
157
{
157
- if ( toolStripMenuItemDecimalSeparatorTo0 . Checked )
158
- {
159
- numberFormat = Resources . numberformatF0 ;
160
- }
161
- else if ( toolStripMenuItemDecimalSeparatorTo1 . Checked )
162
- {
163
- numberFormat = Resources . numberformatF1 ;
164
- }
165
- else if ( toolStripMenuItemDecimalSeparatorTo2 . Checked )
166
- {
167
- numberFormat = Resources . numberformatF2 ;
168
- }
169
- else if ( toolStripMenuItemDecimalSeparatorTo3 . Checked )
170
- {
171
- numberFormat = Resources . numberformatF3 ;
172
- }
173
- else if ( toolStripMenuItemDecimalSeparatorTo4 . Checked )
174
- {
175
- numberFormat = Resources . numberformatF4 ;
176
- }
177
- else if ( toolStripMenuItemDecimalSeparatorTo5 . Checked )
178
- {
179
- numberFormat = Resources . numberformatF5 ;
180
- }
181
- else if ( toolStripMenuItemDecimalSeparatorTo6 . Checked )
182
- {
183
- numberFormat = Resources . numberformatF6 ;
184
- }
158
+ numberFormat = Resources . numberformatF0 ;
159
+ return ;
160
+ }
161
+ if ( toolStripMenuItemDecimalSeparatorTo1 . Checked )
162
+ {
163
+ numberFormat = Resources . numberformatF1 ;
164
+ return ;
185
165
}
166
+ if ( toolStripMenuItemDecimalSeparatorTo2 . Checked )
167
+ {
168
+ numberFormat = Resources . numberformatF2 ;
169
+ return ;
170
+ }
171
+ if ( toolStripMenuItemDecimalSeparatorTo3 . Checked )
172
+ {
173
+ numberFormat = Resources . numberformatF3 ;
174
+ return ;
175
+ }
176
+ if ( toolStripMenuItemDecimalSeparatorTo4 . Checked )
177
+ {
178
+ numberFormat = Resources . numberformatF4 ;
179
+ return ;
180
+ }
181
+ if ( toolStripMenuItemDecimalSeparatorTo5 . Checked )
182
+ {
183
+ numberFormat = Resources . numberformatF5 ;
184
+ return ;
185
+ }
186
+ if ( ! toolStripMenuItemDecimalSeparatorTo6 . Checked )
187
+ {
188
+ return ;
189
+ }
190
+ numberFormat = Resources . numberformatF6 ;
186
191
}
187
192
188
193
/// <summary>
@@ -215,77 +220,32 @@ private void UpdateSpaceInfo()
215
220
{
216
221
case ( int ) SizeUnit . Kilobyte :
217
222
usedSpace /= 1024 ;
218
- break ;
219
- case ( int ) SizeUnit . Megabyte :
220
- usedSpace = usedSpace / 1024 / 1024 ;
221
- break ;
222
- case ( int ) SizeUnit . Gigabyte :
223
- usedSpace = usedSpace / 1024 / 1024 / 1024 ;
224
- break ;
225
- case ( int ) SizeUnit . Terabyte :
226
- usedSpace = usedSpace / 1024 / 1024 / 1024 / 1024 ;
227
- break ;
228
- case ( int ) SizeUnit . Pentabyte :
229
- usedSpace = usedSpace / 1024 / 1024 / 1024 / 1024 / 1024 ;
230
- break ;
231
- default :
232
- break ;
233
- }
234
- switch ( unitSpace )
235
- {
236
- case ( int ) SizeUnit . Kilobyte :
223
+ totalSpace /= 1024 ;
237
224
freeSpace /= 1024 ;
225
+ diffSpace /= 1024 ;
238
226
break ;
239
227
case ( int ) SizeUnit . Megabyte :
228
+ usedSpace = usedSpace / 1024 / 1024 ;
240
229
freeSpace = freeSpace / 1024 / 1024 ;
241
- break ;
242
- case ( int ) SizeUnit . Gigabyte :
243
- freeSpace = freeSpace / 1024 / 1024 / 1024 ;
244
- break ;
245
- case ( int ) SizeUnit . Terabyte :
246
- freeSpace = freeSpace / 1024 / 1024 / 1024 / 1024 ;
247
- break ;
248
- case ( int ) SizeUnit . Pentabyte :
249
- freeSpace = freeSpace / 1024 / 1024 / 1024 / 1024 / 1024 ;
250
- break ;
251
- default :
252
- break ;
253
- }
254
- switch ( unitSpace )
255
- {
256
- case ( int ) SizeUnit . Kilobyte :
257
- totalSpace /= 1024 ;
258
- break ;
259
- case ( int ) SizeUnit . Megabyte :
260
230
totalSpace = totalSpace / 1024 / 1024 ;
261
- break ;
262
- case ( int ) SizeUnit . Gigabyte :
263
- totalSpace = totalSpace / 1024 / 1024 / 1024 ;
264
- break ;
265
- case ( int ) SizeUnit . Terabyte :
266
- totalSpace = totalSpace / 1024 / 1024 / 1024 / 1024 ;
267
- break ;
268
- case ( int ) SizeUnit . Pentabyte :
269
- totalSpace = totalSpace / 1024 / 1024 / 1024 / 1024 / 1024 ;
270
- break ;
271
- default :
272
- break ;
273
- }
274
- switch ( unitSpace )
275
- {
276
- case ( int ) SizeUnit . Kilobyte :
277
- diffSpace /= 1024 ;
278
- break ;
279
- case ( int ) SizeUnit . Megabyte :
280
231
diffSpace = diffSpace / 1024 / 1024 ;
281
232
break ;
282
233
case ( int ) SizeUnit . Gigabyte :
234
+ usedSpace = usedSpace / 1024 / 1024 / 1024 ;
235
+ freeSpace = freeSpace / 1024 / 1024 / 1024 ;
236
+ totalSpace = totalSpace / 1024 / 1024 / 1024 ;
283
237
diffSpace = diffSpace / 1024 / 1024 / 1024 ;
284
238
break ;
285
239
case ( int ) SizeUnit . Terabyte :
240
+ usedSpace = usedSpace / 1024 / 1024 / 1024 / 1024 ;
241
+ freeSpace = freeSpace / 1024 / 1024 / 1024 / 1024 ;
242
+ totalSpace = totalSpace / 1024 / 1024 / 1024 / 1024 ;
286
243
diffSpace = diffSpace / 1024 / 1024 / 1024 / 1024 ;
287
244
break ;
288
245
case ( int ) SizeUnit . Pentabyte :
246
+ usedSpace = usedSpace / 1024 / 1024 / 1024 / 1024 / 1024 ;
247
+ freeSpace = freeSpace / 1024 / 1024 / 1024 / 1024 / 1024 ;
248
+ totalSpace = totalSpace / 1024 / 1024 / 1024 / 1024 / 1024 ;
289
249
diffSpace = diffSpace / 1024 / 1024 / 1024 / 1024 / 1024 ;
290
250
break ;
291
251
default :
@@ -295,7 +255,7 @@ private void UpdateSpaceInfo()
295
255
usedSpacePerc = 100 - freeSpacePerc ;
296
256
progressBarPercentage . Value = ( int ) usedSpacePerc ;
297
257
numberFormat = Resources . numberformatG6 ;
298
- labelSpacePercentageValue . Text = $ "{ usedSpacePerc . ToString ( format : numberFormat , provider : CultureInfo . InvariantCulture ) } %";
258
+ labelSpacePercentageValue . Text = $ "{ usedSpacePerc . ToString ( format : numberFormat , provider : CultureInfo . CurrentCulture ) } %";
299
259
numberFormat = string . Empty ;
300
260
if ( HasFraction ( number : usedSpace ) )
301
261
{
@@ -305,7 +265,7 @@ private void UpdateSpaceInfo()
305
265
{
306
266
SetUpNumberWithoutFraction ( ) ;
307
267
}
308
- textBoxSpaceUsed . Text = usedSpace . ToString ( format : numberFormat , provider : CultureInfo . InvariantCulture ) ;
268
+ textBoxSpaceUsed . Text = usedSpace . ToString ( format : numberFormat , provider : CultureInfo . CurrentCulture ) ;
309
269
numberFormat = string . Empty ;
310
270
if ( HasFraction ( number : freeSpace ) )
311
271
{
@@ -315,7 +275,7 @@ private void UpdateSpaceInfo()
315
275
{
316
276
SetUpNumberWithoutFraction ( ) ;
317
277
}
318
- textBoxSpaceFree . Text = freeSpace . ToString ( format : numberFormat , provider : CultureInfo . InvariantCulture ) ;
278
+ textBoxSpaceFree . Text = freeSpace . ToString ( format : numberFormat , provider : CultureInfo . CurrentCulture ) ;
319
279
numberFormat = string . Empty ;
320
280
if ( HasFraction ( number : totalSpace ) )
321
281
{
@@ -325,9 +285,7 @@ private void UpdateSpaceInfo()
325
285
{
326
286
SetUpNumberWithoutFraction ( ) ;
327
287
}
328
- textBoxSpaceTotal . Text = totalSpace . ToString (
329
- format : numberFormat ,
330
- provider : CultureInfo . InvariantCulture ) ;
288
+ textBoxSpaceTotal . Text = totalSpace . ToString ( format : numberFormat , provider : CultureInfo . CurrentCulture ) ;
331
289
numberFormat = string . Empty ;
332
290
if ( HasFraction ( number : diffSpace ) )
333
291
{
@@ -359,7 +317,7 @@ private void UpdateSpaceInfo()
359
317
break ;
360
318
}
361
319
textBoxSpaceDiff . Text = Math . Abs ( diffSpace - usedSpace )
362
- . ToString ( format : numberFormat , provider : CultureInfo . InvariantCulture ) ;
320
+ . ToString ( format : numberFormat , provider : CultureInfo . CurrentCulture ) ;
363
321
}
364
322
}
365
323
#endregion
@@ -386,7 +344,7 @@ private void MainForm_Load(object sender, EventArgs e)
386
344
notifyIcon . Visible = false ;
387
345
if ( drive . IsReady )
388
346
{
389
- textBoxSpaceTotal . Text = drive . TotalSize . ToString ( provider : CultureInfo . InvariantCulture ) ;
347
+ textBoxSpaceTotal . Text = drive . TotalSize . ToString ( provider : CultureInfo . CurrentCulture ) ;
390
348
fileSystemWatcher . Path = drive . Name ;
391
349
}
392
350
}
0 commit comments