Skip to content

Commit 6d97b3b

Browse files
committed
Folder edit
Added CSVFileException
1 parent cf52368 commit 6d97b3b

File tree

9 files changed

+29
-6
lines changed

9 files changed

+29
-6
lines changed

CSVSerializer.NET.sln

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 14
44
VisualStudioVersion = 14.0.24720.0
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSVSerializer", "CSVSerializer.NET.CS\CSVSerializer.csproj", "{0C962C28-B003-49A6-8991-1E6636583EFE}"
7-
EndProject
86
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo.CS", "Demo.CS\Demo.CS.csproj", "{3F5E30BE-D053-4B94-A671-88CA9C0754B9}"
97
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSVSerializer", "CSVSerializer.NET\CSVSerializer.csproj", "{0C962C28-B003-49A6-8991-1E6636583EFE}"
9+
EndProject
1010
Global
1111
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1212
Debug|Any CPU = Debug|Any CPU
1313
Release|Any CPU = Release|Any CPU
1414
EndGlobalSection
1515
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16-
{0C962C28-B003-49A6-8991-1E6636583EFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17-
{0C962C28-B003-49A6-8991-1E6636583EFE}.Debug|Any CPU.Build.0 = Debug|Any CPU
18-
{0C962C28-B003-49A6-8991-1E6636583EFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
19-
{0C962C28-B003-49A6-8991-1E6636583EFE}.Release|Any CPU.Build.0 = Release|Any CPU
2016
{3F5E30BE-D053-4B94-A671-88CA9C0754B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2117
{3F5E30BE-D053-4B94-A671-88CA9C0754B9}.Debug|Any CPU.Build.0 = Debug|Any CPU
2218
{3F5E30BE-D053-4B94-A671-88CA9C0754B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
2319
{3F5E30BE-D053-4B94-A671-88CA9C0754B9}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{0C962C28-B003-49A6-8991-1E6636583EFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{0C962C28-B003-49A6-8991-1E6636583EFE}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{0C962C28-B003-49A6-8991-1E6636583EFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{0C962C28-B003-49A6-8991-1E6636583EFE}.Release|Any CPU.Build.0 = Release|Any CPU
2424
EndGlobalSection
2525
GlobalSection(SolutionProperties) = preSolution
2626
HideSolutionNode = FALSE
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace CSVSerializer
8+
{
9+
public class CSVFileExcepion : Exception
10+
{
11+
public CSVFileExcepion(string message) : base(message)
12+
{
13+
message = "The input file is not a valid CSV file!\n" + message;
14+
}
15+
}
16+
}

CSVSerializer.NET.CS/CSVSerializer.csproj renamed to CSVSerializer.NET/CSVSerializer.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<DefineConstants>DEBUG;TRACE</DefineConstants>
2121
<ErrorReport>prompt</ErrorReport>
2222
<WarningLevel>4</WarningLevel>
23+
<DocumentationFile>bin\Debug\CSVSerializer.XML</DocumentationFile>
2324
</PropertyGroup>
2425
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2526
<DebugType>pdbonly</DebugType>
@@ -40,6 +41,7 @@
4041
<Reference Include="System.Xml" />
4142
</ItemGroup>
4243
<ItemGroup>
44+
<Compile Include="CSVFileExcepion.cs" />
4345
<Compile Include="Deserializer.cs" />
4446
<Compile Include="Row.cs" />
4547
<Compile Include="Serializer.cs" />

CSVSerializer.NET.CS/Deserializer.cs renamed to CSVSerializer.NET/Deserializer.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
namespace CSVSerializer
55
{
6+
/// <summary>
7+
/// This class allows you to deserialize a CSV file or an array
8+
/// </summary>
69
public class Deserializer
710
{
811
private StreamReader File;
@@ -31,6 +34,8 @@ public Document Deserialize()
3134
if (line[i] == '\"')
3235
{
3336
int closingQuoteIndex = IndexOf(line, '\"', i + 1); //copies all the stuff between the double quotes in the buffer
37+
if (closingQuoteIndex == -1)
38+
throw new CSVFileExcepion("Double quote mismatched");
3439
for (int a = i + 1; a < closingQuoteIndex; a++)
3540
{
3641
buffer[bufferIndex] = line[a];
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)