This commit is contained in:
Maddo 2016-11-07 16:20:31 +01:00
commit 7117b2e4a8
13 changed files with 834 additions and 675 deletions

View file

@ -35,6 +35,10 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
@ -57,6 +61,12 @@
<Name>CatalogVbLib</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="Settings\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

File diff suppressed because it is too large Load diff

View file

@ -1,25 +1,36 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace CatalogLib
{
public class PicSettings
{
//TODO: Singleton
private static PicSettings _instance = new PicSettings();
public static PicSettings Instance { get { return _instance; } }
private Dictionary<string, object> _settingsDict = new Dictionary<string, object>();
public PicSettings()
{
SetDefaults();
}
public string SerializeSettings()
{
return JsonConvert.SerializeObject(_settingsDict);
}
public void Set(string key, object value)
{
if (_settingsDict.ContainsKey(key))
@ -28,10 +39,27 @@ namespace CatalogLib
}
else
{
_settingsDict.Add(key,value);
_settingsDict.Add(key, value);
}
}
public void SetString(string key, string value )
{
Set(key, value);
}
public void SetInt(string key, int value)
{
Set(key,value);
}
public void SetBool(string key, bool value)
{
Set(key, value);
}
public bool Exists(string key)
{
return _settingsDict.ContainsKey(key);
@ -39,52 +67,50 @@ namespace CatalogLib
public int GetInt(string key)
{
return _settingsDict.ContainsKey(key) ? (int) _settingsDict[key] : 0;
return _settingsDict.ContainsKey(key) ? (int)_settingsDict[key] : 0;
}
public string GetString(string key)
{
return _settingsDict.ContainsKey(key) ? (string) _settingsDict[key] : string.Empty;
return _settingsDict.ContainsKey(key) ? (string)_settingsDict[key] : string.Empty;
}
public bool GetBool(string key)
{
return _settingsDict.ContainsKey(key) && (bool) _settingsDict[key];
return _settingsDict.ContainsKey(key) && (bool)_settingsDict[key];
}
public void SetBool(string key, bool value)
{
if (_settingsDict.ContainsKey(key))
{
_settingsDict[key] = value;
}
else
{
_settingsDict.Add(key, value);
}
}
public object GetObject(string key)
{
return _settingsDict.ContainsKey(key) ? _settingsDict[key] : null;
}
public void SetDefaults()
{
Set("dirSorgente",string.Empty);
Set("dirDestinazione",string.Empty);
Set("dirAggiornaSottodirectory", false);
Set("dirCreaSottoCartelle",false);
//Set("DirSorgente", string.Empty);
//Set("DirDestinazione", string.Empty);
//Set("DirAggiornaSottodirectory", false);
//Set("DirCreaSottoCartelle", false);
//Set();
}
public bool Grassetto
public bool DirAggiornaSottoDirectory
{
get { return this.GetBool("DirAggiornaSottoDirectory"); }
set
{
this.SetBool("DirAggiornaSottoDirectory", value);
}
}
public bool Grassetto
{
get { return GetBool("Grassetto"); }
set { SetBool("Grassetto", value);}
set { SetBool("Grassetto", value); }
}
public string IlFont //todo
@ -123,33 +149,33 @@ namespace CatalogLib
set { }
}
public bool AggiungiScritteMiniature
{
get { return false; }
set { }
}
public bool AggiungiScritteMiniature
{
get { return false; }
set { }
}
public string Suffisso
{
get { return string.Empty; }
set { }
}
public string Suffisso
{
get { return string.Empty; }
set { }
}
public string Codice
{
get { return null; }
set {}
}
public string Codice
{
get { return null; }
set { }
}
public int Trasparenza
{
get { return 0; }
}
public int Trasparenza
{
get { return 0; }
}
public string Posizione
{
get { return string.Empty; }
}
public string Posizione
{
get { return string.Empty; }
}
public bool UsaRotazioneAutomatica { get; set; }
public DateTime DataPartenza { get; set; }
@ -161,10 +187,14 @@ namespace CatalogLib
public string TestoFirmaStart { get; set; }
public string TestoFirmaStartV { get; set; }
public bool UsaForzaJpg { get; set; }
public string DirectorySorgente { get; set; }
public string DirectoryDestinazione { get; set; }
public string DirectorySorgente { get { return GetString("DirSorgente"); } set { SetString("DirSorgente", value); } }
public string DirectoryDestinazione { get { return GetString("DirDestinazione"); } set { SetString("DirDestinazione", value);} }
public float Margine { get; set; }
public float MargVert { get; set; }
public string Allineamento { get; set; }
public bool GeneraleForzaJPG { get { return GetBool("GeneraleForzaJPG"); } set { SetBool("GeneraleForzaJPG", value);} }
public bool GeneraleRotazioneAutomatica { get { return GetBool("GeneraleRotazioneAutomatica"); } set { SetBool("GeneraleRotazioneAutomatica", value); } }
public bool GeneraleSovrascriviFile { get { return GetBool("GeneraleSovrascriviFile"); } set { SetBool("GeneraleSovrascriviFile", value); } }
}
}

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net46" />
</packages>