Exemplo n.º 1
0
 public static void ChangeSkillLock(int client, Skill skill, LockStatus lockStatus)
 {
     byte[] packet = new byte[] { 0x3A, 0x00, 0x06, 0x00, 0x00, 0x00 };
     packet[4] = (byte)skill;
     packet[5] = (byte)lockStatus;
     SendPacketToServer(client, packet);
 }
Exemplo n.º 2
0
 public static void ChangeSkillLock(int client, Skill skill, LockStatus lockStatus)
 {
     byte[] packet = new byte[] { 0x3A, 0x00, 0x06, 0x00, 0x00, 0x00 };
     packet[4] = (byte)skill;
     packet[5] = (byte)lockStatus;
     SendPacketToServer(client, packet);
 }
Exemplo n.º 3
0
        private static void OnSkillLockChanged(int client, PacketReader reader)
        {
            int        skillID3a    = reader.ReadInt16();
            LockStatus lockStatus3a = (LockStatus)reader.ReadByte();

            OutgoingPackets.OnSkillLockChanged(client, skillID3a, lockStatus3a);
        }
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (!(value is LockStatus))
            {
                return(value);
            }

            LockStatus lockStatus = (LockStatus)value;

            switch (lockStatus)
            {
            case LockStatus.Up:

                return(Properties.Resources.arrow_up.ToImageSource());

            case LockStatus.Down:

                return(Properties.Resources.arrow_down.ToImageSource());

            case LockStatus.Locked:

                return(Properties.Resources.padlock.ToImageSource());

            default:

                throw new ArgumentOutOfRangeException();
            }
        }
Exemplo n.º 5
0
		public async Task Lock()
		{
			++this.lockCount;

			if (this.status == LockStatus.Locked)
			{
				return;
			}
			if (this.status == LockStatus.LockRequesting)
			{
				await WaitLock();
				return;
			}
			
			this.status = LockStatus.LockRequesting;

			// 真身直接本地请求锁,镜像需要调用Rpc获取锁
			MasterComponent masterComponent = this.GetComponent<MasterComponent>();
			if (masterComponent != null)
			{
				await masterComponent.Lock(this.address);
			}
			else
			{
				RequestLock();
				await WaitLock();
			}
		}
Exemplo n.º 6
0
        public static void SetStatus(string stat, string lockStatus)
        {
            StatType   st = Utility.GetEnumValueByName <StatType>(stat);
            LockStatus ls = Utility.GetEnumValueByName <LockStatus>(lockStatus);

            UOC.ChangeStatLock(st, ls);
        }
Exemplo n.º 7
0
        private LockStatus CalculateLockStatus(string personID, DateTime currentTime, Lock currentLock)
        {
            LockStatus status = LockStatus.NotLocked;

            if (currentLock != null)
            {
                if (string.Compare(personID, currentLock.PersonID, true) == 0)
                {
                    if (currentLock.LockTime.Add(currentLock.EffectiveTime) < currentTime)
                    {
                        status = LockStatus.LockedByRightAndExpire;
                    }
                    else
                    {
                        status = LockStatus.LockedByRight;
                    }
                }
                else
                {
                    if (currentLock.LockTime.Add(currentLock.EffectiveTime) < currentTime)
                    {
                        status = LockStatus.LockByAnotherAndExpire;
                    }
                    else
                    {
                        status = LockStatus.LockedByAnother;
                    }
                }
            }

            return(status);
        }
