-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d5575b3
commit dadcc19
Showing
31 changed files
with
916 additions
and
7 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.33529.622 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Audacity Recovery Tool", "Audacity Recovery Tool\Audacity Recovery Tool.csproj", "{E37EF4E5-5AE2-43C0-9E3D-3C3B5A88FF9A}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{E37EF4E5-5AE2-43C0-9E3D-3C3B5A88FF9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{E37EF4E5-5AE2-43C0-9E3D-3C3B5A88FF9A}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{E37EF4E5-5AE2-43C0-9E3D-3C3B5A88FF9A}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{E37EF4E5-5AE2-43C0-9E3D-3C3B5A88FF9A}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {1F1C2BEA-92DC-44FD-8D64-A4A2D2CBF83E} | ||
EndGlobalSection | ||
EndGlobal |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Data; | ||
using System.Drawing; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Forms; | ||
|
||
namespace Audacity_Recovery_Tool | ||
{ | ||
public partial class ART : Form | ||
{ | ||
public string path; | ||
public bool stereo; | ||
public ART() | ||
{ | ||
InitializeComponent(); | ||
openFolder.FileOk += openFolder_FileOk; | ||
} | ||
|
||
private void btn_searchFolder_Click(object sender, EventArgs e) | ||
{ | ||
openFolder.FileName = "Select folder"; | ||
openFolder.ValidateNames = false; | ||
openFolder.CheckFileExists = false; | ||
openFolder.CheckPathExists = true; | ||
openFolder.Filter = "SessionData|folder"; | ||
|
||
openFolder.ShowDialog(); | ||
} | ||
|
||
private void openFolder_FileOk(object sender, CancelEventArgs e) | ||
{ | ||
string selectedPath = Path.GetDirectoryName(openFolder.FileName); | ||
|
||
|
||
if (Path.GetFileName(selectedPath) == "SessionData") | ||
{ | ||
path = selectedPath; | ||
txt_path.Text = path; | ||
} | ||
else | ||
{ | ||
MessageBox.Show("Please select the folder 'SessionData'."); | ||
e.Cancel = true; | ||
} | ||
} | ||
|
||
private void btn_v3_Click(object sender, EventArgs e) | ||
{ | ||
string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); | ||
string recoveryFolderPath = Path.Combine(desktopPath, "Recovered"); | ||
|
||
if (!Directory.Exists(recoveryFolderPath)) | ||
{ | ||
Directory.CreateDirectory(recoveryFolderPath); | ||
} | ||
|
||
string[] sourceExtensions = { ".aup3unsaved", ".aup3unsaved-shm", ".aup3unsaved-wal" }; | ||
string targetName = "recovered-project"; | ||
|
||
try | ||
{ | ||
foreach (string sourceExtension in sourceExtensions) | ||
{ | ||
string[] sourceFiles = Directory.GetFiles(path, $"*{sourceExtension}"); | ||
|
||
foreach (string sourceFilePath in sourceFiles) | ||
{ | ||
string targetExtension = Path.GetExtension(sourceFilePath).Replace("aup3unsaved", "aup3"); | ||
string targetFilePath = Path.Combine(recoveryFolderPath, $"{targetName}{targetExtension}"); | ||
|
||
File.Copy(sourceFilePath, targetFilePath, true); | ||
} | ||
} | ||
MessageBox.Show("The project has been saved to the desktop in the 'Recovered' folder."); | ||
} | ||
catch | ||
{ | ||
MessageBox.Show("Make sure the path to the folder and the version is correct and try again.\nIf the error persists it means that the recovery is not possible.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); | ||
} | ||
} | ||
|
||
|
||
|
||
private void btn_v2_Click(object sender, EventArgs e) | ||
{ | ||
|
||
Cursor.Current = Cursors.WaitCursor; | ||
|
||
try | ||
{ | ||
|
||
string[] subDirectories = Directory.GetDirectories(path); | ||
string mostRecentSubDirectory = subDirectories.OrderByDescending(d => Directory.GetLastWriteTime(d)).FirstOrDefault(); | ||
|
||
if (mostRecentSubDirectory != null) | ||
{ | ||
string allFolderPath = Path.Combine(mostRecentSubDirectory, "all"); | ||
Directory.CreateDirectory(allFolderPath); | ||
|
||
foreach (string filePath in Directory.GetFiles(mostRecentSubDirectory, "*.au", SearchOption.AllDirectories)) | ||
{ | ||
string fileName = Path.GetFileName(filePath); | ||
string destinationPath = Path.Combine(allFolderPath, fileName); | ||
try | ||
{ | ||
File.Copy(filePath, destinationPath); | ||
} | ||
catch | ||
{ | ||
Console.WriteLine("Skipped"); | ||
} | ||
} | ||
|
||
var allFiles = Directory.GetFiles(allFolderPath); | ||
Array.Sort(allFiles, (a, b) => File.GetLastWriteTime(a).CompareTo(File.GetLastWriteTime(b))); | ||
|
||
string recoveredFolderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Recovered"); | ||
Directory.CreateDirectory(recoveredFolderPath); | ||
|
||
if (!stereo) | ||
{ | ||
string recoveredAllFolderPath = Path.Combine(recoveredFolderPath, "all"); | ||
Directory.CreateDirectory(recoveredAllFolderPath); | ||
for (int i = 0; i < allFiles.Length; i++) | ||
{ | ||
string fileName = Path.GetFileName(allFiles[i]); | ||
string destinationPath = Path.Combine(recoveredAllFolderPath, $"file{i + 1:D5}.au"); | ||
File.Copy(allFiles[i], destinationPath); | ||
} | ||
} | ||
else | ||
{ | ||
string channel1FolderPath = Path.Combine(recoveredFolderPath, "channel1"); | ||
string channel2FolderPath = Path.Combine(recoveredFolderPath, "channel2"); | ||
Directory.CreateDirectory(channel1FolderPath); | ||
Directory.CreateDirectory(channel2FolderPath); | ||
|
||
for (int i = 0; i < allFiles.Length; i++) | ||
{ | ||
string fileName = Path.GetFileName(allFiles[i]); | ||
string destinationFolder = i % 2 == 0 ? channel2FolderPath : channel1FolderPath; | ||
string destinationPath = Path.Combine(destinationFolder, $"file{i + 1:D5}.au"); | ||
File.Move(allFiles[i], destinationPath); | ||
} | ||
} | ||
Cursor.Current = Cursors.Default; | ||
MessageBox.Show("Import the .au into audacity, select all with CTRL+A and go to Tracks > Align Trucks > Align End to End.", "Recovered Succesfully", MessageBoxButtons.OK, MessageBoxIcon.Information); | ||
} | ||
else | ||
{ | ||
MessageBox.Show("Make sure the path to the folder and the version is correct and try again.\nIf the error persists it means that the recovery is not possible.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); | ||
} | ||
} | ||
catch | ||
{ | ||
MessageBox.Show("Make sure the path to the folder and the version is correct and try again.\nIf the error persists it means that the recovery is not possible.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); | ||
} | ||
} | ||
|
||
|
||
private void check_stereo_CheckedChanged(object sender, EventArgs e) | ||
{ | ||
stereo = check_stereo.Checked; | ||
} | ||
|
||
private void btn_help_Click(object sender, EventArgs e) | ||
{ | ||
MessageBox.Show("'SessionData' is usually located on C:/Users/User/AppData/Local/audacity/SessionData", "Help", MessageBoxButtons.OK, MessageBoxIcon.Information); | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.