@@ -23,7 +23,7 @@ public class DP
2323 /// 处理.osu文件的DP操作
2424 /// </summary>
2525 /// <param name="filePath">需要处理的.osu文件路径</param>
26- public void ProcessFile ( string filePath )
26+ public string ProcessFile ( string filePath )
2727 {
2828 // 检查文件是否存在
2929 if ( ! File . Exists ( filePath ) )
@@ -53,28 +53,34 @@ public void ProcessFile(string filePath)
5353 OPorg . TargetKeys = Options . SingleSideKeyCount ;
5454 OPorg . TransformSpeed = 4 ;
5555 Conv . options = OPorg ;
56+ var ANA = new OsuAnalyzer ( ) ;
57+ double BPM = double . Parse ( ANA . GetBPM ( beatmap ) . Split ( '(' ) [ 0 ] ) ;
58+ double beatLength = 60000 / BPM * 4 ;
59+ double convertTime = Math . Max ( 1 , OPorg . TransformSpeed * beatLength - 10 ) ;
60+ var ( matrix , timeAxis ) = Conv . BuildMatrix ( beatmap ) ;
5661
5762 if ( Options . ModifySingleSideKeyCount && Options . SingleSideKeyCount > beatmap . DifficultySection . CircleSize )
5863 {
5964
6065 int targetKeys = Options . SingleSideKeyCount ;
61- var ANA = new OsuAnalyzer ( ) ;
62- double BPM = double . Parse ( ANA . GetBPM ( beatmap ) . Split ( '(' ) [ 0 ] ) ;
63- double beatLength = 60000 / BPM * 4 ;
6466 // 变换时间
65- double convertTime = Math . Max ( 1 , OPorg . TransformSpeed * beatLength - 10 ) ;
6667
67-
68-
69- var ( matrix , timeAxis ) = Conv . BuildMatrix ( beatmap ) ;
7068 var ( oldMTX , insertMTX ) = Conv . convertMTX ( targetKeys - CS , timeAxis , convertTime , CS , random ) ;
7169 int [ , ] newMatrix = Conv . convert ( matrix , oldMTX , insertMTX , timeAxis , targetKeys , beatLength , random ) ;
7270 orgMTX = newMatrix ;
7371 }
72+ else if ( Options . ModifySingleSideKeyCount &&
73+ Options . SingleSideKeyCount < beatmap . DifficultySection . CircleSize )
74+ {
75+ int targetKeys = Options . SingleSideKeyCount ;
76+ var newMatrix = Conv . SmartReduceColumns ( matrix , timeAxis , CS - targetKeys , convertTime , beatLength ) ;
77+ orgMTX = newMatrix ;
78+ }
7479 else
7580 {
76- ( orgMTX , var timeAxis ) = Conv . BuildMatrix ( beatmap ) ;
81+ ( orgMTX , timeAxis ) = Conv . BuildMatrix ( beatmap ) ;
7782 }
83+
7884 //克隆两个矩阵分别叫做orgL和orgR
7985 int [ , ] orgL = ( int [ , ] ) orgMTX . Clone ( ) ;
8086 int [ , ] orgR = ( int [ , ] ) orgMTX . Clone ( ) ;
@@ -105,10 +111,10 @@ public void ProcessFile(string filePath)
105111 int [ , ] result = ConcatenateMatrices ( orgL , orgR ) ;
106112 // 合成新HitObjects
107113 newHitObjects ( beatmap , result ) ;
108- BeatmapSave ( ) ;
114+ return BeatmapSave ( ) ;
109115
110116
111- void BeatmapSave ( )
117+ string BeatmapSave ( )
112118 {
113119
114120 beatmap . MetadataSection . Creator = "Krr DP. & " + beatmap . MetadataSection . Creator ;
@@ -139,6 +145,7 @@ void BeatmapSave()
139145
140146 beatmap . Save ( fullPath ) ;
141147 beatmap = null ;
148+ return fullPath ;
142149 }
143150
144151 }
0 commit comments