Exemplo n.º 8
0
        private static void OnSkillsList(PacketReader reader)
        {
            /*byte type = */
            reader.ReadByte();
            int        id         = reader.ReadInt16();
            int        value      = reader.ReadInt16();
            int        baseValue  = reader.ReadInt16();
            LockStatus lockStatus = (LockStatus)reader.ReadByte();
            int        skillCap   = reader.ReadInt16();

            if (reader.Size <= 13)
            {
                SkillUpdatedEvent?.Invoke(id, (float)value / 10, (float)baseValue / 10, lockStatus,
                                          (float)skillCap / 10);
            }
            else
            {
                SkillInfo si = new SkillInfo
                {
                    Value      = (float)value / 10,
                    BaseValue  = (float)baseValue / 10,
                    LockStatus = lockStatus,
                    SkillCap   = (float)skillCap / 10,
                    ID         = id - 1
                };

                List <SkillInfo> skillInfoList = new List <SkillInfo>(128)
                {
                    si
                };

                for ( ;;)
                {
                    id = reader.ReadInt16();

                    if (id == 0)
                    {
                        break;
                    }

                    value      = reader.ReadInt16();
                    baseValue  = reader.ReadInt16();
                    lockStatus = (LockStatus)reader.ReadByte();
                    skillCap   = reader.ReadInt16();

                    si = new SkillInfo
                    {
                        Value      = (float)value / 10,
                        BaseValue  = (float)baseValue / 10,
                        LockStatus = lockStatus,
                        SkillCap   = (float)skillCap / 10,
                        ID         = id - 1
                    };

                    skillInfoList.Add(si);
                }

                SkillsListEvent?.Invoke(skillInfoList.ToArray());
            }
        }
Exemplo n.º 9
0
        protected static string GetStatusPromptText(LockStatus status, string lockUserName)
        {
            string result = string.Empty;

            switch (status)
            {
            case LockStatus.LockedByAnother:
                result = string.Format("该资源已被{0}加锁", lockUserName);
                break;

            case LockStatus.NotLocked:
                result = "原资源锁已被破坏";
                break;

            case LockStatus.LockByAnotherAndExpire:
                result = string.Format("该资源已被{0}加锁,并已过期,验证失败", lockUserName);
                break;

            case LockStatus.LockedByRight:
                result = "锁未过期";
                break;

            case LockStatus.LockedByRightAndExpire:
                result = "锁已过期,请重新加锁";
                break;
            }

            return(result);
        }
Exemplo n.º 10
0
        public void ChangeLockButtonStatus(LockStatus lockStatus)
        {
            switch (lockStatus)
            {
            case LockStatus.Locked:
            {
                uxLockStateButton.Text        = "Locked";
                uxLockStateButton.ToolTipText = "Currently locked, click for more information and to unlock";
                uxLockStateButton.Image       = new Bitmap(Resources.lockedIcon);
            }
            break;

            //case LockStatus.Unlocked:
            //    {
            //        uxLockStateButton.Text = "Unlocked";
            //        uxLockStateButton.ToolTipText = "";
            //        uxLockStateButton.Image = new Bitmap(Resources.unlockIcon);
            //    }
            //    break;
            default:
            {
                uxLockStateButton.Text        = "Unlocked";
                uxLockStateButton.ToolTipText = "Currently unlocked, click for more information and to Lock";
                uxLockStateButton.Image       = new Bitmap(Resources.unlockIcon);
            }
            break;
            }
        }
