Example #1
0
        public void LoadDescriptionListox(String filter = null)
        {
            Dictionary <string, string> filteredList = new Dictionary <string, string>();
            List <ItemDescriptionData>  values       = File.ReadAllLines("ffxi_item_data.csv")
                                                       .Skip(1) //skip the header
                                                       .Select(v => ItemDescriptionData.FromCsv(v))
                                                       .ToList();

            if (filter.Length >= 3)
            {
                foreach (var item in values)

                {
                    if (item.name.ToLower().Contains(filter.ToLower()) || item.id.Contains(filter) || item.lname.Contains(filter.ToLower()))
                    {
                        try
                        {
                            filteredList.Add("#" + item.name, " #" + item.id + " #" + item.desrciption);
                        } catch (Exception e)
                        {
                            //ja
                        }
                    }
                }
            }
            if (filteredList.Count > 0)
            {
                lstItems.DataSource = new BindingSource(filteredList, null);
            }
            else
            {
                lstItems.DataSource = null;
                lstItems.Items.Clear();
            }
        }
Example #2
0
        public static ItemDescriptionData FromCsv(string csvLine)
        {
            string[]            values          = csvLine.Split(',');
            ItemDescriptionData descriptionData = new ItemDescriptionData();

            descriptionData.id          = values[0];
            descriptionData.name        = values[7];
            descriptionData.lname       = values[1];
            descriptionData.desrciption = values[8];


            return(descriptionData);
        }