Beispiel #1
0
 protected virtual void OnBTNAddClicked(object sender, System.EventArgs e)
 {
     GrubEntry entry = new GrubEntry();
     entry.title=SAI_Entry.Text;
     entry.options=TXT_Options.Buffer.Text;
     MainClass.grub.Entrys.Add(entry);
     this.Destroy();
 }
Beispiel #2
0
 protected virtual void OnBTNModifyClicked(object sender, System.EventArgs e)
 {
     GrubEntry entry = new GrubEntry();
     entry.title=SAI_Title.Text;
     entry.options=TXT_Options.Buffer.Text;
     MainClass.grub.Entrys[EntrySelected]=entry;
 }
Beispiel #3
0
        public Grub()
        {
            GrubEntry grubEntry = new GrubEntry();
            bool bo_entry = false;
            string str_MenuLst = Outils.ReadFile(cch_FileMenu);
            string[] lines = str_MenuLst.Split('\n');
            //search default
            foreach (string line in lines)
            {
                if (line.IndexOf("default=0")>=0)
                    {
                        //default entry find
                        string str_default = line.Replace("default=","");
                        str_default=str_default.Trim();
                        try{
                                this.SetDefault(int.Parse(str_default));
                        }
                        catch{
                                this.SetDefault(0);
                        }
                    }
                if (line.IndexOf("timeout=")>=0)
                    {
                        string str_time = line.Replace("timeout=","");
                        str_time=str_time.Trim();
                        try{
                                this.SetTimeOut(int.Parse(str_time));
                        }
                        catch{
                                this.SetTimeOut(0);
                        }
                    }
                if (line.IndexOf("gfxmenu")>=0)
                    {
                        string str_gfx = line.Replace("gfxmenu","");
                        str_gfx=str_gfx.Trim();
                        try{
                                this.SetGfx(str_gfx);
                        }
                        catch{
                                this.SetGfx("");
                        }
                    }
                if (line.IndexOf("title")>=0)
                {
                    if(bo_entry)
                    {
                        Entrys.Add(grubEntry);
                        bo_entry=false;
                    }

                    bo_entry=true;
                    grubEntry = new GrubEntry();
                    grubEntry.title=line.Replace("title","").Trim();

                }
                if (line.Trim()=="")
                {
                    if(bo_entry)
                        Entrys.Add(grubEntry);
                    bo_entry=false;
                }
                if ((line.Trim()!="") && (line.IndexOf("title")<0) &&(bo_entry))
                {
                    grubEntry.options+=line.Replace("\t","").TrimEnd()+"\n";
                }

            }
        }