本文整理匯總了C#中Chart.QuantizeMeasureLengths方法的典型用法代碼示例。如果您正苦於以下問題:C# Chart.QuantizeMeasureLengths方法的具體用法?C# Chart.QuantizeMeasureLengths怎麽用?C# Chart.QuantizeMeasureLengths使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Chart
的用法示例。
在下文中一共展示了Chart.QuantizeMeasureLengths方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ConvertChart
public static void ConvertChart(Chart chart, Configuration config, string filename, int index, int[] map)
{
if (config == null)
{
config = LoadConfig();
}
int quantizeNotes = config["BMS"].GetValue("QuantizeNotes");
int quantizeMeasure = config["BMS"].GetValue("QuantizeMeasure");
int difficulty = config["IIDX"].GetValue("Difficulty" + index.ToString());
string title = config["BMS"]["Players" + config["IIDX"]["Players" + index.ToString()]] + " " + config["BMS"]["Difficulty" + difficulty.ToString()];
title = title.Trim();
if (quantizeMeasure > 0)
chart.QuantizeMeasureLengths(quantizeMeasure);
using (MemoryStream mem = new MemoryStream())
{
BMS bms = new BMS();
bms.Charts = new Chart[] { chart };
string name = "";
if (chart.Tags.ContainsKey("TITLE"))
name = chart.Tags["TITLE"];
if (name == "")
name = Path.GetFileNameWithoutExtension(Path.GetFileName(filename)); //ex: "1204 [1P Another]"
// write some tags
bms.Charts[0].Tags["TITLE"] = name;
if (chart.Tags.ContainsKey("ARTIST"))
bms.Charts[0].Tags["ARTIST"] = chart.Tags["ARTIST"];
if (chart.Tags.ContainsKey("GENRE"))
bms.Charts[0].Tags["GENRE"] = chart.Tags["GENRE"];
if (difficulty > 0)
bms.Charts[0].Tags["DIFFICULTY"] = difficulty.ToString();
if (bms.Charts[0].Players > 1)
bms.Charts[0].Tags["PLAYER"] = "3";
else
bms.Charts[0].Tags["PLAYER"] = "1";
name = name.Replace(":", "_");
name = name.Replace("/", "_");
name = name.Replace("?", "_");
name = name.Replace("\\", "_");
if (title != null && title.Length > 0)
{
name += " [" + title + "]";
}
string output = Path.Combine(Path.GetDirectoryName(filename), @"@" + name + ".bms");
if (map == null)
bms.GenerateSampleMap();
else
bms.SampleMap = map;
if (quantizeNotes > 0)
bms.Charts[0].QuantizeNoteOffsets(quantizeNotes);
bms.GenerateSampleTags();
bms.Write(mem, true);
File.WriteAllBytes(output, mem.ToArray());
}
}