Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复AresIniDocumentBinder的无法正确识别键值对的值中带冒号的情况 #142

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/Shimakaze.Sdk.Ini.Ares/AresIniDocumentBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
sb.Append(token.Value);
break;

case '=' when !isSection:
case '=' when !isComment && !isSection:
key = GetString(options.Trim);
if (key.Trim() == "+")
{
Expand All @@ -58,15 +58,19 @@
}
break;

case '+' when !isSection:
case '+' when !isComment && !isSection:
sb.Append('+');
break;

case ':' when !isSection:
case ':' when !isComment && !isSection && key is null:
Flush(options.Trim);
isBaseSection = true;
break;

case ':' when !isComment && key is not null:
sb.Append(':');
break;

case ';':
Flush(options.Trim);

Expand Down Expand Up @@ -130,13 +134,13 @@
if (isSection)
value = '[' + value;
if (!string.IsNullOrEmpty(key))
current[key] = value;

Check warning on line 137 in src/Shimakaze.Sdk.Ini.Ares/AresIniDocumentBinder.cs

View workflow job for this annotation

GitHub Actions / .Net 构建 ubuntu-latest

Possible null reference argument for parameter 'key' in 'string AresIniSection.this[string key]'.

Check warning on line 137 in src/Shimakaze.Sdk.Ini.Ares/AresIniDocumentBinder.cs

View workflow job for this annotation

GitHub Actions / .Net 构建 windows-latest

Possible null reference argument for parameter 'key' in 'string AresIniSection.this[string key]'.
else
current[value] = string.Empty;
}
else if (!string.IsNullOrEmpty(key))
{
current[key] = string.Empty;

Check warning on line 143 in src/Shimakaze.Sdk.Ini.Ares/AresIniDocumentBinder.cs

View workflow job for this annotation

GitHub Actions / .Net 构建 ubuntu-latest

Possible null reference argument for parameter 'key' in 'string AresIniSection.this[string key]'.
}
}
}
Expand All @@ -156,7 +160,7 @@
if (string.IsNullOrEmpty(item.BaseName))
continue;

if (ini.TryGetSection(item.BaseName, out var section))

Check warning on line 163 in src/Shimakaze.Sdk.Ini.Ares/AresIniDocumentBinder.cs

View workflow job for this annotation

GitHub Actions / .Net 构建 ubuntu-latest

Possible null reference argument for parameter 'key' in 'bool IniDocument<AresIniSection>.TryGetSection(string key, out AresIniSection section)'.
item.Base = section;
}

Expand Down
Loading