Example #1
0
 private void Done_Click(object sender, EventArgs e)
 {
     foreach (Mcmod mcmod in _mods)
     {
         if (mcmod.IsSkipping)
         {
             continue;
         }
         if (String.IsNullOrWhiteSpace(mcmod.Name))
         {
             MessageBox.Show("Please check all mods and make sure the info is filled in." +
                             Environment.NewLine + "Issue with mod: " + mcmod.Filename);
             return;
         }
         if (String.IsNullOrWhiteSpace(mcmod.Modid))
         {
             mcmod.Modid = mcmod.Name.Replace(" ", "").ToLower();
         }
         if (!AreModDone(mcmod))
         {
             MessageBox.Show("Please check all mods and make sure the info is filled in." +
                             Environment.NewLine + "Issue with mod: " + mcmod.Filename);
             return;
         }
         mcmod.Aredone = true;
     }
     foreach (Mcmod mcmod in _mods)
     {
         if (mcmod.FromUserInput && !mcmod.FromSuggestion)
         {
             Debug.WriteLine(mcmod.Modid);
             DataSuggest ds = new DataSuggest();
             String      a  = _solderHelper.GetAuthors(mcmod, true);
             ds.Suggest(mcmod.Filename, mcmod.Mcversion, mcmod.Version,
                        SqlHelper.CalculateMd5(mcmod.Path), mcmod.Modid, mcmod.Name, a);
         }
         if (_solderHelper.CreateFTBPack.Checked)
         {
             _solderHelper.CreateFtbPackZip(mcmod, mcmod.Path);
         }
         if (_solderHelper.CreateTechnicPack.Checked)
         {
             _solderHelper.CreateTechnicModZip(mcmod, mcmod.Path);
         }
     }
 }
Example #2
0
        public Modinfo(List <Mcmod> modsList, SolderHelper solderHelper)
        {
            _nonFinishedMods = new List <Mcmod>();
            _solderHelper    = solderHelper;
            var tmp = from mcmod1 in modsList
                      where mcmod1.Name != null
                      orderby mcmod1.Name
                      select mcmod1;

            _mods = new List <Mcmod>();
            _mods.AddRange(tmp.ToList());
            tmp = from mcmod1 in modsList
                  where mcmod1.Name == null
                  orderby mcmod1.Filename
                  select mcmod1;

            _mods.AddRange(tmp.ToList());
            InitializeComponent();
            foreach (Mcmod mcmod in _mods)
            {
                if (String.IsNullOrWhiteSpace(mcmod.Mcversion))
                {
                    mcmod.Mcversion = solderHelper._currentMcVersion;
                }
                mcmod.Aredone = AreModDone(mcmod);
                if (!mcmod.Aredone)
                {
                    ModListSqlHelper modListSqlHelper = new ModListSqlHelper();
                    Mcmod            m = modListSqlHelper.GetModInfo(SqlHelper.CalculateMd5(mcmod.Path));
                    if (m == null)
                    {
                        if (mcmod.Authors == null || mcmod.AuthorList == null)
                        {
                            String a = _solderHelper.GetAuthors(mcmod, true);
                            if (!String.IsNullOrWhiteSpace(a))
                            {
                                List <String> s = a.Replace(" ", "").Split(',').ToList();
                                mcmod.Authors = s;
                            }
                        }
                        if (!IsValid(mcmod.Mcversion))
                        {
                            mcmod.Mcversion = _solderHelper._currentMcVersion;
                        }
                        if (AreModDone(mcmod))
                        {
                            mcmod.Aredone = true;
                        }
                        else
                        {
                            DataSuggest ds = new DataSuggest();
                            m = ds.GetMcmod(SqlHelper.CalculateMd5(mcmod.Path));
                            if (m != null)
                            {
                                if (!IsValid(mcmod.Name))
                                {
                                    mcmod.Name = m.Name;
                                }
                                if (!IsValid(mcmod.Modid))
                                {
                                    mcmod.Modid = m.Modid;
                                }
                                if (!IsValid(mcmod.Version))
                                {
                                    mcmod.Version = m.Version;
                                }
                                mcmod.FromSuggestion = true;
                            }
                            if (AreModDone(mcmod))
                            {
                                mcmod.Aredone = true;
                            }
                            else
                            {
                                _nonFinishedMods.Add(mcmod);
                                modlist.Items.Add(String.IsNullOrWhiteSpace(mcmod.Name) ? mcmod.Filename : mcmod.Name);
                            }
                        }
                    }
                    if (!mcmod.Aredone)
                    {
                        if (m != null)
                        {
                            if (!IsValid(mcmod.Name) &&
                                !String.IsNullOrWhiteSpace(m.Name))
                            {
                                mcmod.Name = m.Name;
                            }
                            if (!IsValid(mcmod.Modid) && !String.IsNullOrWhiteSpace(m.Modid))
                            {
                                mcmod.Modid = m.Modid;
                            }
                            if (!IsValid(mcmod.Version) && !String.IsNullOrWhiteSpace(m.Version))
                            {
                                mcmod.Version = m.Version;
                            }
                        }
                        if (!IsValid(mcmod.Mcversion))
                        {
                            mcmod.Mcversion = _solderHelper._currentMcVersion;
                        }
                        if (mcmod.Authors == null || mcmod.AuthorList == null)
                        {
                            String a = _solderHelper.GetAuthors(mcmod, true);
                            if (a != null)
                            {
                                List <String> s = a.Replace(" ", "").Split(',').ToList();
                                mcmod.Authors = s;
                            }
                        }
                        if (AreModDone(mcmod))
                        {
                            mcmod.Aredone = true;
                        }
                        else
                        {
                            DataSuggest ds = new DataSuggest();
                            m = ds.GetMcmod(SqlHelper.CalculateMd5(mcmod.Path));
                            if (m != null)
                            {
                                if (!IsValid(mcmod.Name))
                                {
                                    mcmod.Name = m.Name;
                                }
                                if (!IsValid(mcmod.Modid))
                                {
                                    mcmod.Modid = m.Modid;
                                }
                                if (!IsValid(mcmod.Version))
                                {
                                    mcmod.Version = m.Version;
                                }
                                mcmod.FromSuggestion = true;
                            }
                            if (AreModDone(mcmod))
                            {
                                mcmod.Aredone = true;
                            }
                            else
                            {
                                if (!_nonFinishedMods.Contains(mcmod))
                                {
                                    _nonFinishedMods.Add(mcmod);
                                    modlist.Items.Add(String.IsNullOrWhiteSpace(mcmod.Name) ? mcmod.Filename : mcmod.Name);
                                }
                            }
                        }
                    }
                }
            }
            if (modlist.Items.Count <= 0)
            {
            }
            else
            {
                modlist.SelectedIndex = 0;
            }
        }