Skip to content

Commit

Permalink
Complete rework of file handling
Browse files Browse the repository at this point in the history
Bugfixes, lots of bugfixes......
  • Loading branch information
t0815 committed Oct 29, 2023
1 parent 1cfaa65 commit 277ed96
Show file tree
Hide file tree
Showing 13 changed files with 245 additions and 199 deletions.
2 changes: 1 addition & 1 deletion MyCBZ/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<applicationSettings>
<Win_CBZ.Win_CBZSettings>
<setting name="Version" serializeAs="String">
<value>0.13.65b</value>
<value>0.13.66b</value>
</setting>
<setting name="RenamerPlaceholders" serializeAs="Xml">
<value>
Expand Down
6 changes: 3 additions & 3 deletions MyCBZ/Forms/ImagePreviewForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public ImagePreviewForm(Page page)
{
currentIndex = page.Index;
currentId = page.Id;
if (page.LocalPath == null)
if (page.LocalFile == null)
{
page.LocalPath = Program.ProjectModel.RequestTemporaryFile(page);
page.LocalFile = new LocalFile(Program.ProjectModel.RequestTemporaryFile(page));
}

PageImagePreview.ImageLocation = page.LocalPath;
PageImagePreview.ImageLocation = page.LocalFile.FullPath;

}
catch (Exception e)
Expand Down
198 changes: 99 additions & 99 deletions MyCBZ/Forms/MainForm.Designer.cs

Large diffs are not rendered by default.

41 changes: 26 additions & 15 deletions MyCBZ/Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -319,22 +319,31 @@ private void PageChanged(object sender, PageChangedEvent e)
if (e.OldValue != null)
{
int backupIndex = -1;
if (ComboBoxApplyPageAdjustmentsTo.Items.IndexOf(((Page)e.OldValue).Name) > -1)
string backupName = "";
if (e.OldValue != null && ComboBoxApplyPageAdjustmentsTo.Items.IndexOf(((Page)e.OldValue).Name) > -1)
{
if (ComboBoxApplyPageAdjustmentsTo.Items.IndexOf(e.Page.Name) > -1)
try
{
backupIndex = ComboBoxApplyPageAdjustmentsTo.Items.IndexOf(e.Page.Name);
string backupName = ComboBoxApplyPageAdjustmentsTo.Items[backupIndex].ToString();

ComboBoxApplyPageAdjustmentsTo.Items[backupIndex] = Program.ProjectModel.MakeNewRandomId();
}

ComboBoxApplyPageAdjustmentsTo.Items[ComboBoxApplyPageAdjustmentsTo.Items.IndexOf(((Page)e.OldValue).Name)] = e.Page.Name;

if (backupIndex > -1)
/*
if (ComboBoxApplyPageAdjustmentsTo.Items.IndexOf(e.Page.Name) > -1)
{
backupIndex = ComboBoxApplyPageAdjustmentsTo.Items.IndexOf(((Page)e.OldValue).Name);
backupName = ComboBoxApplyPageAdjustmentsTo.Items[backupIndex].ToString();
ComboBoxApplyPageAdjustmentsTo.Items[backupIndex] = Program.ProjectModel.MakeNewRandomId();
}
*/

ComboBoxApplyPageAdjustmentsTo.Items[ComboBoxApplyPageAdjustmentsTo.Items.IndexOf(((Page)e.OldValue).Name)] = e.Page.Name;

//if (backupIndex > -1)
//{
// ComboBoxApplyPageAdjustmentsTo.Items[backupIndex] = backupName;
//
//}
} catch (Exception ex)
{
ComboBoxApplyPageAdjustmentsTo.Items[backupIndex] = ((Page)e.OldValue).Name;

//ApplicationMessage.ShowException(ex);
}
}
}
Expand Down Expand Up @@ -1510,6 +1519,8 @@ private void DisableControllsForArchiveState(ProjectModel project, int state)
LabelW.Text = "0";
LabelH.Text = "0";
CurrentGlobalActions.Clear();
ComboBoxApplyPageAdjustmentsTo.Items.Clear();
ComboBoxApplyPageAdjustmentsTo.Items.Add("<Global>");
//MessageLogListView.Items.Clear();
//MessageLogger.Instance.Log(LogMessageEvent.LOGMESSAGE_TYPE_INFO, "Archive [" + project.FileName + "] closed");
//MessageLogger.Instance.Log(LogMessageEvent.LOGMESSAGE_TYPE_INFO, "--- **** ---");
Expand Down Expand Up @@ -1991,10 +2002,10 @@ private void MovePageTo(Page page, int newIndex)
//}
}

