From 1cfaa65f9c1f098f78988347fa31919f58e6049f Mon Sep 17 00:00:00 2001 From: t0815 <10379828+t0815@users.noreply.github.com> Date: Sun, 29 Oct 2023 15:06:40 +0100 Subject: [PATCH] more bugfixing... error in page index update func --- MyCBZ/Forms/MainForm.Designer.cs | 134 +++++++++++++++--------------- MyCBZ/Forms/MainForm.cs | 15 ++++ MyCBZ/Forms/MainForm.resx | 60 ++++++------- MyCBZ/Models/MetaData.cs | 4 +- MyCBZ/Models/MetaDataEntryPage.cs | 8 +- MyCBZ/Models/Page.cs | 85 +++++++++++++++---- MyCBZ/Models/ProjectModel.cs | 38 ++++++--- 7 files changed, 215 insertions(+), 129 deletions(-) diff --git a/MyCBZ/Forms/MainForm.Designer.cs b/MyCBZ/Forms/MainForm.Designer.cs index 53d9e8a0..2c5f9a83 100644 --- a/MyCBZ/Forms/MainForm.Designer.cs +++ b/MyCBZ/Forms/MainForm.Designer.cs @@ -31,10 +31,10 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle29 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle30 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle31 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle32 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); this.ToolBar = new System.Windows.Forms.ToolStrip(); this.ToolButtonNew = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); @@ -905,7 +905,7 @@ private void InitializeComponent() // this.PrimarySplitBox.Panel2.Controls.Add(this.MessageLogListView); this.PrimarySplitBox.Size = new System.Drawing.Size(1055, 561); - this.PrimarySplitBox.SplitterDistance = 441; + this.PrimarySplitBox.SplitterDistance = 440; this.PrimarySplitBox.TabIndex = 4; // // MainPanel @@ -916,7 +916,7 @@ private void InitializeComponent() this.MainPanel.Location = new System.Drawing.Point(0, 0); this.MainPanel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.MainPanel.Name = "MainPanel"; - this.MainPanel.Size = new System.Drawing.Size(1055, 441); + this.MainPanel.Size = new System.Drawing.Size(1055, 440); this.MainPanel.TabIndex = 4; // // tableLayoutPanel1 @@ -934,7 +934,7 @@ private void InitializeComponent() this.tableLayoutPanel1.RowCount = 2; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(1055, 441); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1055, 440); this.tableLayoutPanel1.TabIndex = 8; // // GlobalAlertTableLayout @@ -944,7 +944,7 @@ private void InitializeComponent() this.GlobalAlertTableLayout.ColumnCount = 3; this.GlobalAlertTableLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.9819F)); this.GlobalAlertTableLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 96.0181F)); - this.GlobalAlertTableLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 301F)); + this.GlobalAlertTableLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 303F)); this.GlobalAlertTableLayout.Controls.Add(this.LabelGlobalActionStatusMessage, 1, 0); this.GlobalAlertTableLayout.Controls.Add(this.ExecuteCurrentGlobalAction, 2, 0); this.GlobalAlertTableLayout.Controls.Add(this.GlobalAlertMessageIcon, 0, 0); @@ -1011,8 +1011,8 @@ private void InitializeComponent() // this.MainSplitBox.Panel2.AutoScroll = true; this.MainSplitBox.Panel2.Controls.Add(this.SplitBoxItemsList); - this.MainSplitBox.Size = new System.Drawing.Size(1049, 396); - this.MainSplitBox.SplitterDistance = 321; + this.MainSplitBox.Size = new System.Drawing.Size(1049, 395); + this.MainSplitBox.SplitterDistance = 320; this.MainSplitBox.TabIndex = 6; // // SplitBoxPageView @@ -1030,8 +1030,8 @@ private void InitializeComponent() // SplitBoxPageView.Panel2 // this.SplitBoxPageView.Panel2.Controls.Add(this.TabControlPageSettings); - this.SplitBoxPageView.Size = new System.Drawing.Size(319, 394); - this.SplitBoxPageView.SplitterDistance = 124; + this.SplitBoxPageView.Size = new System.Drawing.Size(318, 393); + this.SplitBoxPageView.SplitterDistance = 123; this.SplitBoxPageView.TabIndex = 6; // // PageView @@ -1050,7 +1050,7 @@ private void InitializeComponent() this.PageView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.PageView.Name = "PageView"; this.PageView.OwnerDraw = true; - this.PageView.Size = new System.Drawing.Size(319, 124); + this.PageView.Size = new System.Drawing.Size(318, 123); this.PageView.TabIndex = 6; this.PageView.UseCompatibleStateImageBehavior = false; this.PageView.DrawItem += new System.Windows.Forms.DrawListViewItemEventHandler(this.PageView_DrawItem); @@ -1073,7 +1073,7 @@ private void InitializeComponent() this.TabControlPageSettings.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.TabControlPageSettings.Name = "TabControlPageSettings"; this.TabControlPageSettings.SelectedIndex = 0; - this.TabControlPageSettings.Size = new System.Drawing.Size(319, 266); + this.TabControlPageSettings.Size = new System.Drawing.Size(318, 266); this.TabControlPageSettings.TabIndex = 0; // // TabPagePageSettings @@ -1085,7 +1085,7 @@ private void InitializeComponent() this.TabPagePageSettings.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.TabPagePageSettings.Name = "TabPagePageSettings"; this.TabPagePageSettings.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.TabPagePageSettings.Size = new System.Drawing.Size(311, 239); + this.TabPagePageSettings.Size = new System.Drawing.Size(310, 239); this.TabPagePageSettings.TabIndex = 0; this.TabPagePageSettings.Text = "Page Adjustments"; this.TabPagePageSettings.UseVisualStyleBackColor = true; @@ -1112,7 +1112,7 @@ private void InitializeComponent() this.TablePanePageAdjustments.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 143F)); this.TablePanePageAdjustments.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 192F)); this.TablePanePageAdjustments.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 8F)); - this.TablePanePageAdjustments.Size = new System.Drawing.Size(305, 235); + this.TablePanePageAdjustments.Size = new System.Drawing.Size(304, 235); this.TablePanePageAdjustments.TabIndex = 7; // // GroupBoxImageQuality @@ -1125,7 +1125,7 @@ private void InitializeComponent() this.GroupBoxImageQuality.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.GroupBoxImageQuality.Name = "GroupBoxImageQuality"; this.GroupBoxImageQuality.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.GroupBoxImageQuality.Size = new System.Drawing.Size(272, 85); + this.GroupBoxImageQuality.Size = new System.Drawing.Size(271, 85); this.GroupBoxImageQuality.TabIndex = 4; this.GroupBoxImageQuality.TabStop = false; this.GroupBoxImageQuality.Text = "Image Quality"; @@ -1134,7 +1134,7 @@ private void InitializeComponent() // this.ImageQualitySliderMaxLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.ImageQualitySliderMaxLabel.AutoSize = true; - this.ImageQualitySliderMaxLabel.Location = new System.Drawing.Point(236, 66); + this.ImageQualitySliderMaxLabel.Location = new System.Drawing.Point(235, 66); this.ImageQualitySliderMaxLabel.Name = "ImageQualitySliderMaxLabel"; this.ImageQualitySliderMaxLabel.Size = new System.Drawing.Size(29, 13); this.ImageQualitySliderMaxLabel.TabIndex = 5; @@ -1160,7 +1160,7 @@ private void InitializeComponent() this.ImageQualityTrackBar.Maximum = 100; this.ImageQualityTrackBar.Minimum = 10; this.ImageQualityTrackBar.Name = "ImageQualityTrackBar"; - this.ImageQualityTrackBar.Size = new System.Drawing.Size(256, 45); + this.ImageQualityTrackBar.Size = new System.Drawing.Size(255, 45); this.ImageQualityTrackBar.TabIndex = 3; this.ImageQualityTrackBar.Value = 85; this.ImageQualityTrackBar.ValueChanged += new System.EventHandler(this.ImageQualityTrackBar_ValueChanged); @@ -1177,7 +1177,7 @@ private void InitializeComponent() this.GroupBoxDoublePages.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.GroupBoxDoublePages.Name = "GroupBoxDoublePages"; this.GroupBoxDoublePages.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.GroupBoxDoublePages.Size = new System.Drawing.Size(272, 188); + this.GroupBoxDoublePages.Size = new System.Drawing.Size(271, 188); this.GroupBoxDoublePages.TabIndex = 6; this.GroupBoxDoublePages.TabStop = false; this.GroupBoxDoublePages.Text = "Split Double-Pages"; @@ -1259,7 +1259,7 @@ private void InitializeComponent() this.GroupBoxDimensions.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.GroupBoxDimensions.Name = "GroupBoxDimensions"; this.GroupBoxDimensions.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.GroupBoxDimensions.Size = new System.Drawing.Size(272, 57); + this.GroupBoxDimensions.Size = new System.Drawing.Size(271, 57); this.GroupBoxDimensions.TabIndex = 4; this.GroupBoxDimensions.TabStop = false; this.GroupBoxDimensions.Text = "Dimensions"; @@ -1317,7 +1317,7 @@ private void InitializeComponent() this.GroupBoxResize.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.GroupBoxResize.Name = "GroupBoxResize"; this.GroupBoxResize.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.GroupBoxResize.Size = new System.Drawing.Size(272, 139); + this.GroupBoxResize.Size = new System.Drawing.Size(271, 139); this.GroupBoxResize.TabIndex = 5; this.GroupBoxResize.TabStop = false; this.GroupBoxResize.Text = "Resize"; @@ -1418,7 +1418,7 @@ private void InitializeComponent() this.ComboBoxApplyPageAdjustmentsTo.Location = new System.Drawing.Point(8, 72); this.ComboBoxApplyPageAdjustmentsTo.Margin = new System.Windows.Forms.Padding(3, 6, 3, 3); this.ComboBoxApplyPageAdjustmentsTo.Name = "ComboBoxApplyPageAdjustmentsTo"; - this.ComboBoxApplyPageAdjustmentsTo.Size = new System.Drawing.Size(272, 21); + this.ComboBoxApplyPageAdjustmentsTo.Size = new System.Drawing.Size(271, 21); this.ComboBoxApplyPageAdjustmentsTo.TabIndex = 7; this.ComboBoxApplyPageAdjustmentsTo.SelectionChangeCommitted += new System.EventHandler(this.ComboBoxApplyPageAdjustmentsTo_SelectionChangeCommitted); // @@ -1431,7 +1431,7 @@ private void InitializeComponent() this.TabPageGlobalSettings.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.TabPageGlobalSettings.Name = "TabPageGlobalSettings"; this.TabPageGlobalSettings.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.TabPageGlobalSettings.Size = new System.Drawing.Size(311, 239); + this.TabPageGlobalSettings.Size = new System.Drawing.Size(311, 244); this.TabPageGlobalSettings.TabIndex = 1; this.TabPageGlobalSettings.Text = "File Settings"; this.TabPageGlobalSettings.UseVisualStyleBackColor = true; @@ -1469,7 +1469,7 @@ private void InitializeComponent() this.FileSettingsTablePanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 100F)); this.FileSettingsTablePanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 41F)); this.FileSettingsTablePanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 8F)); - this.FileSettingsTablePanel.Size = new System.Drawing.Size(282, 428); + this.FileSettingsTablePanel.Size = new System.Drawing.Size(247, 428); this.FileSettingsTablePanel.TabIndex = 1; // // PlaceholdersInfoLabel @@ -1515,7 +1515,7 @@ private void InitializeComponent() this.TextboxStoryPageRenamingPattern.Location = new System.Drawing.Point(3, 52); this.TextboxStoryPageRenamingPattern.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.TextboxStoryPageRenamingPattern.Name = "TextboxStoryPageRenamingPattern"; - this.TextboxStoryPageRenamingPattern.Size = new System.Drawing.Size(276, 21); + this.TextboxStoryPageRenamingPattern.Size = new System.Drawing.Size(241, 21); this.TextboxStoryPageRenamingPattern.TabIndex = 8; this.TextboxStoryPageRenamingPattern.Text = "{title}_p{page}.{ext}"; this.TextboxStoryPageRenamingPattern.TextChanged += new System.EventHandler(this.TextboxStoryPageRenamingPattern_TextChanged_1); @@ -1539,7 +1539,7 @@ private void InitializeComponent() this.TextboxSpecialPageRenamingPattern.Location = new System.Drawing.Point(3, 107); this.TextboxSpecialPageRenamingPattern.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.TextboxSpecialPageRenamingPattern.Name = "TextboxSpecialPageRenamingPattern"; - this.TextboxSpecialPageRenamingPattern.Size = new System.Drawing.Size(276, 21); + this.TextboxSpecialPageRenamingPattern.Size = new System.Drawing.Size(241, 21); this.TextboxSpecialPageRenamingPattern.TabIndex = 10; this.TextboxSpecialPageRenamingPattern.Text = "{type}_{index}.{ext}"; this.TextboxSpecialPageRenamingPattern.TextChanged += new System.EventHandler(this.TextboxSpecialPageRenamingPattern_TextChanged_1); @@ -1554,7 +1554,7 @@ private void InitializeComponent() this.PlaceholdersFlowPanel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.PlaceholdersFlowPanel.Name = "PlaceholdersFlowPanel"; this.PlaceholdersFlowPanel.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.PlaceholdersFlowPanel.Size = new System.Drawing.Size(276, 96); + this.PlaceholdersFlowPanel.Size = new System.Drawing.Size(241, 96); this.PlaceholdersFlowPanel.TabIndex = 12; // // label2 @@ -1571,7 +1571,7 @@ private void InitializeComponent() this.CheckBoxPreview.Anchor = System.Windows.Forms.AnchorStyles.Left; this.CheckBoxPreview.AutoSize = true; this.CheckBoxPreview.Enabled = false; - this.CheckBoxPreview.Location = new System.Drawing.Point(173, 6); + this.CheckBoxPreview.Location = new System.Drawing.Point(151, 6); this.CheckBoxPreview.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.CheckBoxPreview.Name = "CheckBoxPreview"; this.CheckBoxPreview.Size = new System.Drawing.Size(64, 17); @@ -1588,7 +1588,7 @@ private void InitializeComponent() this.RenamerExcludePages.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.RenamerExcludePages.Multiline = true; this.RenamerExcludePages.Name = "RenamerExcludePages"; - this.RenamerExcludePages.Size = new System.Drawing.Size(276, 96); + this.RenamerExcludePages.Size = new System.Drawing.Size(241, 96); this.RenamerExcludePages.TabIndex = 16; this.RenamerExcludePages.TextChanged += new System.EventHandler(this.RenamerExcludePages_TextChanged); // @@ -1598,7 +1598,7 @@ private void InitializeComponent() this.btnGetExcludesFromSelectedPages.Location = new System.Drawing.Point(3, 385); this.btnGetExcludesFromSelectedPages.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnGetExcludesFromSelectedPages.Name = "btnGetExcludesFromSelectedPages"; - this.btnGetExcludesFromSelectedPages.Size = new System.Drawing.Size(164, 37); + this.btnGetExcludesFromSelectedPages.Size = new System.Drawing.Size(142, 37); this.btnGetExcludesFromSelectedPages.TabIndex = 17; this.btnGetExcludesFromSelectedPages.Text = "Get From selected Pages"; this.btnGetExcludesFromSelectedPages.UseVisualStyleBackColor = true; @@ -1612,7 +1612,7 @@ private void InitializeComponent() this.TabPageArchiveSettings.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.TabPageArchiveSettings.Name = "TabPageArchiveSettings"; this.TabPageArchiveSettings.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.TabPageArchiveSettings.Size = new System.Drawing.Size(311, 239); + this.TabPageArchiveSettings.Size = new System.Drawing.Size(311, 244); this.TabPageArchiveSettings.TabIndex = 2; this.TabPageArchiveSettings.Text = "Build settings"; this.TabPageArchiveSettings.UseVisualStyleBackColor = true; @@ -1714,8 +1714,8 @@ private void InitializeComponent() // SplitBoxItemsList.Panel2 // this.SplitBoxItemsList.Panel2.Controls.Add(this.MetadataPanel); - this.SplitBoxItemsList.Size = new System.Drawing.Size(724, 396); - this.SplitBoxItemsList.SplitterDistance = 169; + this.SplitBoxItemsList.Size = new System.Drawing.Size(725, 395); + this.SplitBoxItemsList.SplitterDistance = 168; this.SplitBoxItemsList.TabIndex = 7; // // PagesList @@ -1735,7 +1735,7 @@ private void InitializeComponent() this.PagesList.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.PagesList.Name = "PagesList"; this.PagesList.ShowItemToolTips = true; - this.PagesList.Size = new System.Drawing.Size(722, 167); + this.PagesList.Size = new System.Drawing.Size(723, 166); this.PagesList.TabIndex = 5; this.PagesList.UseCompatibleStateImageBehavior = false; this.PagesList.View = System.Windows.Forms.View.Details; @@ -1783,7 +1783,7 @@ private void InitializeComponent() this.MetadataPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 37F)); this.MetadataPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.MetadataPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 48F)); - this.MetadataPanel.Size = new System.Drawing.Size(722, 221); + this.MetadataPanel.Size = new System.Drawing.Size(723, 221); this.MetadataPanel.TabIndex = 10; // // flowLayoutPanel1 @@ -1871,7 +1871,7 @@ private void InitializeComponent() this.MetaDataTableActionsPanel.Location = new System.Drawing.Point(3, 176); this.MetaDataTableActionsPanel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.MetaDataTableActionsPanel.Name = "MetaDataTableActionsPanel"; - this.MetaDataTableActionsPanel.Size = new System.Drawing.Size(716, 43); + this.MetaDataTableActionsPanel.Size = new System.Drawing.Size(717, 43); this.MetaDataTableActionsPanel.TabIndex = 13; // // AddMetaDataRowBtn @@ -1906,42 +1906,42 @@ private void InitializeComponent() // this.MetaDataGrid.AllowUserToAddRows = false; this.MetaDataGrid.AllowUserToOrderColumns = true; - dataGridViewCellStyle29.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); - this.MetaDataGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle29; - dataGridViewCellStyle30.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle30.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle30.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle30.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle30.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle30.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle30.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.MetaDataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle30; + dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + this.MetaDataGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle2.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.MetaDataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; this.MetaDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridViewCellStyle31.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle31.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle31.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle31.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle31.Padding = new System.Windows.Forms.Padding(0, 1, 1, 1); - dataGridViewCellStyle31.SelectionBackColor = System.Drawing.Color.Gold; - dataGridViewCellStyle31.SelectionForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle31.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.MetaDataGrid.DefaultCellStyle = dataGridViewCellStyle31; + dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle3.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle3.Padding = new System.Windows.Forms.Padding(0, 1, 1, 1); + dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.Gold; + dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.MetaDataGrid.DefaultCellStyle = dataGridViewCellStyle3; this.MetaDataGrid.Dock = System.Windows.Forms.DockStyle.Fill; this.MetaDataGrid.Location = new System.Drawing.Point(3, 39); this.MetaDataGrid.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.MetaDataGrid.MultiSelect = false; this.MetaDataGrid.Name = "MetaDataGrid"; - dataGridViewCellStyle32.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle32.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle32.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle32.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle32.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle32.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle32.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.MetaDataGrid.RowHeadersDefaultCellStyle = dataGridViewCellStyle32; + dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle4.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.MetaDataGrid.RowHeadersDefaultCellStyle = dataGridViewCellStyle4; this.MetaDataGrid.RowHeadersWidth = 51; this.MetaDataGrid.RowTemplate.Height = 24; - this.MetaDataGrid.Size = new System.Drawing.Size(716, 132); + this.MetaDataGrid.Size = new System.Drawing.Size(717, 132); this.MetaDataGrid.TabIndex = 12; this.MetaDataGrid.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.MetaDataGrid_CellContentClick); this.MetaDataGrid.CellValidating += new System.Windows.Forms.DataGridViewCellValidatingEventHandler(this.MetaDataGrid_CellValidating); @@ -1964,7 +1964,7 @@ private void InitializeComponent() this.MessageLogListView.Location = new System.Drawing.Point(0, 0); this.MessageLogListView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.MessageLogListView.Name = "MessageLogListView"; - this.MessageLogListView.Size = new System.Drawing.Size(1055, 116); + this.MessageLogListView.Size = new System.Drawing.Size(1055, 117); this.MessageLogListView.SmallImageList = this.LogMessageImageList; this.MessageLogListView.TabIndex = 0; this.MessageLogListView.UseCompatibleStateImageBehavior = false; @@ -2025,7 +2025,7 @@ private void InitializeComponent() this.DoubleBuffered = true; this.MainMenuStrip = this.MenuBar; this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.MinimumSize = new System.Drawing.Size(350, 71); + this.MinimumSize = new System.Drawing.Size(350, 69); this.Name = "MainForm"; this.Padding = new System.Windows.Forms.Padding(0, 0, 0, 5); this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; diff --git a/MyCBZ/Forms/MainForm.cs b/MyCBZ/Forms/MainForm.cs index 432ac7bb..3defdba5 100644 --- a/MyCBZ/Forms/MainForm.cs +++ b/MyCBZ/Forms/MainForm.cs @@ -318,9 +318,24 @@ private void PageChanged(object sender, PageChangedEvent e) if (e.OldValue != null) { + int backupIndex = -1; if (ComboBoxApplyPageAdjustmentsTo.Items.IndexOf(((Page)e.OldValue).Name) > -1) { + if (ComboBoxApplyPageAdjustmentsTo.Items.IndexOf(e.Page.Name) > -1) + { + 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) + { + ComboBoxApplyPageAdjustmentsTo.Items[backupIndex] = ((Page)e.OldValue).Name; + + } } } diff --git a/MyCBZ/Forms/MainForm.resx b/MyCBZ/Forms/MainForm.resx index 1fc0603c..2f62acf0 100644 --- a/MyCBZ/Forms/MainForm.resx +++ b/MyCBZ/Forms/MainForm.resx @@ -140,7 +140,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABu - CgAAAk1TRnQBSQFMAgEBAwEAAcABDAHAAQwBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CgAAAk1TRnQBSQFMAgEBAwEAAdABDAHQAQwBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA @@ -198,7 +198,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABe - PgAAAk1TRnQBSQFMAgEBEQEAAcABDAHAAQwBGAEAARgBAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFg + PgAAAk1TRnQBSQFMAgEBEQEAAdABDAHQAQwBGAEAARgBAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFg AwABeAMAAQEBAAEYBgABh/8A/wD/AHgAAtQB1QMnNiUDJwPV3gADvQMlNr0DJQO+3gADvQMlEgAD/wHl AfMB9gG8AeoB8wG8AeoB8wHlAfMB9gP/EgADJQO+3gADvQMlDwAB9AH4AfkBUAHaAfQBAAHSAfoBAAHS AfoBAAHSAfoBAAHSAfoBUAHaAvQB+AH5DwADJQO+3gADvQMlDAAB+gL7AS4B1wH3AQAB0gH6AcwB7QL0 @@ -470,6 +470,33 @@ 297, 60 + + Most CBZ-Readers ignore the ComicInfo Page-Index and rely on filename ordering instead. If enabled, any renaming options are ignored and the files are automatically renamed according to their index. The Page with Type 'FrontCover' should be at index 1. + + + 1118, 21 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w + LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 + ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAK + AwAAAk1TRnQBSQFMAgEBAgEAAUABDAFAAQwBEAEAARABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFA + AwABEAMAAQEBAAEYBgABDCEAA/cD2QPEA78D0gPtA/6lAAP+A7kDLA8lA38D/RIAA+cBUgFUAVUD+g8A + A7gBtgK4bwAD+wOGBiUDSQOrA60DfwYlA0QD4wwAA+YDUAMlA30D+gYAA/0DtAMrAyUDumkAA/4DYwkl + A5sGAAPfCSUDRAP9BgAD5wwlA0YD+gMAA7QMJQG2ArhmAAPUDCUDmwYAA98MJQN/A/4DAAPoAzUMJQN9 + A7QDKwklAysDuGYAA4YMJQObBgAD3w8lA+0GAAPzAzUbJQO0aQADSQMlA9EG3wPuBgAD+QnfA38DJQPS + CQAD4AM1EiUDKwO0A/1pAAMpAyUD+xsAA60DJQO/DAAD8wM1DyUDtG8AAzIDJQP7GwADqwMlA8QJAAP9 + A7QDKw8lA30D+mwAA1sDJQOEBpsDzwYAA+4JmwNJAyUD2QkAA7QYJQNGA/ppAAOiDCUDmwYAA98MJQMs + A/cDAAP9A7QDKwklAysDNQwlA30D+mYAA+gMJQObBgAD3wwlA7kGAAHKAssPJQO0A/MDNQwlAVIBVAFV + ZgAD/wPAAy0GJQOEBvsD0QklA4YD/gYAA/YDdgYlAysDtAP9AwAD4AM1BiUDUAPnbAADwBglA2MD+w8A + A3YDJQO0DAAD8wM1AyUD5m8AA/8D6AOiA1sDMgMpA0kDhgPUA/4SAAP2AcoCywP9DwAD6APn/wAqAAFC + AU0BPgcAAT4DAAEoAwABQAMAARADAAEBAQABAQUAAYAXAAP/AQAB+AEPAv8EAAHgAQcB4wHnBAABwAED + AcEBgwQAAoEBgAGBBAABgQKAAQEEAAGBAYABwAEDBAABgQGAAeABAwQAAY8B+AHwAQ8EAAGPAfgB4AEH + BAABgQGAAeABAwQAAYECgAEBBAACgQGAAQEEAAGAAQEBgAGBBAAB4AEDAeMBwwQAAeABBwHjAecEAAT/ + BAAL + + 453, 60 @@ -478,7 +505,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAQ - DAAAAk1TRnQBSQFMAgEBBAEAAcgBDAHIAQwBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + DAAAAk1TRnQBSQFMAgEBBAEAAdgBDAHYAQwBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA @@ -530,33 +557,6 @@ ASABwAHjAZ4BPAHGASMBggFAAYYBcQG8ATwB4gEnAYEBgAGeAXkBvAE8AeIBBwGBAYABngF5AZ8B+AHy AQ8BggFgAZ4BOQGcATgB+AGPAYQBIAGeATkBjAE5AfgBnwGAAQEBngE5AYQBIQH8AT8BgAEBAYYBIQHh AYMB/gE/AeABAwHAAQMB4AEHAf4BPwHgAQcB8AEPCP8L - - - - Most CBZ-Readers ignore the ComicInfo Page-Index and rely on filename ordering instead. If enabled, any renaming options are ignored and the files are automatically renamed according to their index. The Page with Type 'FrontCover' should be at index 1. - - - 1118, 21 - - - - AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w - LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 - ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAK - AwAAAk1TRnQBSQFMAgEBAgEAATABDAEwAQwBEAEAARABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFA - AwABEAMAAQEBAAEYBgABDCEAA/cD2QPEA78D0gPtA/6lAAP+A7kDLA8lA38D/RIAA+cBUgFUAVUD+g8A - A7gBtgK4bwAD+wOGBiUDSQOrA60DfwYlA0QD4wwAA+YDUAMlA30D+gYAA/0DtAMrAyUDumkAA/4DYwkl - A5sGAAPfCSUDRAP9BgAD5wwlA0YD+gMAA7QMJQG2ArhmAAPUDCUDmwYAA98MJQN/A/4DAAPoAzUMJQN9 - A7QDKwklAysDuGYAA4YMJQObBgAD3w8lA+0GAAPzAzUbJQO0aQADSQMlA9EG3wPuBgAD+QnfA38DJQPS - CQAD4AM1EiUDKwO0A/1pAAMpAyUD+xsAA60DJQO/DAAD8wM1DyUDtG8AAzIDJQP7GwADqwMlA8QJAAP9 - A7QDKw8lA30D+mwAA1sDJQOEBpsDzwYAA+4JmwNJAyUD2QkAA7QYJQNGA/ppAAOiDCUDmwYAA98MJQMs - A/cDAAP9A7QDKwklAysDNQwlA30D+mYAA+gMJQObBgAD3wwlA7kGAAHKAssPJQO0A/MDNQwlAVIBVAFV - ZgAD/wPAAy0GJQOEBvsD0QklA4YD/gYAA/YDdgYlAysDtAP9AwAD4AM1BiUDUAPnbAADwBglA2MD+w8A - A3YDJQO0DAAD8wM1AyUD5m8AA/8D6AOiA1sDMgMpA0kDhgPUA/4SAAP2AcoCywP9DwAD6APn/wAqAAFC - AU0BPgcAAT4DAAEoAwABQAMAARADAAEBAQABAQUAAYAXAAP/AQAB+AEPAv8EAAHgAQcB4wHnBAABwAED - AcEBgwQAAoEBgAGBBAABgQKAAQEEAAGBAYABwAEDBAABgQGAAeABAwQAAY8B+AHwAQ8EAAGPAfgB4AEH - BAABgQGAAeABAwQAAYECgAEBBAACgQGAAQEEAAGAAQEBgAGBBAAB4AEDAeMBwwQAAeABBwHjAecEAAT/ - BAAL diff --git a/MyCBZ/Models/MetaData.cs b/MyCBZ/Models/MetaData.cs index 32aa9b52..022c4f1c 100644 --- a/MyCBZ/Models/MetaData.cs +++ b/MyCBZ/Models/MetaData.cs @@ -264,11 +264,11 @@ public void RebuildPageMetaData(List pages) } } - public void UpdatePageIndexMetaDataEntry(String name, Page page) + public void UpdatePageIndexMetaDataEntry(Page page, String oldName, String newName) { foreach (MetaDataEntryPage entry in PageIndex) { - if (entry.GetAttribute(MetaDataEntryPage.COMIC_PAGE_ATTRIBUTE_IMAGE).Equals(page.Name)) + if (entry.GetAttribute(MetaDataEntryPage.COMIC_PAGE_ATTRIBUTE_IMAGE).Equals(oldName)) { entry.SetAttribute(MetaDataEntryPage.COMIC_PAGE_ATTRIBUTE_IMAGE, page.Name) .SetAttribute(MetaDataEntryPage.COMIC_PAGE_ATTRIBUTE_TYPE, page.ImageType) diff --git a/MyCBZ/Models/MetaDataEntryPage.cs b/MyCBZ/Models/MetaDataEntryPage.cs index 273d09e2..683ff150 100644 --- a/MyCBZ/Models/MetaDataEntryPage.cs +++ b/MyCBZ/Models/MetaDataEntryPage.cs @@ -70,7 +70,13 @@ public MetaDataEntryPage() public MetaDataEntryPage SetAttribute(String name, String value) { - Attributes.Add(name, value); + try + { + Attributes.Add(name, value); + } catch (Exception e) + { + Attributes[name] = value; + } return this; } diff --git a/MyCBZ/Models/Page.cs b/MyCBZ/Models/Page.cs index b0813544..4893cc18 100644 --- a/MyCBZ/Models/Page.cs +++ b/MyCBZ/Models/Page.cs @@ -256,7 +256,19 @@ public Page(Page sourcePage) ImageEntry = sourcePage.ImageEntry; ImageStream = sourcePage.ImageStream; IsMemoryCopy = sourcePage.IsMemoryCopy; - ImageStreamMemoryCopy = sourcePage.ImageStreamMemoryCopy; + //ImageStreamMemoryCopy = sourcePage.ImageStreamMemoryCopy; + + if (ImageStream != null) + { + if (ImageStream.CanRead) + { + sourcePage.ImageStream.Position = 0; + + ImageStreamMemoryCopy = new MemoryStream(); + sourcePage.ImageStream.CopyTo(ImageStreamMemoryCopy); + IsMemoryCopy = true; + } + } Changed = sourcePage.Changed; ReadOnly = sourcePage.ReadOnly; @@ -419,29 +431,66 @@ protected void RequestTemporaryFile(String destination = null) FileInfo tempFileInfo = new FileInfo(TempPath); - FileStream localFile = File.OpenRead(LocalPath); - try + if (!IsMemoryCopy) { - FileStream ImageStream = File.Open(TempPath, FileMode.OpenOrCreate, FileAccess.ReadWrite); + FileStream localFile = File.OpenRead(LocalPath); try { - localFile.CopyTo(ImageStream); - } catch (Exception ewr) + + FileStream CopyImageStream = File.Open(TempPath, FileMode.OpenOrCreate, FileAccess.ReadWrite); + try + { + localFile.CopyTo(CopyImageStream); + } + catch (Exception ewr) + { + throw ewr; + } + finally + { + CopyImageStream.Close(); + CopyImageStream.Dispose(); + } + } + catch (Exception e) { - throw ewr; - } finally - { - ImageStream.Close(); - ImageStream.Dispose(); + throw e; } - - } catch (Exception e) - { - throw e; - } finally + finally + { + localFile.Close(); + localFile.Dispose(); + } + } else { - localFile.Close(); - localFile.Dispose(); + try + { + + FileStream CopyImageStream = File.Open(TempPath, FileMode.OpenOrCreate, FileAccess.ReadWrite); + try + { + ImageStreamMemoryCopy.CopyTo(CopyImageStream); + } + catch (Exception ewr) + { + throw ewr; + } + finally + { + CopyImageStream.Close(); + CopyImageStream.Dispose(); + } + + + } + catch (Exception e) + { + throw e; + } + finally + { + + } } } diff --git a/MyCBZ/Models/ProjectModel.cs b/MyCBZ/Models/ProjectModel.cs index 7d1500d8..623d5ae8 100644 --- a/MyCBZ/Models/ProjectModel.cs +++ b/MyCBZ/Models/ProjectModel.cs @@ -100,6 +100,8 @@ internal class ProjectModel private bool ContinuePipelineForIndexBuilder; + private bool IgnorePageNameDuplicates = false; + public long TotalSize { get; set; } private System.IO.Compression.ZipArchive Archive { get; set; } @@ -1344,18 +1346,21 @@ public void RestoreOriginalNamesProc() } [MethodImpl(MethodImplOptions.Synchronized)] - public void RenamePage(Page page, String name, bool isRestored = false) + public void RenamePage(Page page, String name, bool ignoreDuplicates = false) { if (name == null || name == "") { throw new PageException(page, "Failed to rename page ['" + page.Name + "'] with ID [" + page.Id + "]! The new name must not be NULL."); } - foreach (Page existingPage in Pages) + if (!ignoreDuplicates) { - if (existingPage.Name.ToLower().Equals(name.ToLower())) + foreach (Page existingPage in Pages) { - throw new PageDuplicateNameException(page, "Failed to rename page ['" + page.Name + "'] with ID [" + page.Id + "]! A different page with the same name already exists at Index " + existingPage.Index + "."); + if (existingPage.Name.ToLower().Equals(name.ToLower())) + { + throw new PageDuplicateNameException(page, "Failed to rename page ['" + page.Name + "'] with ID [" + page.Id + "]! A different page with the same name already exists at Index " + existingPage.Index + "."); + } } } @@ -1369,7 +1374,7 @@ public void RenamePage(Page page, String name, bool isRestored = false) } [MethodImpl(MethodImplOptions.Synchronized)] - public String PageScriptRename(Page page) + public String PageScriptRename(Page page, bool ignoreDuplicates = false) { string oldName = page.Name; string newName = page.Name; @@ -1404,7 +1409,7 @@ public String PageScriptRename(Page page) try { - RenamePage(page, newName); + RenamePage(page, newName, ignoreDuplicates); } catch (PageDuplicateNameException) { return oldName; } @@ -1646,7 +1651,7 @@ public void RunRenameScriptsForPages() { if (CompatibilityMode || RenamerExcludes.IndexOf(page.Name) == -1) { - RenamePageScript(page); + RenamePageScript(page, IgnorePageNameDuplicates); OnTaskProgress(new TaskProgressEvent(page, page.Index + 1, Pages.Count)); @@ -1709,6 +1714,7 @@ protected void SaveArchiveProc() RenameStoryPagePattern = "{page}.{ext}"; RenameSpecialPagePattern = "{page}.{ext}"; + IgnorePageNameDuplicates = true; try { @@ -1720,6 +1726,7 @@ protected void SaveArchiveProc() } finally { + IgnorePageNameDuplicates = false; RenameStoryPagePattern = restoreOriginalPatternPage; RenameSpecialPagePattern = restoreOriginalPatternSpecialPage; } @@ -1795,6 +1802,7 @@ protected void SaveArchiveProc() } catch (Exception efile) { + page.Compressed = false; MessageLogger.Instance.Log(LogMessageEvent.LOGMESSAGE_TYPE_ERROR, "Error compressing File [" + page.TempPath + "] to Archive [" + efile.Message + "]"); } finally @@ -1890,10 +1898,18 @@ protected void SaveArchiveProc() } [MethodImpl(MethodImplOptions.Synchronized)] - public void RenamePageScript(Page page) + public void RenamePageScript(Page page, bool ignoreDuplicates = false) { - String newName = PageScriptRename(page); - MetaData.UpdatePageIndexMetaDataEntry(newName, page); + String oldName = page.Name; + String newName = PageScriptRename(page, ignoreDuplicates); + + try + { + MetaData.UpdatePageIndexMetaDataEntry(page, oldName, newName); + } catch (Exception ex) + { + MessageLogger.Instance.Log(LogMessageEvent.LOGMESSAGE_TYPE_WARNING, "Error updating PageIndex for page [" + newName + "]. " + ex.Message); + } } @@ -1950,7 +1966,7 @@ protected void SetDirectoryAccessControl(ref DirectoryInfo directoryInfo) directoryInfo.SetAccessControl(dSecurity); } - protected String MakeNewRandomId() + public String MakeNewRandomId() { return RandomProvider.Next().ToString("X"); }