Ejemplo n.º 1
0
        public override IQueryable <Person> DefineModelList()
        {
            IQueryable <Person> qmembers;

            if (CanView != true)
            {
                qmembers = DbUtil.Db.PeopleQuery2("PeopleId = 0");
            }
            else if (StatusFlag.HasValue())
            {
                qmembers = DbUtil.Db.PeopleQuery2($"StatusFlag = '{StatusFlag}'", fromDirectory: true);
            }
            else if (OrgId.HasValue)
            {
                qmembers = DbUtil.Db.PeopleQuery2($"IsMemberOfDirectory( Org={OrgId} ) = 1 ", fromDirectory: true);
            }
            else if (DivId.HasValue)
            {
                qmembers = DbUtil.Db.PeopleQuery2($"IsMemberOfDirectory( Div={DivId} ) = 1", fromDirectory: true);
            }
            else
            {
                qmembers = DbUtil.Db.PeopleQuery2("PeopleId = 0");
            }

            if (Name.HasValue())
            {
                qmembers = from p in qmembers
                           where p.Family.HeadOfHousehold.LastName.Contains(Name) || p.Name.Contains(Name)
                           select p;
            }

            return(qmembers);
        }
Ejemplo n.º 2
0
        public void UpdateStatus()
        {
            List <Effect> removable = new List <Effect>();

            foreach (var effect in effects)
            {
                if (effect.duration.value == 0)
                {
                    removable.Append(effect);
                }
            }

            if (removable.Count != 0)
            {
                effects = effects.Except(removable).ToList();
            }

            if (HPCurrent <= 0)
            {
                dieTriggeredEffects(this);

                if (HPCurrent <= 0)
                {
                    status |= StatusFlag.Dead;
                    gameObject.SetActive(false);
                    BoardManager.Instance.boardStatus[position.col][position.row] = null;
                }
            }
        }
Ejemplo n.º 3
0
        public File GetFile(BackupDbEntities db, string path, Directory directory)
        {
            var file = db.Files.FirstOrDefault(fi => fi.FullPath == path);

            if (file == null)
            {
                var crc = GetCrc(path);
                var fi  = new FileInfo(path);

                StatusFlag status = StatusFlag.Unchanged;
                //if (fi.LastWriteTime < _30hoursAgo)
                status = StatusFlag.Changed;

                file = new File
                {
                    FullPath      = path,
                    IsNew         = (long)status,
                    Name          = fi.Name,
                    Crc           = crc,
                    DirectoryId   = directory.Id,
                    LastWriteTime = fi.LastWriteTime.Ticks
                };
                db.Files.Add(file);
            }
            else
            {
                CheckFileDiff(db, file);
            }
            return(file);
        }
Ejemplo n.º 4
0
 public void clear(params StatusFlag[] flagList)
 {
     foreach (StatusFlag flag in flagList)
     {
         Register = (Register & ~flag);
     }
 }
Ejemplo n.º 5
0
 public void set(params StatusFlag[] flagList)
 {
     foreach (StatusFlag flag in flagList)
     {
         Register = (Register | flag);
     }
 }
Ejemplo n.º 6
0
 public void toggle(params StatusFlag[] flagList)
 {
     foreach (StatusFlag flag in flagList)
     {
         Register = (Register ^ flag);
     }
 }
Ejemplo n.º 7
0
    static int IntToEnum(IntPtr L)
    {
        int        arg0 = (int)LuaDLL.lua_tonumber(L, 1);
        StatusFlag o    = (StatusFlag)arg0;

        ToLua.Push(L, o);
        return(1);
    }
Ejemplo n.º 8
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value != null)
     {
         StatusFlag flag = (StatusFlag)value;
         return(flag.ToString());
     }
     return(StatusFlag.NotStarted);
 }
Ejemplo n.º 9
0
 public bool GetAndLowerFlag(StatusFlag flag)
 {
     if (flags.ContainsKey(flag) && flags[flag])
     {
         //Logging.Debug("Lowered flag {0}.", flag.ToString());
         flags[flag] = false;
         return(true);
     }
     return(false);
 }
