mirror of
https://github.com/riegera2412/UVtools.git
synced 2026-07-08 17:42:31 +02:00
Fix math for subsequent layers
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
@@ -43,17 +44,16 @@ namespace UVtools.Core.Operations
|
||||
{
|
||||
if (DiscardRemainingLayers)
|
||||
{
|
||||
return (uint) (1 + InsertAfterLayerIndex + Files.Count - (ReplaceStartLayer ? 1u : 0u));
|
||||
return (uint) (1 + InsertAfterLayerIndex + Files.Count - (ReplaceStartLayer ? 1 : 0));
|
||||
}
|
||||
if (!ReplaceSubsequentLayers)
|
||||
if (ReplaceSubsequentLayers)
|
||||
{
|
||||
return (uint)(totalLayers + Files.Count - (ReplaceStartLayer ? 1u : 0u));
|
||||
uint result = (uint) (1 + InsertAfterLayerIndex + Files.Count - (ReplaceStartLayer ? 1 : 0));
|
||||
return result <= totalLayers ? totalLayers : result;
|
||||
}
|
||||
|
||||
// Need to calculate the total layer count after subsequent replacing, taking in account that layer count can grow
|
||||
return (uint)(totalLayers + Files.Count - (ReplaceStartLayer ? 1 : 0));
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ using System.Runtime.CompilerServices;
|
||||
using System.Windows.Forms;
|
||||
using UVtools.Core.Extensions;
|
||||
using UVtools.GUI.Annotations;
|
||||
using UVtools.GUI.Forms;
|
||||
|
||||
namespace UVtools.GUI.Controls
|
||||
{
|
||||
@@ -69,10 +70,12 @@ namespace UVtools.GUI.Controls
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region Properties
|
||||
|
||||
[ReadOnly(true)] [Browsable(false)] public FrmToolWindow ParentToolWindow => ParentForm as FrmToolWindow;
|
||||
|
||||
[Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
|
||||
[SettingsBindable(true)]
|
||||
public string Description { get; set; }
|
||||
@@ -105,7 +108,7 @@ namespace UVtools.GUI.Controls
|
||||
|
||||
[ReadOnly(true)]
|
||||
[Browsable(false)]
|
||||
public virtual string ConfirmationText { get; } = "do this action?";
|
||||
public virtual string ConfirmationText => $"{Text}?";
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace UVtools.GUI.Forms
|
||||
|
||||
[ReadOnly(true)]
|
||||
[Browsable(false)]
|
||||
public virtual string ConfirmationText { get; } = "do this action?";
|
||||
public virtual string ConfirmationText => $"{Text}?";
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user