Beispiel #1
0
 public static void SaveConfig()
 {
     parser.SetKey(mainsec, versionpre, VersionController.WriteVersionNoOnly());
     parser.SetKey(mainsec, curremotepre, getRemotesString(false));
     parser.Save();
 }
Beispiel #2
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);
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            //version info print
            VersionController.WriteVersion();
            //find out OS
            OS.IdentifyOS();
            OS.PrintOS();
            UI.blank(1);

            //now check if there is an init folder
            git.IsInit();

            while (true)
            {
                bool workedReading = Settings.Read();
                //Settings.ChangeCurBranch("thisbranch");//can change branch like this
                if (!workedReading)
                {
                    UI.red();
                    Console.WriteLine("Couldn't read config file in:");
                    Console.WriteLine(" " + Settings.configFN);
                    Console.WriteLine("aborting...");
                    UI.white();
                    //give offer to return default file
                }
                else
                {
                    Console.WriteLine();
                    //now ask about pushing
                    Console.WriteLine("give commit message for auto push or enter a setting");
                    Console.WriteLine("Settings are:");
                    UI.green();
                    Console.WriteLine("(b)    create/checkout branch from current and be pushing to this");
                    Console.WriteLine("(r)    change remote to commit on");
                    Console.WriteLine("(ar)   add remote to commit on");
                    Console.WriteLine("(rr)   remove remote to commit on");
                    Console.WriteLine("(m)    merge current branch to another");
                    Console.WriteLine("(cmd)  pure cmd input");
                    Console.WriteLine("(l)    see license info");
                    Console.WriteLine("(help) help!");
                    Console.WriteLine("(q)    quit program");
                    UI.white();

                    string resp = Console.ReadLine();
                    if (resp == "r")
                    {
                        Settings.PromptChangeRemote();
                    }
                    else if (resp == "ar")
                    {
                        Settings.PromptAddRemote();
                    }
                    else if (resp == "rr")
                    {
                        Settings.RemoveRemote();
                    }
                    else if (resp == "b")
                    {
                        Settings.PromptCheckoutNB();
                    }
                    else if (resp == "m")
                    {
                        git.PromptMerge();
                    }
                    else if (resp == "cmd")
                    {
                        Console.WriteLine("Give command for cmd to run");
                        string[] cmds = new string[1];
                        cmds[0] = Console.ReadLine();
                        string[] lineoutput = CMD.CMDcmdsLines(cmds, true);
                    }
                    else if (resp == "l")
                    {
                        Licence.DisplayScreen();
                    }
                    else if (resp == "help")
                    {
                        DisplayHelp();
                    }
                    else if (resp == "q")
                    {
                        ExitPrint();
                        break;
                    }
                    else
                    {
                        git.PushAll(resp);
                    }
                }
                Console.WriteLine();
            }
            //all done either reloop or quit
        }