- Aggiornamento alla versione Microsoft.EntityFrameworkCore.Sqlite 8.0.0. - Aggiornamento alla versione Microsoft.Windows.SDK.BuildTools 10.0.26100.6584. - Migliorata l'interfaccia per l'inserimento di più URL/ID di aste. - Aggiunti pulsanti per "Aste Chiuse" e "Esporta" in MainWindow. - Creata finestra "Aste Chiuse" per visualizzare e gestire aste chiuse. - Implementato scraper per estrarre dati da aste chiuse. - Aggiunto supporto per esportazione dati in CSV, JSON e XML. - Introdotto contesto Entity Framework per statistiche delle aste. - Aggiunto servizio per calcolo e gestione delle statistiche. - Gestite preferenze di esportazione con salvataggio in file JSON.
42 lines
1018 B
C#
42 lines
1018 B
C#
using System;
|
|
using System.IO;
|
|
using System.Text.Json;
|
|
|
|
namespace AutoBidder.Utilities
|
|
{
|
|
internal static class ExportPreferences
|
|
{
|
|
private class Prefs { public string? LastExportExt { get; set; } }
|
|
private static readonly string _folder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "AutoBidder");
|
|
private static readonly string _file = Path.Combine(_folder, "exportprefs.json");
|
|
|
|
public static string? LoadLastExportExtension()
|
|
{
|
|
try
|
|
{
|
|
if (!File.Exists(_file)) return null;
|
|
var txt = File.ReadAllText(_file);
|
|
var p = JsonSerializer.Deserialize<Prefs>(txt);
|
|
if (p == null || string.IsNullOrEmpty(p.LastExportExt)) return null;
|
|
return p.LastExportExt;
|
|
}
|
|
catch
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public static void SaveLastExportExtension(string? ext)
|
|
{
|
|
try
|
|
{
|
|
if (!Directory.Exists(_folder)) Directory.CreateDirectory(_folder);
|
|
var p = new Prefs { LastExportExt = ext };
|
|
var txt = JsonSerializer.Serialize(p);
|
|
File.WriteAllText(_file, txt);
|
|
}
|
|
catch { }
|
|
}
|
|
}
|
|
}
|