Пример #1
0
        static void Main(string[] args)
        {
            BinarySerializer a = new BinarySerializer(Encoding.UTF32);

            byte[] testContents = new byte[0];
            SerializableList <double> testList = new SerializableList <double>(a, testContents, sizeof(double));

            testList.Add(1);
            testList.Add(2);
            testList.Add(3);
            testList.Add(4);
            testList.Add(5);
            testList.Add(6);
            testList.Add(7);
            var t = testList.IndexOf(5);

            testList.Insert(t, 15);
            testList.RemoveAt(2);
            t = testList.IndexOf(5);
            testList.Remove(7);
            for (int i0 = 0; i0 < testList.Count; i0++)
            {
                Console.WriteLine(testList[i0]);
            }
            Console.ReadKey();
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="filePath"></param>
        public void AddRecentProject(string filePath)
        {
            for (int i = 0; i < RecentProjects.Count; ++i)
            {
                if (RecentProjects[i].FilePath == filePath)
                {
                    RecentProjects.Remove(RecentProjects[i]);
                    break;
                }
            }
            var m = new RecentProject();
            var a = filePath.Split('\\');

            m.Title = a[0];
            string t = "";

            for (int i = a.Length - 1; i > 0; --i)
            {
                t = @"\" + a[i] + t;
                if (t.Length > 64)
                {
                    t = @"\..." + t;
                    break;
                }
            }
            m.Title   += t;
            m.FilePath = filePath;
            RecentProjects.Add(m);
            if (RecentProjects.Count > 10)
            {
                int i = RecentProjects.Count - 10;
                for (int j = 0; j < i; ++j)
                {
                    RecentProjects.Remove(RecentProjects[0]);
                }
            }
        }