private SetupDirector() { Package = new SetupPackage(); Comm = HOW_TO_CONNECT.ETHERNET; if (System.IO.File.Exists(SETUP_FILE)) { using (var jsonFile = System.IO.File.OpenText(SETUP_FILE)) using (JsonTextReader jsonTextReader = new JsonTextReader(jsonFile)) { JsonSerializer serializer = new JsonSerializer(); Package = (SetupPackage)serializer.Deserialize(jsonTextReader, Package.GetType()); } } }
public SetupPackage(SetupPackage pack) { TimeInfo = new DayNightTimeInfo(pack.TimeInfo); SerialInfo = new SerialPortInfo(pack.SerialInfo); EthernetInfo = new EthernetInfo(pack.EthernetInfo); }