Exemplo n.º 11
0
        public static ResultType GetWriteLock <ResultType>(ReaderWriterLockSlim lockObj, int timeout, DoWorkFunc <ResultType> doWork)
        {
            LockStatus status = (lockObj.IsWriteLockHeld
                ? LockStatus.WriteLock
                : (lockObj.IsReadLockHeld ? LockStatus.ReadLock : LockStatus.Unlocked));

            if (status == LockStatus.ReadLock)
            {
                lockObj.TryEnterWriteLock(timeout);
            }
            else if (status == LockStatus.Unlocked)
            {
                lockObj.TryEnterWriteLock(timeout);
            }

            try
            {
                return(doWork());
            }
            finally
            {
                if (status == LockStatus.ReadLock)
                {
                    lockObj.ExitWriteLock();
                }
                else if (status == LockStatus.Unlocked)
                {
                    lockObj.ExitWriteLock();
                }
            }
        }
        public static DiskGroupLockResult LockDiskGroup(List <DynamicDisk> diskGroup)
        {
            // Lock disks and volumes
            LockStatus status = LockManager.LockDynamicDiskGroup(diskGroup, true);

            if (status != LockStatus.Success)
            {
                if (status == LockStatus.CannotLockDisk)
                {
                    return(DiskGroupLockResult.CannotLockDisk);
                }
                else
                {
                    return(DiskGroupLockResult.CannotLockVolume);
                }
            }

            if (Environment.OSVersion.Version.Major >= 6)
            {
                if (!DiskOfflineHelper.IsDiskGroupOnlineAndWritable(diskGroup))
                {
                    LockManager.UnlockAllDisksAndVolumes();
                    return(DiskGroupLockResult.OneOrMoreDisksAreOfflineOrReadonly);
                }

                bool success = DiskOfflineHelper.OfflineAllOrNone(diskGroup);
                if (!success)
                {
                    LockManager.UnlockAllDisksAndVolumes();
                    return(DiskGroupLockResult.CannotTakeDiskOffline);
                }
            }

            return(DiskGroupLockResult.Success);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Waits for entity lock release.
        /// </summary>
        /// <param name="containerTitle">The container title.</param>
        /// <param name="path">The path.</param>
        /// <param name="entityId">The entity id.</param>
        /// <param name="timeoutMs">The timeout ms.</param>
        public void WaitForEntityLockRelease(string containerTitle, string path, Guid entityId, int?timeoutMs)
        {
            LockStatus lockStatus = GetEntityLockStatus(containerTitle, path, entityId);

            if (timeoutMs != null)
            {
                Stopwatch sw = new Stopwatch();
                sw.Start();
                while (lockStatus == LockStatus.Locked && sw.ElapsedMilliseconds < timeoutMs)
                {
                    System.Threading.Thread.Sleep(250);
                    lockStatus = GetEntityLockStatus(containerTitle, path, entityId);
                }

                if (lockStatus == LockStatus.Locked && sw.ElapsedMilliseconds > timeoutMs)
                {
                    throw new InvalidOperationException("Timeout occurred while waiting for the lock to release. " + sw.ElapsedMilliseconds);
                }
                sw.Stop();
            }
            else
            {
                while (lockStatus == LockStatus.Locked)
                {
                    System.Threading.Thread.Sleep(250);
                    lockStatus = GetEntityLockStatus(containerTitle, path, entityId);
                }
            }
        }
Exemplo n.º 14
0
        public async Task Lock()
        {
            ++this.lockCount;

            if (this.status == LockStatus.Locked)
            {
                return;
            }
            if (this.status == LockStatus.LockRequesting)
            {
                await WaitLock();

                return;
            }

            this.status = LockStatus.LockRequesting;

            // 真身直接本地请求锁,镜像需要调用Rpc获取锁
            MasterComponent masterComponent = this.GetComponent <MasterComponent>();

            if (masterComponent != null)
            {
                await masterComponent.Lock(this.address);
            }
            else
            {
                RequestLock();
                await WaitLock();
            }
        }
 public DoorBusinessObject(int id, string name, LockStatus lockStatus, OpenStatus openStatus)
 {
     Id         = id;
     Name       = name;
     LockStatus = lockStatus;
     OpenStatus = openStatus;
     UpdateActionList();
 }
Exemplo n.º 16
0
 public new object ToClient()
 {
     return(new {
         playerName = Player.Name,
         dices = Dices.Select(d => d.ToClient()),
         lockStatus = LockStatus.ToString()
     });
 }
Exemplo n.º 17
0
 private void Locker_LockStatusChanged(object sender, GenericEventArgs <LockStatus> e)
 {
     if (_idle && storedStatus != CurrentStatus)
     {
         storedStatus = CurrentStatus;
         LockStatusChanged?.Invoke(this, new GenericEventArgs <LockStatus>(CurrentStatus));
     }
 }
Exemplo n.º 18
0
 public ChangeStatLock(StatType stat, LockStatus lockStatus)
 {
     _writer = new PacketWriter(7);
     _writer.Write((byte)0xBF);
     _writer.Write((short)7);
     _writer.Write((short)0x1A);
     _writer.Write((byte)stat);
     _writer.Write((byte)lockStatus);
 }
 private static void OutgoingPackets_SkillLockChangedEvent(int client, int skillID, LockStatus lockStatus)
 {
     ClientInfo ci;
     if (ClientInfoCollection.GetClient(client, out ci))
     {
         SkillInfo si = ci.GetSkillInfo(skillID);
         si.LockStatus = lockStatus;
     }
 }
Exemplo n.º 20
0
 public bool Close()
 {
     if (status == LockStatus.Closed)
     {
         throw new LockException("Already Closed");
     }
     status = LockStatus.Closed;
     return(true);
 }
Exemplo n.º 21
0
 public bool Open()
 {
     if (status == LockStatus.Opened)
     {
         throw new LockException("Already Opened");
     }
     status = LockStatus.Opened;
     return(true);
 }
Exemplo n.º 22
0
 public ChangeSkillLock(SkillEntry skill, LockStatus lockStatus)
 {
     _writer = new PacketWriter(6);
     _writer.Write((byte)0x3A);
     _writer.Write((short)6);
     _writer.Write((byte)0);
     _writer.Write((byte)skill.Skill.ID);
     _writer.Write((byte)lockStatus);
 }
Exemplo n.º 23
0
        public static void ChangeSkillLock(SkillEntry skill, LockStatus lockStatus, bool requery = true)
        {
            Engine.SendPacketToServer(new ChangeSkillLock(skill, lockStatus));

            if (requery)
            {
                Engine.SendPacketToServer(
                    new MobileQuery(Engine.Player?.Serial ?? 0, MobileQueryType.SkillsRequest));
            }
        }
Exemplo n.º 24
0
 public Session(string SessionId, string LocalFilePath)
 {
     _FileInfo      = new FileInfo(LocalFilePath);
     _SessionId     = SessionId;
     _LastUpdated   = DateTime.Now;
     _LocalFilePath = LocalFilePath;
     _Users         = new List <User>();
     _LockStatus    = LockStatus.UNLOCK;
     _LockString    = "";
     _ChangesMade   = false;
 }
Exemplo n.º 25
0
 public void SetLevelStatus(int id, LockStatus status)
 {
     foreach (var level in _levels)
     {
         if (level.Data.Id == id)
         {
             level.Data.CurrentStatus = status;
             break;
         }
     }
 }
Exemplo n.º 26
0
 public LockTransactionResult(Guid tranID, string server, LockStatus status, LockErrorCause errorCause, string failedStatement, uint runtimeSec, double trustLevel, KeyValuePair <string, object>[] data)
 {
     TransactionID    = tranID;
     ServerHost       = server;
     Status           = status;
     ErrorCause       = errorCause;
     FailedStatement  = failedStatement;
     ServerRuntimeSec = runtimeSec;
     ServerTrustLevel = trustLevel;
     m_Data           = data;
 }
Exemplo n.º 27
0
        private static void OnSkillsList(int client, PacketReader reader)
        {
            byte       type       = reader.ReadByte();
            int        id         = reader.ReadInt16();
            int        value      = reader.ReadInt16();
            int        baseValue  = reader.ReadInt16();
            LockStatus lockStatus = (LockStatus)reader.ReadByte();
            int        skillCap   = 1000;                   //

            if (reader.Size != 11)                          // UOSteam doesn't send skillcap on changing locks in their UI
            {
                skillCap = reader.ReadInt16();              // So we kludge it and default to 100 skillcap
            }
            if (reader.Size == 11 || reader.Size == 13)     // 11 from UOSteam on lock change
            {
                IncomingPackets.OnSkillUpdate(client, id, (float)value / 10, (float)baseValue / 10, lockStatus, (float)skillCap / 10);
            }
            else
            {
                SkillInfo si = new SkillInfo();
                si.Value      = (float)value / 10;
                si.BaseValue  = (float)baseValue / 10;
                si.LockStatus = lockStatus;
                si.SkillCap   = (float)skillCap / 10;
                si.ID         = id - 1;

                List <SkillInfo> skillInfoList = new List <SkillInfo>(128);

                skillInfoList.Add(si);

                for (; ;)
                {
                    id = reader.ReadInt16();
                    if (id == 0)
                    {
                        break;
                    }
                    value      = reader.ReadInt16();
                    baseValue  = reader.ReadInt16();
                    lockStatus = (LockStatus)reader.ReadByte();
                    skillCap   = reader.ReadInt16();

                    si            = new SkillInfo();
                    si.Value      = (float)value / 10;
                    si.BaseValue  = (float)baseValue / 10;
                    si.LockStatus = lockStatus;
                    si.SkillCap   = (float)skillCap / 10;
                    si.ID         = id - 1;
                    skillInfoList.Add(si);
                }

                IncomingPackets.OnSkillList(client, skillInfoList.ToArray());
            }
        }
Exemplo n.º 28
0
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            IList items = (IList)((BindingProxy)values[0]).Data;
            IEnumerable <SkillEntry> skills = items.Cast <SkillEntry>();

            LockStatus lockStatus = (LockStatus)values[1];

            return(new SetSkillLockData {
                SkillEntries = skills, LockStatus = lockStatus
            });
        }
