Repository navigation
Expand file tree
/
Copy pathStatus.cs
More file actions
51 lines (43 loc) · 2.36 KB
/
Copy pathStatus.cs
File metadata and controls
51 lines (43 loc) · 2.36 KB
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Trax {
internal static class Status {
private const int k = 1024;
private const int M = 1024 * 1024;
private const int G = 1024 * 1024 * 1024;
private static string DynamicSize(int size) {
if (size < k) return size.ToString() + "B";
if (size < M) return Math.Round(size / (double)k, 3).ToString() + "kB";
if (size < G) return Math.Round(size / (double)M, 3).ToString() + "MB";
return Math.Round(size / (double)G, 3).ToString() + "GB";
}
internal static Main Main;
internal static string FileName { set { Main.Text = String.IsNullOrEmpty(value) ? Application.ProductName : String.Format("{0} :: {1}", value, Application.ProductName); } }
internal static int FileSize { set { Main.SizeLabel.Text = DynamicSize(value); } }
internal static int FileLines { set { Main.LinesLabel.Text = String.Format("{0} {1}", value, Messages.LinesUnit); } }
internal static EditorFile.Types FileType { set { Main.TypeLabel.Text = value.ToString(); } }
internal static string Text { set { Main.StatusLabel.Text = value; } }
internal static int Line { set { Main.LineLabel.Text = String.Format("{0} {1}", Messages.LineSymbol, value); } }
internal static int Column { set { Main.ColumnLabel.Text = String.Format("{0} {1}", Messages.ColumnSymbol, value); } }
internal static int Selection { set { Main.SelectionLabel.Text = String.Format("{0} {1}", Messages.SelectionSymbol, value); } }
internal static bool Replace { set { Main.ReplaceLabel.Text = value ? Messages.ReplaceSymbol : Messages.InsertSymbol; } }
internal static bool Visible {
set {
Main.SizeLabel.Visible
= Main.SlashLabel.Visible
= Main.LinesLabel.Visible
= Main.TypeLabel.Visible
= Main.LineLabel.Visible
= Main.LineLabel.Visible
= Main.ColumnLabel.Visible
= Main.SelectionLabel.Visible
= Main.ReplaceLabel.Visible = value;
Main.StatusLabel.Text = value ? Messages.Ready : Messages.Ready1;
}
}
}
}