Skip to content
Snippets Groups Projects
Commit ad1f0bc2 authored by Antoine Félix's avatar Antoine Félix
Browse files

Ajout de NewtonSoft pour gerer les fichiers JSON ainsi que d une classe Config dans "Config.js".

parent ccac57c9
Branches
No related merge requests found
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace psychorientation
{
class Config
{
private static Config instance;
public double coeffEffortOral;
public double coeffCompetenceOral;
public double coeffCompetenceEcrit;
public double coeffEffortEcrit;
public static Config getInstance()
{
if (Config.instance == null)
{
Config.instance = JsonConvert.DeserializeObject<Config>(File.ReadAllText("config.json"));
Console.WriteLine(Config.instance.coeffEffortOral);
return Config.instance;
}
else
{
return Config.instance;
}
}
public double getCoeffEffortOral()
{
return this.coeffEffortOral;
}
public double getCoeffCompetenceOral()
{
return this.coeffCompetenceOral;
}
public double getCoeffCompetenceEcrit()
{
return this.coeffCompetenceOral;
}
public double getCoeffEffortEcrit()
{
return this.coeffEffortEcrit;
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" />
</packages>
\ No newline at end of file
......@@ -33,6 +33,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
......@@ -46,6 +49,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Config.cs" />
<Compile Include="Eleve.cs" />
<Compile Include="Form1.cs">
<SubType>Form</SubType>
......@@ -85,6 +89,7 @@
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment