public Lock GetLock(string lockIdentifier) { if (locks.ContainsKey(lockIdentifier)) { return locks[lockIdentifier]; } var lockObject = new Lock(lockIdentifier); locks.Add(lockIdentifier, lockObject); newLocks.Add(lockObject); return lockObject; }
private void UnlockIdentifier(Lock lockObject) { if (lockObject.IsInitialized()) { if (lockObject.IsSystemLock()) { // disable this FlyByWire parameter AddOpcode(new OpcodePush(lockObject.Identifier)); AddOpcode(new OpcodePush(false)); AddOpcode(new OpcodeCall("toggleflybywire()")); // remove update trigger string triggerIdentifier = "lock-" + lockObject.Identifier; if (_context.Triggers.Contains(triggerIdentifier)) { Trigger triggerObject = _context.Triggers.GetTrigger(triggerIdentifier); AddOpcode(new OpcodePush(null)).DestinationLabel = triggerObject.GetFunctionLabel(); AddOpcode(new OpcodeRemoveTrigger()); } } // unlock variable AddOpcode(new OpcodePush(lockObject.PointerIdentifier)); AddOpcode(new OpcodePush(null)).DestinationLabel = lockObject.DefaultLabel; AddOpcode(new OpcodeStore()); } }
public Lock GetLock(string lockIdentifier) { if (_locks.ContainsKey(lockIdentifier)) { return _locks[lockIdentifier]; } else { Lock lockObject = new Lock(lockIdentifier); _locks.Add(lockIdentifier, lockObject); _newLocks.Add(lockObject); return lockObject; } }