public static Group GetMatchedGroup(GroupCollectionSingletone groups, string guess) { int matches = 0; Group firstmatch = null; foreach (Group group in groups.Items) { if (group.Name.ToLower() == guess) { return(group); } if (group.Name.ToLower().Contains(guess.ToLower())) { if (matches == 0) { firstmatch = group; } matches++; } } if (matches == 1) { return(firstmatch); } else { return(null); } }
public static GroupCollectionSingletone GetInstance() { // DoubleLock if (instance == null) { lock (m_lock) { if (instance == null) { instance = new GroupCollectionSingletone(); } } } return(instance); }
public static GroupCollectionSingletone GetInstance() { // DoubleLock if (instance == null) { lock (m_lock) { if (instance == null) { instance = new GroupCollectionSingletone(); } } } return instance; }
public GroupEditor(MinecraftHandler mc) { InitializeComponent(); try { dgvLevels.AutoGenerateColumns = false; GenerateColumns(); this.mc = mc; _levelCollection = GroupCollectionSingletone.GetInstance(); RefreshAvailableCommands(); dgvLevels.DataSource = _levelCollection.Items; UpdateDataGrid(0); } catch { } this.Dock = DockStyle.Fill; }
public KitEditor(MinecraftHandler mc) { InitializeComponent(); this.mc = mc; mc.Items.ReadFromFile(); try { _levels = GroupCollectionSingletone.GetInstance(); comboBoxLevel.DataSource = null; comboBoxLevel.DataSource = _levels.Items; } catch { } RefreshKitlist(); UpdateSelectedKit(); this.Dock = DockStyle.Fill; }
public static Group GetMatchedGroup(GroupCollectionSingletone groups, string guess) { int matches = 0; Group firstmatch = null; foreach (Group group in groups.Items) { if (group.Name.ToLower() == guess) { return group; } if (group.Name.ToLower().Contains(guess.ToLower())) { if (matches == 0) { firstmatch = group; } matches++; } } if (matches == 1) return firstmatch; else return null; }