Beispiel #1
0
        public string SwitchBranchOLD(IrcCommand command)
        {
            string name = command.Parameters[0];
            Branch b;
            bool   success = Enum.TryParse(name, out b);

            //Either branch does not exist, or we've selected a private branch in a public channel
            if (!success || (!Constants.PublicBranch[b] && command.Destination != "#reside_priv"))
            {
                Branch[] branches = null;
                if (command.Destination == "#reside_priv")
                {
                    branches = AllBranches.ToArray();
                }
                else
                {
                    branches = AllBranches.Where(x => Constants.PublicBranch[x]).ToArray();
                }

                string bString = "{ ";
                foreach (Branch branch in branches)
                {
                    bString += branch.ToString() + ", ";
                }
                bString = bString.Remove(bString.Length - 2) + " }";
                return("Branch not found: " + name + ". Possible Branches: " + bString);
            }

            if (b == CurrentBranchOLD)
            {
                return("Already on branch: " + CurrentBranchOLD.ToString());
            }

            CurrentBranchOLD = b;

            return("Switched to " + CurrentBranchOLD.ToString());
        }
 public string[] GetAllNonRemoteBranchNames()
 {
     return(AllBranches.Where(head => !head.IsRemote).Select(b => b.Name).ToArray());
 }
 public string[] GetAllBranchNames()
 {
     return(AllBranches.Select(b => b.Name).ToArray());
 }