Skip to content

Commit

Permalink
fix missing params for threads, fix missing global action added, if n…
Browse files Browse the repository at this point in the history
…o metadata is present
  • Loading branch information
t0815 committed Aug 22, 2024
1 parent 3f799a6 commit 6e59f66
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 18 deletions.
2 changes: 1 addition & 1 deletion MyCBZ/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
<applicationSettings>
<Win_CBZ.Win_CBZSettings>
<setting name="Version" serializeAs="String">
<value>0.19.149b</value>
<value>0.19.150b</value>
</setting>
<setting name="RenamerPlaceholders" serializeAs="Xml">
<value>
Expand Down
4 changes: 4 additions & 0 deletions MyCBZ/Data/AddImagesThreadParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,9 @@ internal class AddImagesThreadParams : ThreadParam
public MetaData.PageIndexVersion PageIndexVerToWrite { get; set; } = MetaData.PageIndexVersion.VERSION_1;

public string[] InvalidFileNames { get; set; } = new string[0];

public string[] FilterExtensions { get; set; } = new string[0];

public int MaxCountPages { get; set; } = 0;
}
}
4 changes: 4 additions & 0 deletions MyCBZ/Data/ParseFilesThreadParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ internal class ParseFilesThreadParams : ThreadParam

public bool HasMetaData { get; set; }

public int MaxCountPages { get; set; } = 0;

public List<Page> Pages { get; set; }

public MetaData.PageIndexVersion PageIndexVerToWrite { get; set; } = MetaData.PageIndexVersion.VERSION_1;

public bool ContinuePipeline { get; set; }
Expand Down
7 changes: 4 additions & 3 deletions MyCBZ/Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2563,8 +2563,9 @@ private void PagesList_AfterLabelEdit(object sender, LabelEditEventArgs e)

Program.ProjectModel.MetaData.UpdatePageIndexMetaDataEntry((Page)changedItem.Tag, ((Page)changedItem.Tag).Key);

AppEventHandler.OnPageChanged(sender, new PageChangedEvent(((Page)changedItem.Tag), null, PageChangedEvent.IMAGE_STATUS_RENAMED));
AppEventHandler.OnArchiveStatusChanged(sender, new CBZArchiveStatusEvent(Program.ProjectModel, CBZArchiveStatusEvent.ARCHIVE_FILE_UPDATED));
// dont fire events again!
//AppEventHandler.OnPageChanged(sender, new PageChangedEvent(((Page)changedItem.Tag), null, PageChangedEvent.IMAGE_STATUS_RENAMED));
//AppEventHandler.OnArchiveStatusChanged(sender, new CBZArchiveStatusEvent(Program.ProjectModel, CBZArchiveStatusEvent.ARCHIVE_FILE_UPDATED));
}
catch (PageDuplicateNameException eduplicate)
{
Expand Down Expand Up @@ -2661,7 +2662,7 @@ private void MoveItemsTo(int newIndex, System.Windows.Forms.ListView.SelectedLis
NewIndex = newIndex,
Items = items,
PageIndexVersion = MetaDataVersionFlavorHandler.GetInstance().HandlePageIndexVersion(),
CancelToken = CancellationTokenSourceMoveItems.Token
CancelToken = CancellationTokenSourceMoveItems.Token,
});

}
Expand Down
27 changes: 21 additions & 6 deletions MyCBZ/Models/ProjectModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,13 +302,16 @@ private void HandlePipeline(object sender, PipelineEvent e)
}
}

AddImagesThreadParams p = nextTask.ThreadParams as AddImagesThreadParams;

