Example #1
0
        private static void LoadLists()
        {
            NxLog.log(NxLog.Type.Info, "load SearchSystemList.json");
            string path = Environment.CurrentDirectory + "\\Config\\SearchSystemList.json";

            if (File.Exists(path))
            {
                string             _json = File.ReadAllText(path);
                SearchSystemList[] _list = JsonConvert.DeserializeObject <SearchSystemList[]>(_json);
                foreach (SearchSystemList s in _list)
                {
                    CustomSearch custom = new CustomSearch()
                    {
                        SearchName   = s.searchName,
                        SystemsNotes = new Dictionary <string, string>(),
                        SearchSystem = new SpanshSearchSystems()
                        {
                            filters = new SpanshFilterSystems()
                        }
                    };
                    List <string> names = new List <string>();
                    for (int i = 0; i < s.systemNames.Length; i += 2)
                    {
                        names.Add(s.systemNames[i]);
                        custom.SystemsNotes.Add(s.systemNames[i], s.systemNames[i + 1]);
                    }
                    custom.SearchSystem.filters.name = new SpanshValue <string[]>(names.ToArray());
                    custom.Serializable = false;

                    custom.SearchSystem.sort = new SpanshSort[] { new SpanshSort()
                                                                  {
                                                                      distance_from_coords = new SpanshSortValue(true)
                                                                  } };
                    Searchs.Add(custom);
                }
                ;
            }
        }
Example #2
0
 public static void Delete(CustomSearch search)
 {
     Searchs.Remove(search);
     SaveAll();
 }
Example #3
0
 public static void Save(CustomSearch search)
 {
     Searchs.Add(search);
     SaveAll();
 }