Exemplo n.º 29
0
        internal CheckLockResult(string personID, DataTable table)
            : base(personID)
        {
            if (table.Rows.Count > 0)
            {
                this.currentLock = new Lock();

                ORMapping.DataRowToObject(table.Rows[0], this.currentLock);

                this.currentLockStatus = CalculateLockStatus(personID, (DateTime)table.Rows[0]["CURRENT_TIME"], this.currentLock);
            }
        }
Exemplo n.º 30
0
        public string Parse(byte[] packet, int length, PacketDirection direction)
        {
            if (direction != PacketDirection.Outgoing || packet[0] != 0xBF || packet[4] != 0x1A)
            {
                return(null);
            }

            StatType   stat       = (StatType)packet[5];
            LockStatus lockStatus = (LockStatus)packet[6];

            return($"SetStatus(\"{stat.ToString().ToLower()}\", \"{lockStatus.ToString().ToLower()}\")\r\n");
        }
Exemplo n.º 31
0
        /**
         * Before you can use this instance, you unlock the door
         * @param usedCode
         */

        public void unlock(String code)
        {
// throws CannotUnlockDoorException {
            if (code.Equals(this.code))
            {
                lockStatus = LockStatus.UNLOCKED;
            }
            else
            {
                throw new CannotUnlockDoorException();
            }
        }
Exemplo n.º 32
0
        public async Task Release()
        {
            --this.lockCount;
            if (this.lockCount != 0)
            {
                return;
            }

            this.status = LockStatus.LockedNot;
            Session session = Game.Scene.GetComponent <NetInnerComponent>().Get(this.address);
            G2G_LockReleaseRequest request = new G2G_LockReleaseRequest();
            await session.Call <G2G_LockReleaseResponse>(request);
        }
        public static DiskGroupLockResult ExtendPartition(Partition volume, long numberOfAdditionalExtentSectors)
        {
            if (volume.Disk is PhysicalDisk)
            {
                if (Environment.OSVersion.Version.Major >= 6)
                {
                    bool isReadOnly;
                    bool isOnline = ((PhysicalDisk)volume.Disk).GetOnlineStatus(out isReadOnly);
                    if (!isOnline || isReadOnly)
                    {
                        return(DiskGroupLockResult.OneOrMoreDisksAreOfflineOrReadonly);
                    }
                }

                LockStatus status = LockHelper.LockBasicDiskAndVolumesOrNone(((PhysicalDisk)volume.Disk));
                if (status == LockStatus.CannotLockDisk)
                {
                    return(DiskGroupLockResult.CannotLockDisk);
                }
                else if (status == LockStatus.CannotLockVolume)
                {
                    return(DiskGroupLockResult.CannotLockVolume);
                }

                if (Environment.OSVersion.Version.Major >= 6)
                {
                    bool success = ((PhysicalDisk)volume.Disk).SetOnlineStatus(false);
                    if (!success)
                    {
                        return(DiskGroupLockResult.CannotTakeDiskOffline);
                    }
                }
            }

            ExtendHelper.ExtendPartition(volume, numberOfAdditionalExtentSectors);

            if (volume.Disk is PhysicalDisk)
            {
                if (Environment.OSVersion.Version.Major >= 6)
                {
                    bool success = ((PhysicalDisk)volume.Disk).SetOnlineStatus(true);
                }
                LockHelper.UnlockBasicDiskAndVolumes((PhysicalDisk)volume.Disk);
                ((PhysicalDisk)volume.Disk).UpdateProperties();
            }

            return(DiskGroupLockResult.Success);
        }
Exemplo n.º 34
0
		private async void RequestLock()
		{
			try
			{
				Session session = Game.Scene.GetComponent<NetInnerComponent>().Get(this.address);
				string serverAddress = Game.Scene.GetComponent<StartConfigComponent>().StartConfig.ServerIP;
				G2G_LockRequest request = new G2G_LockRequest { Id = this.Owner.Id, Address = serverAddress };
				await session.Call<G2G_LockRequest, G2G_LockResponse>(request);

				this.status = LockStatus.Locked;

				foreach (TaskCompletionSource<bool> taskCompletionSource in this.queue)
				{
					taskCompletionSource.SetResult(true);
				}
				this.queue.Clear();
			}
			catch (Exception e)
			{
				Log.Error($"获取锁失败: {this.address} {this.Owner.Id} {e}");
			}
		}
Exemplo n.º 35
0
		public void SetLockStatus(string url, LockStatus status, string comment)
		{
			Logger.LogMethod();
			try
			{
				using (new UserImpersonator())
				{
					object o = SharePointHelper.GetSharePointObjectByType(url, Workshare.Connect.SharePoint.WebService.Item.ItemKind.File);
					if (o == null || !(o is SPFile))
						return;
					SPFile file = o as SPFile;
					SPFile.SPCheckOutStatus lockStatus = file.CheckOutStatus;
					if (status == LockStatus.Locked && lockStatus == SPFile.SPCheckOutStatus.None)
						file.CheckOut();
					else if (status == LockStatus.Unlocked && lockStatus != SPFile.SPCheckOutStatus.None && lockStatus != SPFile.SPCheckOutStatus.ShortTerm)
						file.CheckIn(comment);
				}
			}
			catch (Exception ex)
			{
				Logger.LogException(ex.Message, ex);
				throw;
			}
		}
Exemplo n.º 36
0
 /// <remarks/>
 public System.IAsyncResult BeginSetLockStatus(string url, LockStatus status, string comment, System.AsyncCallback callback, object asyncState) {
     return this.BeginInvoke("SetLockStatus", new object[] {
                 url,
                 status,
                 comment}, callback, asyncState);
 }
Exemplo n.º 37
0
 internal static void OnSkillLockChanged(int client, int skillID, LockStatus lockStatus)
 {
     dSkillLockChanged handler = InternalSkillLockChangedEvent;
     if (handler != null) handler(client, skillID, lockStatus);
     lock (mySkillLockChangedLock)
     {
         handler = mySkillLockChangedEvent;
         try
         {
             if (handler != null) handler(client, skillID, lockStatus);
         }
         catch (Exception x)
         {
             Log.LogMessage(x);
         }
     }
 }
Exemplo n.º 38
0
		protected static string GetStatusPromptText(LockStatus status, string lockUserName)
		{
			string result = string.Empty;

			switch (status)
			{
				case LockStatus.LockedByAnother:
					result = string.Format("该资源已被{0}加锁", lockUserName);
					break;
				case LockStatus.NotLocked:
					result = "原资源锁已被破坏";
					break;
				case LockStatus.LockByAnotherAndExpire:
					result = string.Format("该资源已被{0}加锁,并已过期,验证失败", lockUserName);
					break;
				case LockStatus.LockedByRight:
					result = "锁未过期";
					break;
				case LockStatus.LockedByRightAndExpire:
					result = "锁已过期,请重新加锁";
					break;
			}

			return result;
		}
Exemplo n.º 39
0
		internal CheckLockResult(string personID, DataTable table)
			: base(personID)
		{
			if (table.Rows.Count > 0)
			{
				this.currentLock = new Lock();

				ORMapping.DataRowToObject(table.Rows[0], this.currentLock);

				this.currentLockStatus = CalculateLockStatus(personID, (DateTime)table.Rows[0]["CURRENT_TIME"], this.currentLock);
			}
		}
Exemplo n.º 40
0
 /// <remarks/>
 public void SetLockStatusAsync(string url, LockStatus status, string comment) {
     this.SetLockStatusAsync(url, status, comment, null);
 }
Exemplo n.º 41
0
 /// <remarks/>
 public void SetLockStatusAsync(string url, LockStatus status, string comment, object userState) {
     if ((this.SetLockStatusOperationCompleted == null)) {
         this.SetLockStatusOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetLockStatusOperationCompleted);
     }
     this.InvokeAsync("SetLockStatus", new object[] {
                 url,
                 status,
                 comment}, this.SetLockStatusOperationCompleted, userState);
 }
