mirror of
https://github.com/greenshot/greenshot
synced 2025-08-19 21:13:23 -07:00
Making the initial stuff working, getting an installer, when running from VS.
This commit is contained in:
parent
a63bf734d4
commit
57e2044839
1023 changed files with 20896 additions and 19456 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2016 Thomas Braun, Jens Klingen, Robin Krom
|
||||
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
|
@ -41,39 +41,39 @@ namespace Greenshot.IniFile {
|
|||
/// <returns></returns>
|
||||
public static IDictionary<string, IDictionary<string, string>> Read(string path, Encoding encoding) {
|
||||
var ini = new Dictionary<string, IDictionary<string, string>>();
|
||||
using (var fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 1024)) {
|
||||
using (var streamReader = new StreamReader(fileStream, encoding)) {
|
||||
IDictionary<string, string> nameValues = new Dictionary<string, string>();
|
||||
while (!streamReader.EndOfStream) {
|
||||
string line = streamReader.ReadLine();
|
||||
if (line == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
string cleanLine = line.Trim();
|
||||
if (cleanLine.Length == 0 || cleanLine.StartsWith(Comment)) {
|
||||
continue;
|
||||
}
|
||||
if (cleanLine.StartsWith(SectionStart)) {
|
||||
string section = line.Replace(SectionStart, string.Empty).Replace(SectionEnd, string.Empty).Trim();
|
||||
if (!ini.TryGetValue(section, out nameValues))
|
||||
{
|
||||
nameValues = new Dictionary<string, string>();
|
||||
ini.Add(section, nameValues);
|
||||
}
|
||||
} else {
|
||||
string[] keyvalueSplitter = line.Split(Assignment, 2);
|
||||
string name = keyvalueSplitter[0];
|
||||
string inivalue = keyvalueSplitter.Length > 1 ? keyvalueSplitter[1] : null;
|
||||
if (nameValues.ContainsKey(name)) {
|
||||
nameValues[name] = inivalue;
|
||||
} else {
|
||||
nameValues.Add(name, inivalue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
using (var fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 1024))
|
||||
{
|
||||
using var streamReader = new StreamReader(fileStream, encoding);
|
||||
IDictionary<string, string> nameValues = new Dictionary<string, string>();
|
||||
while (!streamReader.EndOfStream) {
|
||||
string line = streamReader.ReadLine();
|
||||
if (line == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
string cleanLine = line.Trim();
|
||||
if (cleanLine.Length == 0 || cleanLine.StartsWith(Comment)) {
|
||||
continue;
|
||||
}
|
||||
if (cleanLine.StartsWith(SectionStart)) {
|
||||
string section = line.Replace(SectionStart, string.Empty).Replace(SectionEnd, string.Empty).Trim();
|
||||
if (!ini.TryGetValue(section, out nameValues))
|
||||
{
|
||||
nameValues = new Dictionary<string, string>();
|
||||
ini.Add(section, nameValues);
|
||||
}
|
||||
} else {
|
||||
string[] keyvalueSplitter = line.Split(Assignment, 2);
|
||||
string name = keyvalueSplitter[0];
|
||||
string inivalue = keyvalueSplitter.Length > 1 ? keyvalueSplitter[1] : null;
|
||||
if (nameValues.ContainsKey(name)) {
|
||||
nameValues[name] = inivalue;
|
||||
} else {
|
||||
nameValues.Add(name, inivalue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ini;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue