Beispiel #1
0
 private static void CheckLocation(Location location, Location seed, HashSet<Location> alreadyChecked, List<Location> todoList)
 {
     if (location != null && !location.Marked)
     {
         if (!alreadyChecked.Contains(location) && !todoList.Contains(location))
         {
             if (seed.Color.Equals(location.Color))
             {
                 todoList.Insert(0, location);
             }
             else
             {
                 todoList.Add(location);
             }
         }
     }
 }
Beispiel #2
0
        private void SetupUILanguage()
        {
            string selected = null;
            List<string> list = new List<string>();
            string configuredLangId = OMLSettings.UILanguage;

            foreach (var availableCulture in I18n.AvailableCultures)
            {
                string name = availableCulture.TextInfo.ToTitleCase(availableCulture.NativeName);
                if (string.CompareOrdinal(availableCulture.Name, configuredLangId) == 0)
                {
                    selected = name;
                }
                list.Add(name);
            }

            list.Sort((a, b) => string.Compare(a, b, true, Thread.CurrentThread.CurrentCulture));

            list.Insert(0, "Use system language");
            if (string.IsNullOrEmpty(selected)) selected = list[0];

            _uiLanguage.Options = list;
            _uiLanguage.Chosen = selected;
        }
Beispiel #3
0
        /// <summary>
        /// Add two bytes after the header label for the size
        /// </summary>
        /// <param name="list"></param>
        public static void WriteSizeShort(List<byte> list)
        {
            int value = list.Count - 2;
            byte b0 = (byte)value;
            byte b1 = (byte)(value >> 8);

            list.Insert(2, b0);
            list.Insert(3, b1);
        }
 /// <summary>子孫ノードを取得する。
 /// </summary>
 /// <param name="node">ツリーノードオブジェクト。</param>
 /// <returns>子孫ノードの配列。</returns>
 public static TreeNode[] GetDescendants(this TreeNode node)
 {
     var list = new List<TreeNode>(TreeViewUtility.GetDescendants(node.Nodes));
     list.Insert(0, node);
     return list.ToArray();
 }
Beispiel #5
0
        public static void WriteSizeInt(List<byte> list)
        {
            int value = list.Count - 2;
            byte[] byteArray = BitConverter.GetBytes(value);

            list.Insert(2, byteArray[0]);
            list.Insert(3, byteArray[1]);
            list.Insert(4, byteArray[2]);
            list.Insert(5, byteArray[3]);
        }