Exemplo n.º 42
0
 public Lock(ReaderWriterSpinLock parent, LockStatus status)
 {
     _parent = parent;
     _status = status;
 }
Exemplo n.º 43
0
 internal static void OnSkillUpdate(int client, int skillID, float value, float baseValue, LockStatus lockStatus, float skillCap)
 {
     dSkillUpdate handler = InternalSkillUpdateEvent;
     if (handler != null) handler(client, skillID, value, baseValue, lockStatus, skillCap);
     lock (mySkillUpdateLock)
     {
         handler = mySkillUpdateEvent;
         try { if (handler != null) handler(client, skillID, value, baseValue, lockStatus, skillCap); }
         catch (Exception ex) { Log.LogMessage(ex); }
     }
 }
Exemplo n.º 44
0
 /**
  *
  */
 public void Locker()
 {
     this.lockStatus = LockStatus.LOCKED;
 }
Exemplo n.º 45
0
 private static void IncomingPackets_SkillUpdateEvent(int client, int skillID, float value, float baseValue, LockStatus lockStatus, float skillCap)
 {
     ClientInfo ci;
     if (ClientInfoCollection.GetClient(client, out ci))
     {
         SkillInfo si = ci.GetSkillInfo(skillID);
         if (si != null)
         {
             si.BaseValue = baseValue;
             si.LockStatus = lockStatus;
             si.SkillCap = skillCap;
             si.Value = value;
         }
     }
 }
Exemplo n.º 46
0
 public void SetLockStatus(string url, LockStatus status, string comment) {
     this.Invoke("SetLockStatus", new object[] {
                 url,
                 status,
                 comment});
 }
Exemplo n.º 47
0
		internal SetLockResult(string personID, DataTable table)
			: base(personID)
		{
			ExceptionHelper.FalseThrow(table.Rows.Count == 2,
				"加锁后返回的结果集的行数必须为2,现在是{1}", table.Rows.Count);

			if (table.Rows[0]["LOCK_ID"] != DBNull.Value)
			{
				this.newLock = new Lock();

				ORMapping.DataRowToObject(table.Rows[0], this.newLock);
			}

			if (table.Rows[1]["LOCK_ID"] != DBNull.Value)
			{
				this.originalLock = new Lock();

				ORMapping.DataRowToObject(table.Rows[1], this.originalLock);
			}

			this.originalLockStatus = CalculateLockStatus(this.newLock, this.originalLock);
		}
Exemplo n.º 48
0
		public async Task Release()
		{
			--this.lockCount;
			if (this.lockCount != 0)
			{
				return;
			}

			this.status = LockStatus.LockedNot;
			Session session = Game.Scene.GetComponent<NetInnerComponent>().Get(this.address);
			G2G_LockReleaseRequest request = new G2G_LockReleaseRequest();
			await session.Call<G2G_LockReleaseRequest, G2G_LockReleaseResponse>(request);
		}
Exemplo n.º 49
0
 public bool Release()
 {
     var ret = false;
     switch (_status)
     {
         case LockStatus.Reader:
             ret = _parent.ExitReadLock();
             break;
         case LockStatus.Writer:
             _parent.ExitWriteLock();
             ret = true;
             break;
     }
     _status = LockStatus.None;
     return ret;
 }
Exemplo n.º 50
0
 public bool UpgradeToWriter(bool block = true)
 {
     if (_status != LockStatus.Reader)
         throw new SynchronizationLockException("Read lock not held");
     if (_parent.UpgradeReadLock(block))
     {
         _status = LockStatus.Writer;
         return true;
     }
     return false;
 }
Exemplo n.º 51
0
 /**
  * Before you can use this instance, you unlock the door
  * @param usedCode
  */
 public void unlock(String code)
 {
     // throws CannotUnlockDoorException {
     if (code.Equals(this.code))
     {
         lockStatus = LockStatus.UNLOCKED;
     }
     else
     {
         throw new CannotUnlockDoorException();
     }
 }
Exemplo n.º 52
0
 public void DowngradeToReader()
 {
     if (_status == LockStatus.Writer)
     {
         _parent.DowngradeWriteLock();
         _status = LockStatus.Reader;
     }
     else
         throw new SynchronizationLockException("Write lock not held");
 }