File tree Expand file tree Collapse file tree 8 files changed +48
-0
lines changed
Actions/Content/Archives/Compress Expand file tree Collapse file tree 8 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ public override async Task ExecuteAsync(object? parameter = null)
40
40
sources ,
41
41
directory ,
42
42
dialog . FileName ,
43
+ dialog . CPUThreads ,
43
44
dialog . Password ,
44
45
dialog . FileFormat ,
45
46
dialog . CompressionLevel ,
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ public override Task ExecuteAsync(object? parameter = null)
26
26
sources ,
27
27
directory ,
28
28
fileName ,
29
+ Environment . ProcessorCount ,
29
30
fileFormat : ArchiveFormats . SevenZip ) ;
30
31
31
32
return StorageArchiveService . CompressAsync ( compressionModel ) ;
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ public override Task ExecuteAsync(object? parameter = null)
26
26
sources ,
27
27
directory ,
28
28
fileName ,
29
+ Environment . ProcessorCount ,
29
30
fileFormat : ArchiveFormats . Zip ) ;
30
31
31
32
return StorageArchiveService . CompressAsync ( compressionModel ) ;
Original file line number Diff line number Diff line change @@ -47,6 +47,11 @@ public interface ICompressArchiveModel
47
47
/// 7zip archive splitting size.
48
48
/// </summary>
49
49
ArchiveSplittingSizes SplittingSize { get ; }
50
+
51
+ /// <summary>
52
+ /// Number of CPU Threads to use.
53
+ /// </summary>
54
+ int CPUThreads { get ; }
50
55
51
56
/// <summary>
52
57
/// Archiving progress.
Original file line number Diff line number Diff line change @@ -108,11 +108,15 @@ public IProgress<StatusCenterItemProgressModel> Progress
108
108
109
109
/// <inheritdoc/>
110
110
public CancellationToken CancellationToken { get ; set ; }
111
+
112
+ /// <inheritdoc/>
113
+ public int CPUThreads { get ; set ; }
111
114
112
115
public CompressArchiveModel (
113
116
string [ ] source ,
114
117
string directory ,
115
118
string fileName ,
119
+ int cpuThreads ,
116
120
string ? password = null ,
117
121
ArchiveFormats fileFormat = ArchiveFormats . Zip ,
118
122
ArchiveCompressionLevels compressionLevel = ArchiveCompressionLevels . Normal ,
@@ -128,6 +132,7 @@ public CompressArchiveModel(
128
132
FileFormat = fileFormat ;
129
133
CompressionLevel = compressionLevel ;
130
134
SplittingSize = splittingSize ;
135
+ CPUThreads = cpuThreads ;
131
136
}
132
137
133
138
/// <inheritdoc/>
@@ -152,6 +157,8 @@ public async Task<bool> RunCreationAsync()
152
157
PreserveDirectoryRoot = sources . Length > 1 ,
153
158
} ;
154
159
160
+ compressor . CustomParameters . Add ( "mt" , CPUThreads . ToString ( ) ) ;
161
+
155
162
compressor . Compressing += Compressor_Compressing ;
156
163
compressor . FileCompressionStarted += Compressor_FileCompressionStarted ;
157
164
compressor . FileCompressionFinished += Compressor_FileCompressionFinished ;
Original file line number Diff line number Diff line change 77
77
<RowDefinition Height =" Auto" />
78
78
<RowDefinition Height =" Auto" />
79
79
<RowDefinition Height =" Auto" />
80
+ <RowDefinition Height =" Auto" />
80
81
</Grid .RowDefinitions>
81
82
82
83
<!-- Archive Format -->
138
139
</DataTemplate >
139
140
</ComboBox .ItemTemplate>
140
141
</ComboBox >
142
+
143
+ <!-- CPU Threads -->
144
+ <TextBlock
145
+ Grid.Row=" 3"
146
+ Grid.Column=" 0"
147
+ VerticalAlignment=" Center"
148
+ Text=" {helpers:ResourceString Name=CPUThreads}" />
149
+ <NumberBox
150
+ Grid.Row=" 3"
151
+ Grid.Column=" 1"
152
+ HorizontalAlignment=" Right"
153
+ AutomationProperties.Name=" {helpers:ResourceString Name=CPUThreads}"
154
+ Maximum=" {x:Bind ViewModel.CPUThreads, Mode=OneTime}"
155
+ Minimum=" 1"
156
+ SpinButtonPlacementMode=" Inline"
157
+ Value=" {x:Bind ViewModel.CPUThreads, Mode=TwoWay}" />
141
158
</Grid >
142
159
143
160
<!-- Encryption Options -->
Original file line number Diff line number Diff line change @@ -51,6 +51,12 @@ public ArchiveSplittingSizes SplittingSize
51
51
get => ViewModel . SplittingSize . Key ;
52
52
set => ViewModel . SplittingSize = ViewModel . SplittingSizes . First ( size => size . Key == value ) ;
53
53
}
54
+
55
+ public int CPUThreads
56
+ {
57
+ get => ViewModel . CPUThreads ;
58
+ set => ViewModel . CPUThreads = value ;
59
+ }
54
60
55
61
private DialogViewModel ViewModel { get ; } = new ( ) ;
56
62
@@ -145,6 +151,13 @@ public SplittingSizeItem SplittingSize
145
151
get => splittingSize ;
146
152
set => SetProperty ( ref splittingSize , value ) ;
147
153
}
154
+
155
+ private int cpuThreads = Environment . ProcessorCount ;
156
+ public int CPUThreads
157
+ {
158
+ get => cpuThreads ;
159
+ set => SetProperty ( ref cpuThreads , value ) ;
160
+ }
148
161
149
162
private bool useEncryption = false ;
150
163
public bool UseEncryption
Original file line number Diff line number Diff line change 3932
3932
<data name =" ShowSystemTrayIcon" xml : space =" preserve" >
3933
3933
<value >Show Files icon in the System Tray</value >
3934
3934
</data >
3935
+ <data name =" CPUThreads" xml : space =" preserve" >
3936
+ <value >CPU threads</value >
3937
+ </data >
3935
3938
</root >
You can’t perform that action at this time.
0 commit comments