Пример #1
0
        private object OnRemovePathFromProtection(object message)
        {
            var packet = ( RemovePathFromProtectionMessage )message;
            var ret    = new OperationResult();

            if (!this.CheckSession(packet.SessionKey))
            {
                ret.Value = false;
                return(ret);
            }

            bool removeResult;

            bool result = DevIoCore.IoRemovePathFromProtection(packet.UniqueKey, out removeResult);

            if (result && removeResult)
            {
                string path = this.GetPathByUniqueKey(packet.UniqueKey);

                if (path != null)
                {
                    PathManager pathManager = new PathManager();
                    result = pathManager.DeletePath(path);
                }
                else
                {
                    ret.Value = false;
                    return(ret);
                }
            }

            if (result && removeResult)
            {
                result = this.paths.Remove(packet.UniqueKey);
            }

            ret.Value = result && removeResult;
            return(ret);
        }