mirror of
https://github.com/bvanroll/cs-oo-project.git
synced 2025-08-29 20:12:40 +00:00
yup
This commit is contained in:
49
Online Gokkantoor/Data/Data.csproj
Normal file
49
Online Gokkantoor/Data/Data.csproj
Normal file
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{46C1FC26-4A1F-43E4-8682-853010AB38AC}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>Data</RootNamespace>
|
||||
<AssemblyName>Data</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="data.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Globals\Globals.csproj">
|
||||
<Project>{3643BC50-8412-4C17-99E0-9D4BF7EDEB78}</Project>
|
||||
<Name>Globals</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
26
Online Gokkantoor/Data/Properties/AssemblyInfo.cs
Normal file
26
Online Gokkantoor/Data/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle("Data")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("${AuthorCopyright}")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
130
Online Gokkantoor/Data/data.cs
Normal file
130
Online Gokkantoor/Data/data.cs
Normal file
@@ -0,0 +1,130 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Globals.classes;
|
||||
using Globals.Interfaces;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Data
|
||||
{
|
||||
public class dataLayer : IData
|
||||
{
|
||||
public dataLayer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<Bet> getBets()
|
||||
{
|
||||
List<Bet> list = new List<Bet>();
|
||||
try
|
||||
{
|
||||
using (StreamReader file = File.OpenText(@"Data/bets.json"))
|
||||
{
|
||||
|
||||
JsonSerializer serializer = new JsonSerializer();
|
||||
list = (List<Bet>)serializer.Deserialize(file, typeof(List<Bet>));
|
||||
|
||||
}
|
||||
} catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Game> getGames()
|
||||
{
|
||||
List<Game> list = new List<Game>();
|
||||
|
||||
try
|
||||
{
|
||||
using (StreamReader file = File.OpenText(@"Data/games.json"))
|
||||
{
|
||||
JsonSerializer serializer = new JsonSerializer();
|
||||
list = (List<Game>)serializer.Deserialize(file, typeof(List<Game>));
|
||||
|
||||
}
|
||||
} catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Person> getPersons()
|
||||
{
|
||||
|
||||
List<Person> list = new List<Person>();
|
||||
try {
|
||||
using (StreamReader file = File.OpenText(@"Data/persons.json"))
|
||||
{
|
||||
JsonSerializer serializer = new JsonSerializer();
|
||||
list = (List<Person>)serializer.Deserialize(file, typeof(List<Person>));
|
||||
|
||||
}
|
||||
} catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Ploeg> getPloegen()
|
||||
{
|
||||
List<Ploeg> list = new List<Ploeg>();
|
||||
try
|
||||
{
|
||||
using (StreamReader file = File.OpenText(@"Data/ploegen.json"))
|
||||
{
|
||||
JsonSerializer serializer = new JsonSerializer();
|
||||
list = (List<Ploeg>)serializer.Deserialize(file, typeof(List<Ploeg>));
|
||||
|
||||
}
|
||||
} catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public void saveBets(List<Bet> b)
|
||||
{
|
||||
using (StreamWriter file = File.CreateText(@"Data/bets.json"))
|
||||
{
|
||||
JsonSerializer serializer = new JsonSerializer();
|
||||
serializer.Serialize(file, b);
|
||||
}
|
||||
}
|
||||
|
||||
public void saveGames(List<Game> g)
|
||||
{
|
||||
using (StreamWriter file = File.CreateText(@"Data/games.json"))
|
||||
{
|
||||
JsonSerializer serializer = new JsonSerializer();
|
||||
serializer.Serialize(file, g);
|
||||
}
|
||||
}
|
||||
|
||||
public void savePersons(List<Person> p)
|
||||
{
|
||||
using (StreamWriter file = File.CreateText(@"Data/persons.json"))
|
||||
{
|
||||
JsonSerializer serializer = new JsonSerializer();
|
||||
serializer.Serialize(file, p);
|
||||
}
|
||||
}
|
||||
|
||||
public void savePloegen(List<Ploeg> p)
|
||||
{
|
||||
using (StreamWriter file = File.CreateText(@"Data/ploegen.json"))
|
||||
{
|
||||
JsonSerializer serializer = new JsonSerializer();
|
||||
serializer.Serialize(file, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
4
Online Gokkantoor/Data/packages.config
Normal file
4
Online Gokkantoor/Data/packages.config
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net47" />
|
||||
</packages>
|
Reference in New Issue
Block a user