chore: deploy initial code base #1
+80
@@ -0,0 +1,80 @@
|
|||||||
|
public class Program
|
||||||
|
{
|
||||||
|
|
||||||
|
public static void Main()
|
||||||
|
{
|
||||||
|
var path = @"C:\Users\tlamb\Downloads\AccessGUDID_Delimited_Full_Release_20231001";
|
||||||
|
var input = "gmdnTerms.txt";
|
||||||
|
var format = "gmdnTerms-{0:000}.txt";
|
||||||
|
//var input = "device.txt";
|
||||||
|
//var format = "device-{0:000}.txt";
|
||||||
|
var size = int.MaxValue;
|
||||||
|
var info = new FileInfo(Path.Combine(path, input));
|
||||||
|
size = (int)Math.Min(info.Length / 10, size);
|
||||||
|
Split(Path.Combine(path, input), Path.Combine(path, format), size);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Split(string inputfile, string outputfilesformat, int maxSize = int.MaxValue, bool hasHeader = true)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
int size = 0;
|
||||||
|
StreamWriter outfile = null;
|
||||||
|
bool firstFile = true;
|
||||||
|
string headerLine = null;
|
||||||
|
string line;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var infile = new StreamReader(inputfile))
|
||||||
|
{
|
||||||
|
while (!infile.EndOfStream)
|
||||||
|
{
|
||||||
|
line = infile.ReadLine();
|
||||||
|
if (hasHeader && headerLine == null)
|
||||||
|
{
|
||||||
|
headerLine = line;
|
||||||
|
}
|
||||||
|
if (size > maxSize)
|
||||||
|
{
|
||||||
|
if (outfile != null)
|
||||||
|
{
|
||||||
|
outfile.Dispose();
|
||||||
|
outfile = null;
|
||||||
|
size = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(line))
|
||||||
|
{
|
||||||
|
if (outfile != null)
|
||||||
|
{
|
||||||
|
outfile.Dispose();
|
||||||
|
outfile = null;
|
||||||
|
size = 0;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (outfile == null)
|
||||||
|
{
|
||||||
|
outfile = new StreamWriter(
|
||||||
|
string.Format(outputfilesformat, i++),
|
||||||
|
false,
|
||||||
|
infile.CurrentEncoding);
|
||||||
|
if (!firstFile && hasHeader)
|
||||||
|
{
|
||||||
|
outfile.WriteLine(headerLine);
|
||||||
|
}
|
||||||
|
firstFile = false;
|
||||||
|
}
|
||||||
|
outfile.WriteLine(line);
|
||||||
|
size += line.Length;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (outfile != null)
|
||||||
|
outfile.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.5.33516.290
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "splitfile", "splitfile.csproj", "{3687F04B-882A-4524-BAD7-1E7D68B3661C}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{3687F04B-882A-4524-BAD7-1E7D68B3661C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{3687F04B-882A-4524-BAD7-1E7D68B3661C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{3687F04B-882A-4524-BAD7-1E7D68B3661C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{3687F04B-882A-4524-BAD7-1E7D68B3661C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {C6388701-C197-4C93-8B96-20A593AEF339}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
Reference in New Issue
Block a user