public LoginPage() { var vm = new LoginViewModel(this.Navigation); this.BindingContext = vm; InitializeComponent(); CPF.Completed += (object sender, EventArgs e) => { SUS.Focus(); }; SUS.Completed += (object sender, EventArgs e) => { vm.SubmitCommand.Execute(null); }; }
static public bool ConvertChart(ChartChuni chart, Configuration config, string filename, int index, int[] map, string version = "") { if (config == null) { config = Configuration.LoadIIDXConfig(Common.configFileName); } int quantizeNotes = config["BMS"].GetValue("QuantizeNotes"); int quantizeMeasure = config["BMS"].GetValue("QuantizeMeasure"); int difficulty = config["IIDX"].GetValue("Difficulty" + index.ToString()); int outputRank = config["BMS"].GetValue("OutputRank"); if (quantizeMeasure > 0) { chart.QuantizeMeasureLengths(quantizeMeasure); } using (MemoryStream mem = new MemoryStream()) { SUS sus = new SUS(); sus.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 sus.chart.Tags["TITLE"] = name; if (chart.Tags.ContainsKey("ARTIST")) { sus.chart.Tags["ARTIST"] = chart.Tags["ARTIST"]; } if (chart.Tags.ContainsKey("GENRE")) { sus.chart.Tags["GENRE"] = chart.Tags["GENRE"]; } if (difficulty > 0) { sus.chart.Tags["DIFFICULTY"] = difficulty.ToString(); } if (sus.chart.Players > 1) { sus.chart.Tags["PLAYER"] = "3"; } else { sus.chart.Tags["PLAYER"] = "1"; } // create RANK metadata sus.chart.Tags["RANK"] = outputRank.ToString(); // replace prohibited characters name = Common.nameReplace(name); string genre = Common.nameReplace(chart.Tags["GENRE"]); string dirPath = Path.Combine(config["BMS"]["Output"], genre, name); if (chart.Tags["TYPENAME"] == "WORLD'S END") { name += "(" + sus.chart.Tags["TYPENAME"] + " " + chart.Tags["TYPE"].Substring(2) + chart.Tags["PLAYLEVEL"] + ")"; } else { name += "(" + sus.chart.Tags["TYPENAME"] + ")"; } Common.SafeCreateDirectory(dirPath); string output = Path.Combine(dirPath, name + ".sus"); if (quantizeNotes > 0) { try { sus.chart.quantizeNotes = quantizeNotes; sus.chart.QuantizeNoteOffsets(); } catch (Exception) { // something weird happened } } bool isSucces = sus.Write(mem, true); if (!isSucces) { return(false); } File.WriteAllBytes(output, mem.ToArray()); } return(true); }