diff --git a/psychorientation/psychorientation/Config.cs b/psychorientation/psychorientation/Config.cs new file mode 100644 index 0000000000000000000000000000000000000000..16b19f61d75488cb12079ff45cf2a36ce370011a --- /dev/null +++ b/psychorientation/psychorientation/Config.cs @@ -0,0 +1,56 @@ +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; + } + } +} diff --git a/psychorientation/psychorientation/packages.config b/psychorientation/psychorientation/packages.config new file mode 100644 index 0000000000000000000000000000000000000000..8ab13a9023dec3cf548ee61ba183013bd098a297 --- /dev/null +++ b/psychorientation/psychorientation/packages.config @@ -0,0 +1,4 @@ +<?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 diff --git a/psychorientation/psychorientation/psychorientation.csproj b/psychorientation/psychorientation/psychorientation.csproj index 19cb37f40e1ce3227ecfd68116677e90d65bdc38..842cf6fdbc11df5aacef763bcbb27356c21e6105 100644 --- a/psychorientation/psychorientation/psychorientation.csproj +++ b/psychorientation/psychorientation/psychorientation.csproj @@ -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>