Esempio n. 1
0
            /// <summary>
            /// Добавить
            /// </summary>
            /// <returns></returns>
            public static void Add(KeyValuePair <long?, string> url, bool load = false)
            {
                if (!LChoise.ContainsKey(url.Key))
                {
                    LChoise.Add(url.Key, url.Value);
                }

                else
                {
                    LChoise.Remove(url.Key);
                    LChoise.Add(url.Key, url.Value);

                    if (LChoise.Count > 1)
                    {
                        Dictionary <long?, string> urls = new Dictionary <long?, string>()
                        {
                            { LChoise.ElementAt(LChoise.Count - 1).Key, LChoise.ElementAt(LChoise.Count - 1).Value }
                        };

                        for (int i = 0; i < LChoise.Count - 1; i++)
                        {
                            urls.Add(LChoise.ElementAt(i).Key, LChoise.ElementAt(i).Value);
                        }

                        LChoise = urls;
                    }
                }

                if (!load)
                {
                    LoadSave.WriteData();
                }
            }
Esempio n. 2
0
 /// <summary>
 /// Получить ссылку
 /// </summary>
 /// <returns></returns>
 public static KeyValuePair <long?, string> Get(int id) => LChoise.ElementAt(id);