Exemplo n.º 1
0
        private static string PreferencesDirectoryName(string appName)
        {
            string appDataFolder = System.Environment.GetFolderPath(
                System.Environment.SpecialFolder.ApplicationData);

            if (!VirtualDrive.ExistsDirectory(appDataFolder))
            {
                throw new Exception(appDataFolder + @" not found!");
            }

            string preferencesFolder = Path.Combine(appDataFolder, appName);

            if (!VirtualDrive.ExistsDirectory(preferencesFolder))
            {
                VirtualDrive.CreateDirectory(preferencesFolder);
            }

            return(preferencesFolder);
        }
Exemplo n.º 2
0
        private void WriteCoverToDisc(Tag tag, GoogleImageQuery.ImageResult result)
        {
            string cachePath = Path.Combine(App.AppDataFolder, "Covers");

            if (!VirtualDrive.ExistsDirectory(cachePath))
            {
                // TODO: VirtualDrive
                VirtualDrive.CreateDirectory(cachePath);
            }

            TagEditor editor = new TagEditor(tag);
            string    url    = result.Url;
            string    suffix = url.Substring(url.Length - 3, 3);
            string    file   = Path.Combine(cachePath, dirNameGenerator.Name(editor.Get()) + "." + suffix);

            if (!File.Exists(file))
            {
                using (Stream stream = File.OpenWrite(file))
                {
                    stream.Write(result.Image, 0, result.Image.Length);
                }
            }
        }
Exemplo n.º 3
0
 public void Undo()
 {
     VirtualDrive.CreateDirectory(Dir);
 }