Skip to content

Commit

Permalink
Add units - v1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
valfr committed Aug 10, 2018
1 parent bbbf1ee commit 386c1e7
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 3 deletions.
25 changes: 25 additions & 0 deletions vRaid/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 44 additions & 3 deletions vRaid/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public Form1()
disksSize = 0;
labelArraySize.Text = "";
labelUsableSpace.Text = "";
sizeUnit.Text = "";
}

void raidCalcul()
Expand All @@ -43,18 +44,58 @@ void raidCalcul()
{
if(disksCount >=3)
{
int t = (disksCount-1) * disksSize;
decimal t = (disksCount-1) * disksSize;
float tt = (float)t / (float)1.073741824;
decimal ttt = Math.Round((Decimal)tt, 2, MidpointRounding.AwayFromZero);
// UNIT pre-converter
if(t > 1000 && ttt > 1000)
{
t = t / 1000;
ttt = ttt / 1000;
}
labelArraySize.Text = t.ToString();
labelUsableSpace.Text = ttt.ToString();
labelUsableSpace.Text = Math.Round(ttt, 2, MidpointRounding.AwayFromZero).ToString();
}
else
{
labelArraySize.Text = "Raid 5 minimum disks are 3";
}
}


detectUnit();
}
}

void detectUnit()
{
// des GO ?
if(disksSize.ToString().Length == 3)
{
sizeUnit.Text = "Go";
if (labelArraySize.Text.Length > 3)
{
labelArraySize.Text += " To";
labelUsableSpace.Text += " To";
}
else
{
labelArraySize.Text += " Go";
labelUsableSpace.Text += " Go";
}
}
// des TB (full longueur)
else if (disksSize.ToString().Length == 4)
{
sizeUnit.Text = "Go";
labelArraySize.Text += " To";
labelUsableSpace.Text += " To";
}
// des TB (petite longueur)
else if (disksSize.ToString().Length == 1)
{
sizeUnit.Text = "To";
labelArraySize.Text += " To";
labelUsableSpace.Text += " To";
}
}

Expand Down
Binary file modified vRaid/bin/Release/vRaid.exe
Binary file not shown.
Binary file modified vRaid/bin/Release/vRaid.pdb
Binary file not shown.
Binary file added vRaid/bin/Release/vRaid.zip
Binary file not shown.
Binary file modified vRaid/obj/Release/vRaid.csproj.GenerateResource.cache
Binary file not shown.
Binary file modified vRaid/obj/Release/vRaid.exe
Binary file not shown.
Binary file modified vRaid/obj/Release/vRaid.pdb
Binary file not shown.

0 comments on commit 386c1e7

Please sign in to comment.