Exemplo n.º 1
0
        //-----------------------------------
        // Remove history data if there is a duplicate data.
        //-----------------------------------
        public void OptimizeHistoryData()
        {
            int ArrayHistoryFilesLimit = 20;

            for (int i = 0; i < ArrayHistoryEditedFiles.Count; i++)
            {
                AppHistory HistoryData = ArrayHistoryEditedFiles[i];

                for (int c = i + 1; c < ArrayHistoryEditedFiles.Count; c++)
                {
                    AppHistory item = ArrayHistoryEditedFiles[c];
                    if (HistoryData.md == item.md)
                    {
                        ArrayHistoryEditedFiles.RemoveAt(c);
                    }
                }
            }
            for (int i = ArrayHistoryEditedFiles.Count - 1; i > -1; --i)
            {
                if (!File.Exists((ArrayHistoryEditedFiles[i]).md))
                {
                    ArrayHistoryEditedFiles.RemoveAt(i);
                }
            }

            // Remove older data when limit of history data is over.
            if (ArrayHistoryEditedFiles.Count > ArrayHistoryFilesLimit)
            {
                ArrayHistoryEditedFiles.RemoveRange(
                    ArrayHistoryFilesLimit, ArrayHistoryEditedFiles.Count - ArrayHistoryFilesLimit - 1);
            }
        }
Exemplo n.º 2
0
        //-----------------------------------
        // Initialize history data
        //-----------------------------------
        private void InitHistoryData()
        {
            // Set default data when history data do no exists
            if (ArrayHistoryEditedFiles.Count > 0)
            {
                foreach (AppHistory data in ArrayHistoryEditedFiles)
                {
                    // Inspect first element because blank element is created when XML file is read.
                    if (File.Exists(data.md) == true)
                    {
                        return;
                    }
                }
            }

            //Initial directory of CSS files.
            string CssDirPath = Path.Combine(AppDataPath, "css");

            ArrayHistoryEditedFiles.Clear();
        }