Exemple #1
0
 public Rules(GlobalNames globalName, int length, RulesType type = RulesType.Direct, int ext1 = 0, int ext2 = 0, int ext3 = 0)
 {
     GlobalName = globalName;
     Length     = length;
     Type       = type;
     Ext1       = ext1;
     Ext2       = ext2;
     Ext3       = ext3;
 }
Exemple #2
0
        public GoGame(GoGameInfo info)
        {
            GameInfo   = info;
            Clock      = new GoClock(GameInfo.TimeSettings);
            Tree       = new GoGameTree();
            Board      = new GoBoard(GameInfo.Size, GameInfo.Handicap);
            Turns      = new List <GoTurn>();
            KoPoint    = null;
            IsGameOver = false;
            GameRule   = RulesType.normal;
            NumberOfStonesToCapture = 5;

            m_currentTurn = 0;
            m_colorToMove = GameInfo.Handicap < 2 ? GoColor.BLACK : GoColor.WHITE;
        }
Exemple #3
0
        public GoGame(GoGameInfo info)
        {
            GameInfo = info;
            Clock = new GoClock(GameInfo.TimeSettings);
            Tree = new GoGameTree();
            Board = new GoBoard(GameInfo.Size, GameInfo.Handicap);
            Turns = new List<GoTurn>();
            KoPoint = null;
            IsGameOver = false;
            GameRule = RulesType.normal;
            NumberOfStonesToCapture = 5;

            m_currentTurn = 0;
            m_colorToMove = GameInfo.Handicap < 2 ? GoColor.BLACK : GoColor.WHITE;
        }
Exemple #4
0
 //проверяет на доступ к ресурсу
 public bool rules(RulesType rule)
 {
     string TempStr = this.item("rules");
     if (TempStr != "null")
         return (TempStr.Substring((int)rule, 1).ToString() == "0") ?
         false : true;
     return false;
 }
Exemple #5
0
            /**
             * Check if the filename provide is compliance
             * Return true if path is ok, or false is path contains one or more rule
             * */
            public Boolean CheckRules(string path, RulesType ruletype)
            {
                string[] contents = new string[] {
                    "~",                                                    // gedit and emacs
                    "Thumbs.db", "Desktop.ini", "desktop.ini", "thumbs.db", // Windows
                    "$~"
                };

                string[] extensions = new string[] {
                    ".autosave",                                                   // Various autosaving apps
                    ".~lock",                                                      // LibreOffice
                    ".part", ".crdownload",                                        // Firefox and Chromium temporary download files
                    ".sw[a-z]", ".un~", ".swp", ".swo",                            // vi(m)
                    ".directory",                                                  // KDE
                    ".DS_Store", ".Icon\r\r", "._", ".Spotlight-V100", ".Trashes", // Mac OS X
                    ".(Autosaved).graffle",                                        // Omnigraffle
                    ".tmp", ".TMP",                                                // MS Office
                    ".~ppt", ".~pptx",
                    ".~xls", ".~xlsx",
                    ".~doc", ".~docx",
                    ".cvsignore", ".~cvsignore", // CVS
                    ".gitignore",                // GIT
                    ".sync",                     // CmisSync File Downloading/Uploading
                    ".cmissync"                  // CmisSync Database
                };

                string[] directories = new string[] {
                    "CVS", ".svn", ".git", ".hg", ".bzr", ".DS_Store", ".Icon\r\r", "._", ".Spotlight-V100", ".Trashes" // Mac OS X
                };

                //Logger.LogInfo("SyncRules", "Check rules for " + path);
                Boolean found = false;

                foreach (string content in contents)
                {
                    if (path.Contains(content))
                    {
                        found = true;
                    }
                }

                if (ruletype == RulesType.Folder)
                {
                    foreach (string dir in directories)
                    {
                        if (path.ToLower().Contains(dir))
                        {
                            found = true;
                        }
                    }
                }
                else
                {
                    foreach (string ext in extensions)
                    {
                        string filext = Path.GetExtension(path);
                        if (filext.ToLower() == ext.ToLower())
                        {
                            found = true;
                        }
                    }
                }

                string not = string.Empty;

                if (found)
                {
                    not = " not";
                }

                //Logger.LogInfo("SyncRules", String.Format("Path" + path + " is{0} ok", not));
                return(!found);
            }
Exemple #6
0
 private static bool CanHoldBag(KeyValuePair <string, string[]> rule, string color, RulesType rules)
 {
     if (rule.Value == null)
     {
         return(false);
     }
     if (rule.Value.Any(bags => bags.Contains(color)))
     {
         return(true);
     }
     foreach (var bag in rule.Value)
     {
         if (bag == "")
         {
             continue;
         }
         var bagColor = bag[bag.IndexOf(" ")..].Trim();