string LocalizedName(string name) { var desktopIni = new SimpleIniFile(Path.Combine(folder, "desktop.ini")); var localized = desktopIni.Read("LocalizedFileNames", name, string.Empty); if (localized == string.Empty) { return(Path.GetFileNameWithoutExtension(name)); } if (localized[0] != '@') { return(localized); } try { return(Utils.ExtractStringFromDLL(localized)); } catch (SystemException) { // 资源文件可能不存在,回退到文件名 return(Path.GetFileNameWithoutExtension(name)); } }
public void GetNonExistValue() { var file = new SimpleIniFile("Resources/Config.ini"); Assert.AreEqual("s", file.Read("server", "non-exists", "s")); }
public void GetValue() { var file = new SimpleIniFile("Resources/Config.ini"); Assert.AreEqual("hello world", file.Read("server", "key", null)); }
public void GetNonExistFile() { var file = new SimpleIniFile("non-exists.ini"); Assert.AreEqual("s", file.Read("server", "non-exists", "s")); }