Skip to content

Commit

Permalink
fix size calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
zdimension committed Dec 25, 2019
1 parent a158de5 commit fa89704
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
22 changes: 11 additions & 11 deletions SharpBoot/Forms/MainWindow.cs
Expand Up @@ -56,7 +56,7 @@ public MainWindow()
automaticallyAddISOInfoToolStripMenuItem.Checked = Settings.Default.AutoAddInfo;
cbxBackType.SelectedIndex = 2;

SetSize();
RefreshOutputSize();
if (Utils.IsWin) UxTheme.SetWindowTheme(lvIsos.Handle, "EXPLORER", null);


Expand Down Expand Up @@ -102,10 +102,10 @@ protected override CreateParams CreateParams
}
}

public void SetSize()
public void RefreshOutputSize()
{
tbxSize.Text = Utils.GetSizeString(CurImages.Sum(x => x.SizeB) + 8787466 + DriveIO.SIZE_BASEDISK +
SelectedBackground.Length); // TODO: Update the bloader size
tbxSize.Text = Utils.GetSizeString(CurImages.Sum(x => x.SizeB) + Resources.basedisk.Length +
SelectedBackground.Length);
}


Expand Down Expand Up @@ -141,8 +141,8 @@ private void InitAfterLng()
{
Controls.Clear();
InitializeComponent();
SetSize();
centerDragndrop();
RefreshOutputSize();
lngs.Clear();
loadlng();
LoadResolutions();
Expand Down Expand Up @@ -250,7 +250,7 @@ public void AddImage(string filePath, ISOV ver = null)
typ: filePath.ToLower().EndsWith("img") ? EntryType.IMG : EntryType.ISO);
CurImages.Add(im);

SetSize();
RefreshOutputSize();


lvIsos.Rows.Add(name, Utils.GetFileSizeString(filePath), cat, desc, filePath);
Expand Down Expand Up @@ -432,7 +432,7 @@ private void btnRemISO_Click(object sender, EventArgs e)
CurImages.RemoveAll(x => x.FilePath == fp);
lvIsos.Rows.Remove(lvIsos.Rows.OfType<DataGridViewRow>().Single(x => x.Cells[4].Value.ToString() == fp));

SetSize();
RefreshOutputSize();
}

private void gbxTest_DragEnter(object sender, DragEventArgs e)
Expand Down Expand Up @@ -571,9 +571,9 @@ private void theupdate()

private void MainWindow_Load(object sender, EventArgs e)
{
SetSize();
centerDragndrop();
theupdate();
RefreshOutputSize();
}

public bool FieldsEmpty()
Expand Down Expand Up @@ -732,7 +732,7 @@ private void cbxBackType_SelectedIndexChanged(object sender, EventArgs e)
txtBackFile.Enabled = btnBackBrowse.Enabled = cbxBackType.SelectedIndex == 1;
if (cbxBackType.SelectedIndex != 1) txtBackFile.Text = "";
CheckFields();
SetSize();
RefreshOutputSize();
}

private void lvIsos_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
Expand Down Expand Up @@ -801,7 +801,7 @@ private void btnCustomEntry_Click(object sender, EventArgs e)
var im = new ImageLine(Path.GetFileNameWithoutExtension(entryfrm.FilePath), entryfrm.FilePath, "", "",
"", entryfrm.SelectedType);
CurImages.Add(im);
SetSize();
RefreshOutputSize();
lvIsos.Rows.Add(im.Name, Utils.GetFileSizeString(entryfrm.FilePath), "", "", entryfrm.FilePath);
}
}
Expand All @@ -821,7 +821,7 @@ private void LoadResolutions()

private void txtBackFile_TextChanged(object sender, EventArgs e)
{
SetSize();
RefreshOutputSize();
}

private void editThemeToolStripMenuItem_Click(object sender, EventArgs e)
Expand Down
1 change: 0 additions & 1 deletion SharpBoot/Utilities/DriveIO.cs
Expand Up @@ -13,7 +13,6 @@ namespace SharpBoot.Utilities
{
public static class DriveIO
{
public const long SIZE_BASEDISK = 0;
public const int FILE_ATTRIBUTE_SYSTEM = 0x4;
public const int FILE_FLAG_SEQUENTIAL_SCAN = 0x8;
public const int FILE_FLAG_NO_BUFFERING = 0x20000000;
Expand Down

0 comments on commit fa89704

Please sign in to comment.