コード例 #1
0
 public static string[] getRemoteNames(out bool success)
 {
     string[] cmds = new string[1];
     cmds[0] = g("remote -v");
     string[] feedback = CMD.CMDcmdsLines(cmds, false);
     success = true;
     for (int i = 0; i < feedback.Length; i++)
     {
         if (feedback[i].Contains("fatal:"))
         {
             success = false;
         }
     }
     if (success)
     {
         //worked now filter out to find those branch names ye ken
         string[] filtered = new string[feedback.Length - 1];
         for (int i = 0; i < filtered.Length; i++)
         {
             int k = i + 1;
             filtered[i] = filterOriginName(feedback[k]);
         }
         return(StringFilter.FindDouble(filtered));
     }
     else
     {
         string err = "ERROR GIT MIGHT NOT BE INITIALISED";
         UI.giveWarning(err);
         return(new string[] { err });
     }
 }
コード例 #2
0
 public static string[] getAllBranchNames()
 {
     string[] c = new string[1];
     c[0] = git.g("branch");
     string[] feedback = CMD.CMDcmdsLines(c, false);
     //now filter
     string[] cleaned = new string[feedback.Length - 1];
     for (int i = 0; i < feedback.Length - 1; i++)
     {
         int k = i + 1;
         cleaned[i] = StringFilter.filterAstrix(feedback[k]);
     }
     //now to rid of empty entries
     string[] emptied = removeEmpty(cleaned);
     if (emptied.Length == 0)
     {
         //nothing so we must return the current branch
         string curBranch = Settings.curBranchN;
         return(new string[] { curBranch });
     }
     else
     {
         return(emptied);
     }
 }
コード例 #3
0
        public static string[] CMDcmdsLines(string[] commands, bool print)
        {
            string output = CMDWithCommands(commands, print);

            string[] lines         = output.Split(new[] { "\n" }, StringSplitOptions.None);
            int      noLinestoSkip = 3;

            //remove the LHS directory nonsense
            string[] finalout = new string[lines.Length - noLinestoSkip];
            for (int i = 0; i < lines.Length - noLinestoSkip; i++)
            {
                finalout[i] = StringFilter.cleanLine(lines[i + noLinestoSkip]);
            }
            return(finalout);
        }
コード例 #4
0
        public static bool ReadDatFile(IniParser parser)//read success bool returned
        {
            bool success = false;

            bool readremote = true;

            try
            {
                //read remoteb
                string   remotearray = parser.getDatFromKey(mainsec, curremotepre, out readremote);
                string[] rarr        = remotearray.Split(',');
                curRemote.Clear();
                //check to make sure there are no spaces on any of those
                for (int i = 0; i < rarr.Length; i++)
                {
                    if (rarr[i].Contains(" "))
                    {
                        rarr[i] = StringFilter.RemoveSpace(rarr[i]);
                    }
                    curRemote.Add(rarr[i]);
                }
                //now no white spaces
            }
            catch
            {
                readremote = false;
            }
            if (readremote)
            {
                success = true;
            }
            else
            {
                return(false);
            }

            bool readversion = true;

            try
            {
                string versionfile = parser.getDatFromKey(mainsec, versionpre, out readversion);
                string curVersion  = VersionController.WriteVersionNoOnly();
                if (versionfile != curVersion)
                {
                    UI.giveWarning("Different version used in saved config data");
                }
            }
            catch
            {
                readversion = false;
            }
            if (readversion)
            {
                success = true;
            }
            else
            {
                return(false);
            }
            //got this far exit with a yay
            return(success);
        }