public object Clone() { var data = new CPolicyData() { Version = Version, ID = ID }; foreach (CTriggerData t in Triggers) { data.Triggers.Add(t.Clone() as CTriggerData); } return(data); }
private void _Read(string path) { CPolicyData.MaxVersion = 0; CTriggerData.MaxVersion = 0; BinaryReader br = new BinaryReader(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read)); Header = br.ReadBytes(4); int count = br.ReadInt32(); ObservableCollection <CPolicyData> data = new ObservableCollection <CPolicyData>(); for (int i = 0; i < count; ++i) { CPolicyData cpd = new CPolicyData(); cpd.Read(br); data.Add(cpd); } _Controllers = new ObservableCollection <CPolicyData>(data); br.Close(); OnPropertyChanged("Controllers"); }