Add commands for Broker, autosave and clean logging
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace PlantBox.Broker
|
||||
{
|
||||
class PlantBoxesManager
|
||||
class PlantBoxesManager : IEnumerable<PlantBox>
|
||||
{
|
||||
public string FilePath => Path.Combine(Environment.CurrentDirectory, FileName);
|
||||
public string FileName => "storage.json";
|
||||
@@ -70,5 +71,17 @@ namespace PlantBox.Broker
|
||||
|
||||
Console.WriteLine("Storage saved");
|
||||
}
|
||||
|
||||
public void ClearPlantBox(PlantBox plantBox)
|
||||
{
|
||||
if (plantBox != null)
|
||||
{
|
||||
plantBox.HistoricManager.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerator<PlantBox> GetEnumerator() => _plantBoxes.Values.GetEnumerator();
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user