Beispiel #1
0
        /// <summary>
        /// Save this configuration list.
        /// </summary>

        static internal void SaveList(string path, List <string> list)
        {
            if (list.size > 0)
            {
                if (!File.Exists(path) && !string.IsNullOrEmpty(Tools.applicationDirectory))
                {
                    path = Tools.GetDocumentsPath(path);
                }

                string dir = Path.GetDirectoryName(path);
                if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }

                StreamWriter sw = new StreamWriter(path, false);
                for (int i = 0; i < list.size; ++i)
                {
                    sw.WriteLine(list[i]);
                }
                sw.Close();
            }
            else
            {
                Tools.DeleteFile(path);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Delete the specified file.
        /// </summary>

        public bool DeleteFile(string fileName)
        {
            if (Tools.DeleteFile(string.IsNullOrEmpty(rootDirectory) ? fileName : Path.Combine(rootDirectory, fileName)))
            {
                mSavedFiles.Remove(fileName);
                return(true);
            }
            return(false);
        }
Beispiel #3
0
        /// <summary>
        /// Delete the specified file.
        /// </summary>

        public bool DeleteFile(string fileName)
        {
            if (Tools.DeleteFile(fileName))
            {
                mSavedFiles.Remove(fileName);
                return(true);
            }
            return(false);
        }
Beispiel #4
0
        /// <summary>
        /// Delete the specified file.
        /// </summary>

        public void DeleteFile(string fileName)
        {
            mSavedFiles.Remove(fileName);
            Tools.DeleteFile(fileName);
        }