Skip to content

Commit

Permalink
fix for not being able to remove metadata entries...
Browse files Browse the repository at this point in the history
  • Loading branch information
t0815 committed Aug 22, 2024
1 parent 581ad6a commit f11ea3a
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 23 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.148b</value>
<value>0.19.149b</value>
</setting>
<setting name="RenamerPlaceholders" serializeAs="Xml">
<value>
Expand Down
45 changes: 31 additions & 14 deletions MyCBZ/Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2987,17 +2987,18 @@ private void RemoveMetadataRowBtn_Click(object sender, EventArgs e)

foreach (DataGridViewRow row in MetaDataGrid.SelectedRows)
{
MetaDataEntry selectedEntry = row.Cells[0].Tag as MetaDataEntry;
int index = Program.ProjectModel.MetaData.Remove(selectedEntry);

int index = Program.ProjectModel.MetaData.Remove(row.Cells[0].Tag as MetaDataEntry);
//AppEventHandler.OnMetaDataEntryChanged(sender, new MetaDataEntryChangedEvent(MetaDataEntryChangedEvent.ENTRY_DELETED, index, selectedEntry));


/*
if (row.Cells[0].Value != null)
if (index > -1)
{
var key = row.Cells[0].Value.ToString();
var key = row.Cells[0].Value.ToString();

Program.ProjectModel.MetaData.Remove(key);
} */
Program.ProjectModel.MetaData.Remove(index);
}
}
}
}
Expand Down Expand Up @@ -3350,8 +3351,9 @@ private void MetaDataEntryChanged(object sender, MetaDataEntryChangedEvent e)

if (Program.ProjectModel.FileName != null)
{
ToolButtonSave.Enabled = true; //Program.ProjectModel.FileName != null && Program.ProjectModel.FileName.Length > 0;
SaveToolStripMenuItem.Enabled = true; // Program.ProjectModel.FileName != null && Program.ProjectModel.FileName.Length > 0;
AppEventHandler.OnArchiveStatusChanged(sender, new CBZArchiveStatusEvent(Program.ProjectModel, CBZArchiveStatusEvent.ARCHIVE_METADATA_CHANGED));
//ToolButtonSave.Enabled = true; //Program.ProjectModel.FileName != null && Program.ProjectModel.FileName.Length > 0;
//SaveToolStripMenuItem.Enabled = true; // Program.ProjectModel.FileName != null && Program.ProjectModel.FileName.Length > 0;
}

if (e.State == MetaDataEntryChangedEvent.ENTRY_NEW)
Expand All @@ -3362,19 +3364,34 @@ private void MetaDataEntryChanged(object sender, MetaDataEntryChangedEvent e)
r.Selected = false;
}

MetaDataGrid.Rows.Add(e.Entry.Key, e.Entry.Value, "");
try
{
MetaDataGrid.Rows.Add(e.Entry.Key, e.Entry.Value, "");

//Program.ProjectModel.MetaData.Add(new MetaDataEntry())

if (e.Entry.Key == "" && e.Entry.Value == null)
if (e.Entry.Key == "" && e.Entry.Value == null)
{
//MetaDataGrid.Rows[MetaDataGrid.Rows.Count].Cells[0].Selected
MetaDataGrid.CurrentCell = MetaDataGrid.Rows[MetaDataGrid.Rows.Count - 1].Cells[0];
MetaDataGrid.CurrentCell.Tag = e.Entry;
MetaDataGrid.BeginEdit(false);
}
} catch (Exception e1)
{
//MetaDataGrid.Rows[MetaDataGrid.Rows.Count].Cells[0].Selected
MetaDataGrid.CurrentCell = MetaDataGrid.Rows[MetaDataGrid.Rows.Count - 1].Cells[0];
MetaDataGrid.BeginEdit(false);
AppEventHandler.OnMessageLogged(sender, new LogMessageEvent(LogMessageEvent.LOGMESSAGE_TYPE_WARNING, e1.Message));
}
}

if (e.State == MetaDataEntryChangedEvent.ENTRY_DELETED)
{
MetaDataGrid.Rows.RemoveAt(e.Index);
if (e.Index > -1)
{
MetaDataGrid.Rows.RemoveAt(e.Index);
} else
{
AppEventHandler.OnMessageLogged(sender, new LogMessageEvent(LogMessageEvent.LOGMESSAGE_TYPE_WARNING, "MainForm::MetaDataEntryChanged(), index < 0!"));
}
}
}));
}
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.147.%2a</ApplicationVersion>
<ApplicationVersion>0.19.149.%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.148b</Value>
<Value Profile="(Default)">0.19.149b</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
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Microsoft Visual Studio [Community] 2022 (64-Bit)

## Latest Release

v0.19.148b released!
v0.19.149b released!

## Third party components

Expand Down
8 changes: 4 additions & 4 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:{71211041-A848-4B13-8186-6F3F48A12954}"
"PackageCode" = "8:{F35E0F5C-9A0F-45DF-9EAF-47CC7DD7E825}"
"ProductCode" = "8:{9FF5D4E1-977E-4FF8-B9F7-6CD90B8E0696}"
"PackageCode" = "8:{60CEB024-3F05-41E9-86BD-02EEE26C709E}"
"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.148"
"ProductVersion" = "8:0.19.149"
"Manufacturer" = "8:Trash_s0Ft"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:"
Expand Down Expand Up @@ -808,7 +808,7 @@
{
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_6396FCEA903E4B85AEBC5E3B127481F0"
{
"SourcePath" = "8:"
"SourcePath" = "8:..\\MyCBZ\\obj\\x64\\Release\\net8.0-windows7.0\\Win_CBZ.dll"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_381C2AC7AD384E1488C6014F95032920"
Expand Down

0 comments on commit f11ea3a

Please sign in to comment.