/* * 付:外挂ini配置文件格式: * [Information] * Name=Resampler * Author=Unknown * Version=1.0 * * [Usuage] * This is all the Usuage Text,A Mono Text * * [FlagsSetting] * ItemCount=2 * * [Flag1] * Flag=B * ThreeLetterName=BRI * Min=-100 * Max=100 * Default=1 * * [Flag2] * Flag=b * ThreeLetterName=bre * Min=-100 * Max=100 * Default=10 */ public DriverModels.EngineInfo GetInfo() { DriverModels.EngineInfo ret = new EngineInfo { Version = "Error" }; if (!_isLegalPlugin) { return(ret); } ret.Author = "Unknown"; ret.Name = System.IO.Path.GetFileName(ExePath); ret.Version = "Unknown"; ret.Usuage = $"Traditional Resample Engine in {ExePath}"; ret.FlagItem = new EngineFlagItem[0]; ret.FlagItemCount = 0; try { if (ExePath.EndsWith(".exe", StringComparison.CurrentCultureIgnoreCase)) { string RealFile = ExePath.Substring(0, ExePath.Length - 3) + "ini"; if (System.IO.File.Exists(RealFile)) { IniFileClass IniFile = new IniFileClass(RealFile); string Name = IniFile.getKeyValue("Information", "Name"); if (Name != string.Empty) { ret.Name = Name; } string Author = IniFile.getKeyValue("Information", "Author"); if (Author != string.Empty) { ret.Author = Author; } string Version = IniFile.getKeyValue("Information", "Version"); if (Version != string.Empty) { ret.Version = Version; } StringBuilder Usuage = new StringBuilder(); Usuage.Append(IniFile.SectionValues("Usuage")); if (Usuage.Length > 10) { ret.Usuage = Usuage.ToString(); } string FlagItemCount = IniFile.getKeyValue("FlagsSetting", "ItemCount"); int.TryParse(FlagItemCount, out ret.FlagItemCount); List <EngineFlagItem> Items = new List <EngineFlagItem>(); for (int i = 1; i <= ret.FlagItemCount; i++) { try { EngineFlagItem I = new EngineFlagItem { Default = double.Parse(IniFile.getKeyValue($"Flag{i}", "Default")), flagStr = IniFile.getKeyValue($"Flag{i}", "Flag"), Max = double.Parse(IniFile.getKeyValue($"Flag{i}", "Max")), Min = double.Parse(IniFile.getKeyValue($"Flag{i}", "Min")), ThreeLetterName = IniFile.getKeyValue($"Flag{i}", "ThreeLetterName") }; Items.Add(I); } catch {; } } ret.FlagItemCount = Items.Count; ret.FlagItem = Items.ToArray(); } } } catch {; } return(ret); }
/* 付:外挂ini配置文件格式: [Information] Name=Resampler Author=Unknown Version=1.0 [Usuage] This is all the Usuage Text,A Mono Text [FlagsSetting] ItemCount=2 [Flag1] Flag=B ThreeLetterName=BRI Min=-100 Max=100 Default=1 [Flag2] Flag=b ThreeLetterName=bre Min=-100 Max=100 Default=10 */ public DriverModels.EngineInfo GetInfo() { DriverModels.EngineInfo ret = new EngineInfo(); ret.Version = "Error"; if (!_isLegalPlugin) return ret; ret.Author = "Unknown"; ret.Name = System.IO.Path.GetFileName(ExePath); ret.Version = "Unknown"; ret.Usuage = "Traditional Resample Engine in "+ExePath; ret.FlagItem = new EngineFlagItem[0]; ret.FlagItemCount = 0; try { if(ExePath.ToLower().EndsWith(".exe")) { string RealFile=ExePath.Substring(0,ExePath.Length-3)+"ini"; if (System.IO.File.Exists(RealFile)) { IniFileClass IniFile = new IniFileClass(RealFile); string Name=IniFile.getKeyValue("Information", "Name"); if (Name != "") ret.Name = Name; string Author = IniFile.getKeyValue("Information", "Author"); if (Author != "") ret.Author = Author; string Version = IniFile.getKeyValue("Information", "Version"); if (Version != "") ret.Version = Version; StringBuilder Usuage = new StringBuilder(); Usuage.Append(IniFile.SectionValues("Usuage")); if (Usuage.Length > 10) ret.Usuage = Usuage.ToString(); string FlagItemCount = IniFile.getKeyValue("FlagsSetting", "ItemCount"); int.TryParse(FlagItemCount, out ret.FlagItemCount); List<EngineFlagItem> Items = new List<EngineFlagItem>(); for (int i = 1; i <= ret.FlagItemCount; i++) { try { EngineFlagItem I = new EngineFlagItem(); I.Default = double.Parse(IniFile.getKeyValue("Flag" + i.ToString(), "Default")); I.flagStr = IniFile.getKeyValue("Flag" + i.ToString(), "Flag"); I.Max = double.Parse(IniFile.getKeyValue("Flag" + i.ToString(), "Max")); I.Min = double.Parse(IniFile.getKeyValue("Flag" + i.ToString(), "Min")); I.ThreeLetterName = IniFile.getKeyValue("Flag" + i.ToString(), "ThreeLetterName"); Items.Add(I); } catch { ;} } ret.FlagItemCount = Items.Count; ret.FlagItem = Items.ToArray(); } } } catch { ;} return ret; }