JavaPropertiesTokenizer is a .NET library for tokenizing Java properties files.
It lets you load a Java properties file, edit it and write back the changes. It preseves the whitespace and separator characters so that the file can be faithfully recrated.
usingJavaPropertiesTokenizer;// Basic reading of properties file to get only key value pairsDictionary<string,string>props=JavaPropertiesParser.ParseFileToDictionary(@"C:\Path\File.properties");// orDictionary<string,string>props=JavaPropertiesParser.ParseFileToDictionary(@"C:\Path\File.properties",JavaPropertiesParser.DefaultEncoding,true);// Reading tokens of a properties fileusingvarfileStream=File.Open(@"C:\Path\File.properties",FileMode.Open,FileAccess.Read,FileShare.ReadWrite);varfileTokens=JavaPropertiesParser.Parse(fileStream);// Writing tokens to a properties fileusing(varwriter=newStreamWriter(@"C:\Path\File2.properties",false,JavaPropertiesParser.DefaultEncoding)){JavaPropertiesWriter.Write(writer,fileTokens);}This library is licensed under the MIT license.