Esempio n. 1
0
        /// <summary>
        /// Adds the given file to the trash for later clean-up.
        /// </summary>
        /// <param name="path">absolute path of file</param>
        /// <param name="pkgmgr">package manager reference</param>
        public static void AddFile(string path, IPackageManager pkgmgr)
        {
            string newpath = null;

            if (File.Exists(path)) {
                newpath = Path.GetDirectoryName(path) + @"\" + Guid.NewGuid().ToString();
                File.Move(path, newpath);
                File.SetAttributes(newpath, FileAttributes.Hidden);
            } else if (Directory.Exists(path)) {
                newpath = path;
            } else
                return;

            pkgmgr.TrashFile(newpath);
        }