Пример #1
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;
            }
        }
Пример #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;
            }
        }
Пример #3
0
 public Modinfo(SolderHelper solderHelper)
 {
     _solderHelper = solderHelper;
     InitializeComponent();
 }
Пример #4
0
 public Modinfo(SolderHelper solderHelper)
 {
     _solderHelper = solderHelper;
     InitializeComponent();
 }