예제 #1
0
 public Metadata()
 {
     Occ                     = new OccData(this);
     LocomotivesData         = new LocomotivesData(this);
     LocomotivesDurationData = new DurationsData(this);
     FeedbacksData           = new FeedbacksData(this);
 }
예제 #2
0
        public bool LoadOccData(string pathToOccmodel, bool resetToInitState = false)
        {
            if (string.IsNullOrEmpty(pathToOccmodel))
            {
                return(false);
            }
            if (!File.Exists(pathToOccmodel))
            {
                File.WriteAllText(pathToOccmodel, "[]", Encoding.UTF8);
            }
            Occ = new OccData(this);
            var r = Occ.Load(pathToOccmodel);

            if (resetToInitState)
            {
                foreach (var it in Occ.Blocks)
                {
                    if (it == null)
                    {
                        continue;
                    }
                    it.FinalBlock   = string.Empty;
                    it.RouteToFinal = string.Empty;
                    it.FinalEntered = false;
                }
                Save(SaveModelType.OccData);
            }

            return(r);
        }