Skip to content

Commit d3cbccf

Browse files
Change to file scoped namespaces (#183)
1 parent 318f7c6 commit d3cbccf

File tree

186 files changed

+13444
-13620
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

186 files changed

+13444
-13620
lines changed

Directory.Build.props

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Project>
2+
<PropertyGroup>
3+
<LangVersion>latest</LangVersion>
4+
</PropertyGroup>
5+
</Project>

UTF-unknown.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1313
ProjectSection(SolutionItems) = preProject
1414
.editorconfig = .editorconfig
1515
appveyor.yml = appveyor.yml
16+
Directory.Build.props = Directory.Build.props
1617
README.md = README.md
1718
EndProjectSection
1819
EndProject

example/DetectFile.cs

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,33 @@
22
using System.IO;
33
using UtfUnknown;
44

5-
namespace ConsoleExample
5+
namespace ConsoleExample;
6+
7+
public class DetectFile
68
{
7-
public class DetectFile
9+
/// <summary>
10+
/// Command line example: detects the encoding of the given file.
11+
/// </summary>
12+
/// <param name="args">a filename</param>
13+
public static void Main(string[] args)
814
{
9-
/// <summary>
10-
/// Command line example: detects the encoding of the given file.
11-
/// </summary>
12-
/// <param name="args">a filename</param>
13-
public static void Main(string[] args)
15+
if (args.Length == 0)
1416
{
15-
if (args.Length == 0)
16-
{
17-
Console.WriteLine("Usage: ConsoleExample <filename>");
18-
return;
19-
}
20-
21-
var filename = args[0];
22-
if (!File.Exists(filename))
23-
{
24-
Console.WriteLine($"File not found: {filename}");
25-
return;
26-
}
17+
Console.WriteLine("Usage: ConsoleExample <filename>");
18+
return;
19+
}
2720

28-
var result = CharsetDetector.DetectFromFile(filename);
29-
var message = result.Detected != null
30-
? $"Detected encoding {result.Detected.Encoding.WebName} with confidence {result.Detected.Confidence}."
31-
: $"Detection failed: {filename}";
32-
Console.WriteLine(message);
21+
var filename = args[0];
22+
if (!File.Exists(filename))
23+
{
24+
Console.WriteLine($"File not found: {filename}");
25+
return;
3326
}
27+
28+
var result = CharsetDetector.DetectFromFile(filename);
29+
var message = result.Detected != null
30+
? $"Detected encoding {result.Detected.Encoding.WebName} with confidence {result.Detected.Confidence}."
31+
: $"Detection failed: {filename}";
32+
Console.WriteLine(message);
3433
}
35-
}
34+
}

0 commit comments

Comments
 (0)