defend
6 years ago
9 changed files with 66 additions and 9 deletions
@ -0,0 +1,9 @@ |
|||
namespace Pores.Controllers |
|||
{ |
|||
public abstract class BaseSaveController<TData> |
|||
{ |
|||
public virtual TData Data { get; set; } = default(TData); |
|||
public abstract void Save(); |
|||
public abstract void Load(); |
|||
} |
|||
} |
@ -0,0 +1,27 @@ |
|||
using Newtonsoft.Json; |
|||
using Pores.Models; |
|||
using System.Collections.Generic; |
|||
using System.IO; |
|||
|
|||
namespace Pores.Controllers |
|||
{ |
|||
public class PoresToFileController : BaseSaveController<IList<Pore>> |
|||
{ |
|||
public string FileName { get; } |
|||
|
|||
public override void Load() |
|||
{ |
|||
} |
|||
|
|||
public override void Save() |
|||
{ |
|||
var output = JsonConvert.SerializeObject(Data); |
|||
File.WriteAllText(FileName, output); |
|||
} |
|||
|
|||
public PoresToFileController(string fileName) |
|||
{ |
|||
FileName = fileName; |
|||
} |
|||
} |
|||
} |
@ -1,8 +1,11 @@ |
|||
namespace Pores.Models |
|||
using System; |
|||
|
|||
namespace Pores.Models |
|||
{ |
|||
[Serializable] |
|||
public class Pore |
|||
{ |
|||
public Coordinate GetCoordinate { get; set; } |
|||
public Coordinate Point { get; set; } |
|||
public double Radius { get; set; } |
|||
} |
|||
} |
|||
|
Loading…
Reference in new issue