Ejemplo n.º 10
0
 // 处理角色状态
 private void ProcessStatus(StatusFlag flag, bool value)
 {
     switch (flag)
     {
     case StatusFlag.STUNNED:
         // 眩晕
         Owner.SetStatus(flag, value);
         break;
     }
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Changes the Status register by setting or clearing the given status flag.
 /// </summary>
 /// <param name="statusFlag">The status flag to be set/cleared.</param>
 /// <param name="set">The flag will be set if true and cleared if false.</param>
 public void ChangeStatusFlag(StatusFlag statusFlag, bool set = false)
 {
     if (!set)
     {
         Status &= (byte)~(1 << (byte)statusFlag);
     }
     else
     {
         Status |= (byte)(1 << (byte)statusFlag);
     }
 }
Ejemplo n.º 12
0
        void ProcessGoodOnesPrintBadOnes(StatusFlag st)
        {
            if (LastProcessedNode == null)
            {
                LastProcessedNode = root;
            }

            if (!(GetLastProcessNode(LastProcessedNode, st)))
            {
                Console.WriteLine($"Error!!Status {st} is invalid. Previous status is {LastProcessedNode?.Status}");
            }
        }
Ejemplo n.º 13
0
        // update last processed node from here
        // cs => Current staus
        // lpn => Last processed node
        bool GetLastProcessNode(Node lpn, StatusFlag cs)
        {
            if (lpn == null)
            {
                return(false);
            }

            if (lpn.Status == cs)
            {
                LastProcessedNode = lpn;
                Console.WriteLine($"Processed {cs}");
                return(true);
            }

            return(GetLastProcessNode(lpn.Right, cs) || GetLastProcessNode(lpn.Left, cs));
        }
 public static string GetStatus(StatusFlag status)
 {
     switch (status)
     {
         case StatusFlag.AcceptLoss:
             return STATUS_ACCEPT_LOSS;
         case StatusFlag.ChallengeMove:
             return STATUS_CHALLENGE_MOVE;
         case StatusFlag.ChallengeWin:
             return STATUS_CHALLENGE_WIN;
         case StatusFlag.DrawMove:
             return STATUS_DRAW_MOVE;
         case StatusFlag.WinningMove:
             return STATUS_WINNING_MOVE;
         case StatusFlag.AcceptDraw:
             return STATUS_ACCEPT_DRAW;
         default:
             return null;
     }
 }
Ejemplo n.º 15
0
        public void Display(string textToDisplay, StatusFlag flag = StatusFlag.Waiting)
        {
            if (flag == StatusFlag.OK)
            {
                this.BackColor = ((int)TmTechColor.Approved).ToColor();
                this.ForeColor = Color.White;
            }

            else if (flag == StatusFlag.Cancel)
            {
                this.BackColor = ((int)TmTechColor.Cancel).ToColor();
                this.ForeColor = Color.White;
            }
            else
            {
                this.BackColor = Color.White;
                this.ForeColor = Color.Black;
            }
            Text = textToDisplay;
            //Update();
            //thread1.Abort();
        }
Ejemplo n.º 16
0
 public void clear()
 {
     Register = StatusFlag.None;
 }
Ejemplo n.º 17
0
 public void SetFlag(StatusFlag flag)
 {
     CPSR |= (UInt32)flag;
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Checks if the given status flag is set.
 /// </summary>
 /// <param name="statusFlag">The flag to be checked.</param>
 /// <returns>True if the flag is set, otherwise false.</returns>
 public bool HasStatusFlag(StatusFlag statusFlag)
 {
     return((Status & (1 << (byte)statusFlag)) != 0);
 }
Ejemplo n.º 19
0
 public void ClearFlag(StatusFlag flag)
 {
     CPSR &= (UInt32) ~((UInt32)flag);
 }
Ejemplo n.º 20
0
 // 检测角色状态
 public bool CheckStatus(StatusFlag flag)
 {
     return(_status[(int)flag]);
 }
Ejemplo n.º 21
0
 // 设置角色状态,如眩晕、无敌
 public void SetStatus(StatusFlag flag, bool value)
 {
     // TODO  设置状态时判定当前状态时间和要设置的状态时间,取长的
     _status[(int)flag] = value;
 }
Ejemplo n.º 22
0
 byte getFlag(StatusFlag flag)
 {
     int bit = (int)flag;
     return (byte)((_P >> bit) & 1);
 }
Ejemplo n.º 23
0
 public void RaiseFlag(StatusFlag flag)
 {
     flags[flag] = true;
     //Logging.Debug("Raised flag {0}.", flag.ToString());
 }
Ejemplo n.º 24
0
 public void put(Word mask)
 {
     Register = (StatusFlag)mask;
 }
Ejemplo n.º 25
0
 public void put(Word source, StatusFlag mask)
 {
     Register = (Register & ~mask) | ((StatusFlag)source & mask);
 }
Ejemplo n.º 26
0
 public void toggle()
 {
     Register = (Register ^ StatusFlag.All);
 }
Ejemplo n.º 27
0
        // A couple of helpers for getting and setting bits for various registers
        void setFlag(StatusFlag flag, byte val)
        {
            int bit = (int)flag;

            // Get rid of the bit currently there, and put our bit there.
            _P = (byte)((_P & (~(1 << bit))) | ((val & 1) << bit));
        }
Ejemplo n.º 28
0
        private void GetConfiguration()
        {
            Selector = DbUtil.Db.Setting("PictureDirectorySelector", "");
            if (OrgId.HasValue)
            {
                Selector = "FromUrl";
            }
            else if (DivId.HasValue)
            {
                Selector = "FromUrl";
            }
            else if (Regex.IsMatch(Selector, @"\AF\d\d\z"))
            {
                StatusFlag = Selector;
            }
            else if (Regex.IsMatch(Selector, @"\A\d+\z"))
            {
                OrgId = Selector.ToInt();
            }

            if (OrgId.HasValue)
            {
                if (!CanView.HasValue)
                {
                    CanView = HttpContextFactory.Current.User.IsInRole("Admin") || DbUtil.Db.PeopleQuery2($@"
IsMemberOfDirectory( Org={OrgId} ) = 1 
AND PeopleId = {Util.UserPeopleId}", fromDirectory: true).Any();
                }
                //HasDirectory = (om.Organization.PublishDirectory ?? 0) > 0,

                TemplateName = Util.PickFirst(
                    Organization.GetExtra(DbUtil.Db, OrgId.Value, PictureDirectoryTemplateName),
                    PictureDirectoryTemplateName);
                SqlName = Util.PickFirst(
                    Organization.GetExtra(DbUtil.Db, OrgId.Value, PictureDirectorySqlName),
                    PictureDirectorySqlName);
            }
            else if (DivId.HasValue)
            {
                if (!CanView.HasValue)
                {
                    CanView = HttpContextFactory.Current.User.IsInRole("Admin") || DbUtil.Db.PeopleQuery2($@"
IsMemberOfDirectory( Div={DivId} ) = 1 
AND PeopleId = {Util.UserPeopleId}", fromDirectory: true).Any();
                }

                TemplateName = PictureDirectoryTemplateName + "-" + Selector;
                if (!DbUtil.Db.Contents.Any(vv => vv.Name == TemplateName && vv.TypeID == ContentTypeCode.TypeText))
                {
                    TemplateName = PictureDirectoryTemplateName;
                }

                SqlName = PictureDirectorySqlName + "-" + Selector;
                if (!DbUtil.Db.Contents.Any(vv => vv.Name == TemplateName && vv.TypeID == ContentTypeCode.TypeSqlScript))
                {
                    TemplateName = PictureDirectoryTemplateName;
                }
            }
            else if (StatusFlag.HasValue())
            {
                if (!CanView.HasValue)
                {
                    var hasstatus = (from v in DbUtil.Db.StatusFlags(StatusFlag)
                                     where v.PeopleId == Util.UserPeopleId
                                     where v.StatusFlags != null
                                     select v).Any();
                    CanView = hasstatus || HttpContextFactory.Current.User.IsInRole("Admin");
                }
                TemplateName = DbUtil.Db.Setting(PictureDirectoryTemplateName, PictureDirectoryTemplateName);
                SqlName      = DbUtil.Db.Setting(PictureDirectorySqlName, PictureDirectorySqlName);
            }
            else
            {
                ErrorMessage = "NotConfigured";
            }

            if (!ErrorMessage.HasValue() && CanView == false)
            {
                ErrorMessage = "NotAuthorized";
            }
        }
Ejemplo n.º 29
0
 public Node(StatusFlag status)
 {
     this.Status = status;
 }
Ejemplo n.º 30
0
        public override void Run(string[] args)
        {
            StatusFlag[] goodSeq1 =
                new StatusFlag[] { StatusFlag.Waiting, StatusFlag.Downloading, StatusFlag.Downloaded, StatusFlag.Installing, StatusFlag.Installed };

            StatusFlag[] goodSeq2 =
                new StatusFlag[] { StatusFlag.Waiting,
                                   StatusFlag.Downloading, StatusFlag.Downloading, StatusFlag.Downloading,
                                   StatusFlag.Downloaded, StatusFlag.Installing, StatusFlag.Installed };

            StatusFlag[] badSeq1 =
                new StatusFlag[] { StatusFlag.Waiting,
                                   StatusFlag.Downloading, StatusFlag.Downloading, StatusFlag.Downloading,
                                   StatusFlag.Downloaded, StatusFlag.Installing, StatusFlag.Installed, StatusFlag.Waiting, StatusFlag.Downloading };

            StatusFlag[] badSeq2 =
                new StatusFlag[] { StatusFlag.Waiting,
                                   StatusFlag.Downloading, StatusFlag.Downloading, StatusFlag.Downloading,
                                   StatusFlag.Downloaded, StatusFlag.Installing, StatusFlag.Installed, StatusFlag.Installing };

            StatusFlag[] badSeq3 =
                new StatusFlag[] { StatusFlag.Waiting,
                                   StatusFlag.Downloading, StatusFlag.Downloading, StatusFlag.Downloading,
                                   StatusFlag.Downloaded, StatusFlag.Downloading, StatusFlag.Installed, StatusFlag.Installing };

            Console.WriteLine($"\nProcessing {nameof(goodSeq1)}\n");
            LastProcessedNode = null;
            foreach (var i in goodSeq1)
            {
                //Thread.Sleep(1000);
                ProcessGoodOnesPrintBadOnes(i);
            }

            Console.WriteLine($"\nProcessing {nameof(goodSeq2)}\n");
            LastProcessedNode = null;
            foreach (var i in goodSeq2)
            {
                //Thread.Sleep(1000);
                ProcessGoodOnesPrintBadOnes(i);
            }

            Console.WriteLine($"\nProcessing {nameof(badSeq1)}\n");
            LastProcessedNode = null;
            foreach (var i in badSeq1)
            {
                //Thread.Sleep(1000);
                ProcessGoodOnesPrintBadOnes(i);
            }

            Console.WriteLine($"\nProcessing {nameof(badSeq2)}\n");
            LastProcessedNode = null;
            foreach (var i in badSeq2)
            {
                //Thread.Sleep(1000);
                ProcessGoodOnesPrintBadOnes(i);
            }

            Console.WriteLine($"\nProcessing {nameof(badSeq3)}\n");
            LastProcessedNode = null;
            foreach (var i in badSeq3)
            {
                //Thread.Sleep(1000);
                ProcessGoodOnesPrintBadOnes(i);
            }
        }
Ejemplo n.º 31
0
 /// <summary>
 /// Gets the current value of the given CPU status flag.
 /// </summary>
 /// <param name="flag">The CPU status flag.</param>
 /// <returns>True if it's "on"; otherwise false.</returns>
 public bool GetFlag(StatusFlag flag) => _flags.GetBit((byte)flag);
Ejemplo n.º 32
0
 public void reset()
 {
     Register = StatusFlag.Reset;
 }
Ejemplo n.º 33
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            StatusFlag flag = (StatusFlag)value;

            return(flag.GetDescription());
        }