public ExtSrel CreateRelation(ExtSDesc sdesc) { ExtSrel srel = new ExtSrel(); uint inst = GetRelationInstance(sdesc); srel.FileDescriptor = package.NewDescriptor(Data.MetaData.RELATION_FILE, 0, this.FileDescriptor.Group, inst); srel.RelationState.IsKnown = true; return(srel); }
public bool HasRelationWith(ExtSDesc sdsc) { foreach (uint inst in this.Relations.SimInstances) { if (sdsc.FileDescriptor.Instance == inst) { return(true); } } return(false); }
public void AddRelation(ExtSDesc sdesc) { foreach (ushort inst in Relations.SimInstances) { if (inst == (ushort)sdesc.FileDescriptor.Instance) { return; } } Relations.SimInstances = (ushort[])Helper.Add(Relations.SimInstances, (ushort)sdesc.FileDescriptor.Instance); this.Changed = true; }
protected override string GetResourceName(TypeAlias ta) { //if (!SimPe.Custom.Settings.SimNames) return base.GetResourceName(ta); ExtSDesc sdsc = FileTable.ProviderRegistry.SimDescriptionProvider.FindSim((ushort)this.FileDescriptor.Instance) as ExtSDesc; if (sdsc == null) { return(base.GetResourceName(ta)); } else { return(sdsc.SimName + " " + sdsc.SimFamilyName + " (Scores)"); } }
public static ExtSrel FindRelation(ExtSDesc cache, ExtSDesc src, ExtSDesc dst) { uint sinst = src.GetRelationInstance(dst); SimPe.PackedFiles.Wrapper.ExtSrel srel = cache.GetCachedRelation(sinst); if (srel == null) { SimPe.Interfaces.Files.IPackedFileDescriptor spfd = cache.Package.FindFile(Data.MetaData.RELATION_FILE, 0, cache.FileDescriptor.Group, sinst); if (spfd != null) { srel = new SimPe.PackedFiles.Wrapper.ExtSrel(); srel.ProcessData(spfd, cache.Package); } } return(srel); }
public uint GetRelationInstance(ExtSDesc sdesc) { return(((this.FileDescriptor.Instance & 0xffff) << 16) | (sdesc.FileDescriptor.Instance & 0xffff)); }
public ExtSrel FindRelation(ExtSDesc sdesc) { return(FindRelation(this, sdesc)); }
public static ExtSrel FindRelation(ExtSDesc src, ExtSDesc dst) { return(FindRelation(src, src, dst)); }
internal ExtSrel GetCachedRelation(ExtSDesc sdesc) { return(this.GetCachedRelation(GetRelationInstance(sdesc))); }
public void RemoveRelation(ExtSDesc sdesc) { Relations.SimInstances = (ushort[])Helper.Delete(Relations.SimInstances, (ushort)sdesc.FileDescriptor.Instance); this.Changed = true; }