示例#1
0
        public static bool IndexUnitFile(UnitFile file)
        {
            var name = file.UnitName;

            if (!UnitFiles.ContainsKey(name))
            {
                UnitFiles[name] = new List <UnitFile>();
            }

            if (file is OnDiskUnitFile)
            {
                UnitFiles[name].RemoveAll(u =>
                                          u is OnDiskUnitFile &&
                                          (u as OnDiskUnitFile).Path == (file as OnDiskUnitFile).Path);
            }

            UnitFiles[name].Add(file);

            if (Units.ContainsKey(name))
            {
                var unit = Units[name];
                unit.SetUnitDescriptor(GetUnitDescriptor(name));
            }
            else
            {
                AddUnit(CreateUnit(name));
            }

            return(true);
        }
示例#2
0
 public override void LoadUnitFile(UnitFile file)
 {
     File     = file;
     LoadTime = DateTime.UtcNow;
 }
示例#3
0
 public override void LoadUnitFile(string path)
 {
     File     = UnitParser.Parse <UnitFile>(path);
     LoadTime = DateTime.UtcNow;
 }