ProcessAddedFiles = new Thread(AddImagesProc);
ProcessAddedFiles.Start(new AddImagesThreadParams()
{
LocalFiles = new List<LocalFile>((IEnumerable<LocalFile>)e.Data),
ProcessAddedFiles.Start(new AddImagesThreadParams()
{
LocalFiles = new List<LocalFile>((IEnumerable<LocalFile>)e.Data),
Stack = remainingStack,
InvalidFileNames = FilteredFileNames.ToArray(),
CancelToken = CancellationTokenSourceProcessAddedFiles.Token
CancelToken = CancellationTokenSourceProcessAddedFiles.Token,
MaxCountPages = p.MaxCountPages,
});

currentPerformed = e.Task;
Expand Down Expand Up @@ -807,6 +810,7 @@ protected void OpenArchiveProc(object threadParams)
else
{
MetaDataPageIndexFileMissing = true;
MetaDataPageIndexMissingData = true;
IndexUpdateReasonMessage = "Image metadata missing from pageindex! Reload image metadata and rebuild pageindex now?";
MessageLogger.Instance.Log(LogMessageEvent.LOGMESSAGE_TYPE_WARNING, "Warning! Archive page metadata missing for page [" + page.Name + "]!");
}
Expand Down Expand Up @@ -1896,8 +1900,8 @@ public void AddImagesProc(object threadParams)
{
AddImagesThreadParams tParams = threadParams as AddImagesThreadParams;

int index = MaxFileIndex;
int realNewIndex = MaxFileIndex;
int index = tParams.MaxCountPages;
int realNewIndex = tParams.MaxCountPages;
int total = tParams?.LocalFiles.Count ?? 0;
int progressIndex = 0;
bool pageError = false;
Expand All @@ -1918,6 +1922,13 @@ public void AddImagesProc(object threadParams)
continue;
}

if (tParams.FilterExtensions.Contains(localPath.Extension.ToLower()))
{
MessageLogger.Instance.Log(LogMessageEvent.LOGMESSAGE_TYPE_WARNING, "Skipping file ['" + localPath.Name + "'] because of filtered file-extension ['" + localPath.Extension.ToLower() + "']!");

continue;
}

targetPath = MakeNewTempFileName();

//CopyFile(fileObject.FullPath, targetPath.FullName);
Expand Down Expand Up @@ -2037,6 +2048,8 @@ public void ParseFiles(List<String> files)
HasMetaData = MetaData.Exists(),
PageIndexVerToWrite = PageIndexVersionWriter,
CancelToken = CancellationTokenSourceParseAddedFileNames.Token,
Pages = Pages,
MaxCountPages = Pages.Count,
});
}

Expand Down Expand Up @@ -2090,6 +2103,7 @@ public void ParseFilesProc(object threadParams)
{
LocalFiles = files.ToList(),
PageIndexVerToWrite = tParams.PageIndexVerToWrite,
MaxCountPages = tParams.MaxCountPages,
}
},
new StackItem
Expand All @@ -2099,6 +2113,7 @@ public void ParseFilesProc(object threadParams)
{
ContinuePipeline = true,
InitialIndexRebuild = false,
Pages = tParams.Pages,
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion MyCBZ/Win_CBZ.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>0.19.149.%2a</ApplicationVersion>
<ApplicationVersion>0.19.150.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
Expand Down
2 changes: 1 addition & 1 deletion MyCBZ/Win_CBZSettings.Designer.cs

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

2 changes: 1 addition & 1 deletion MyCBZ/Win_CBZSettings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Value Profile="(Default)">%APPDATA%\WIN_CBZ\Temp\</Value>
</Setting>
<Setting Name="Version" Type="System.String" Scope="Application">
<Value Profile="(Default)">0.19.149b</Value>
<Value Profile="(Default)">0.19.150b</Value>
</Setting>
<Setting Name="RenamerPlaceholders" Type="System.Collections.Specialized.StringCollection" Scope="Application">
<Value Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
Expand Down
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Win_CBZ

![Screenshot](/meta/Screenshot.jpg)
![Screenshot](/meta/Screenshot.png)

## Author

Expand Down Expand Up @@ -48,7 +48,7 @@ Microsoft Visual Studio [Community] 2022 (64-Bit)

## Latest Release

v0.19.149b released!
v0.19.150b released!

## Third party components

Expand Down
6 changes: 3 additions & 3 deletions Win_CBZ-Setup/Win_CBZ-Setup.vdproj
Original file line number Diff line number Diff line change
Expand Up @@ -248,15 +248,15 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:Win_CBZ"
"ProductCode" = "8:{9FF5D4E1-977E-4FF8-B9F7-6CD90B8E0696}"
"PackageCode" = "8:{60CEB024-3F05-41E9-86BD-02EEE26C709E}"
"ProductCode" = "8:{B383F08E-7C5E-40D2-9FEB-48C1A9E90986}"
"PackageCode" = "8:{C7E3D790-092C-42B0-B330-74EFFCC530F4}"
"UpgradeCode" = "8:{66FAEF81-1CAE-4971-9E0F-796310EFEA5E}"
"AspNetVersion" = "8:4.0.30319.0"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:FALSE"
"DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:FALSE"
"ProductVersion" = "8:0.19.149"
"ProductVersion" = "8:0.19.150"
"Manufacturer" = "8:Trash_s0Ft"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:"
Expand Down
Binary file added meta/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6e59f66

Please sign in to comment.