PageChanged(this, new PageChangedEvent(page, originalPage, PageChangedEvent.IMAGE_STATUS_CHANGED));
PageChanged(this, new PageChangedEvent(page, originalPage.Tag, PageChangedEvent.IMAGE_STATUS_CHANGED));
if (originalPage != null)
{
PageChanged(this, new PageChangedEvent((Page)originalPage.Tag, page, PageChangedEvent.IMAGE_STATUS_CHANGED));
PageChanged(this, new PageChangedEvent((Page)originalPage.Tag, null, PageChangedEvent.IMAGE_STATUS_CHANGED));
}
ArchiveStateChanged(this, new CBZArchiveStatusEvent(Program.ProjectModel, CBZArchiveStatusEvent.ARCHIVE_FILE_UPDATED));

Expand Down
8 changes: 4 additions & 4 deletions MyCBZ/Forms/MainForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABu
CgAAAk1TRnQBSQFMAgEBAwEAAdABDAHQAQwBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CgAAAk1TRnQBSQFMAgEBAwEAAYABDQGAAQ0BEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
Expand Down Expand Up @@ -198,7 +198,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWws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OGBiUDSQOrA60DfwYlA0QD4wwAA+YDUAMlA30D+gYAA/0DtAMrAyUDumkAA/4DYwkl
A5sGAAPfCSUDRAP9BgAD5wwlA0YD+gMAA7QMJQG2ArhmAAPUDCUDmwYAA98MJQN/A/4DAAPoAzUMJQN9
Expand All @@ -505,7 +505,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAQ
DAAAAk1TRnQBSQFMAgEBBAEAAdgBDAHYAQwBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
DAAAAk1TRnQBSQFMAgEBBAEAAYgBDQGIAQ0BEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
Expand Down
2 changes: 1 addition & 1 deletion MyCBZ/Forms/PageSettingsForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public PageSettingsForm(Page page)

PreviewThumbPictureBox.Image = PreviewThumb;

TextBoxFileLocation.Text = Page.Compressed ? Page.TempPath : Page.LocalPath;
TextBoxFileLocation.Text = Page.Compressed ? Page.TempPath : Page.LocalFile.FullPath;
PageNameTextBox.Text = Page.Name;
LabelSize.Text = Page.SizeFormat();
PageIndexTextbox.Text = (Page.Index + 1).ToString();
Expand Down
13 changes: 10 additions & 3 deletions MyCBZ/Models/LocalFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

namespace Win_CBZ
{
internal class LocalFile
public class LocalFile
{

public String Name { get; set; }

public String FileName { get; set; }

public String FilePath { get; set; }

public String FileExtension { get; set; }

public String FullPath { get; set; }

public long FileSize { get; set; }
Expand All @@ -26,6 +26,13 @@ internal class LocalFile
public LocalFile(String fileName)
{
FullPath = fileName;
FileInfo localFileInfo = new FileInfo(fileName);
FileName = localFileInfo.Name;
FilePath = localFileInfo.Directory.FullName;
FileSize = localFileInfo.Length;
LastModified = localFileInfo.LastWriteTime;
FileExtension = localFileInfo.Extension;

}

}
Expand Down
Loading

0 comments on commit 277ed96

Please sign in to comment.