Skip to content

Commit

Permalink
fix Xvid detection on systems with custom Program Files path
Browse files Browse the repository at this point in the history
also render clips from the Render script to aa user-chosen folder
instead of the default Vegas local folder.

closes #4
  • Loading branch information
delthas committed Oct 11, 2020
1 parent 7735079 commit 43fa613
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
14 changes: 11 additions & 3 deletions Datamix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ public class EntryPoint {
}
};
encode.Start();
var output = encode.StandardOutput.ReadToEnd();
var error = encode.StandardError.ReadToEnd();
var output = encode.StandardOutput.ReadToEnd();
Debug.WriteLine(output);
Debug.WriteLine("---------------------");
Debug.WriteLine(error);
Expand Down Expand Up @@ -168,8 +168,16 @@ public class EntryPoint {
return;
}

const string xvidCheckPath = @"C:\Program Files (x86)\Xvid\uninstall.exe";
if (!File.Exists(xvidCheckPath)) {
var xvidPath = Environment.GetEnvironmentVariable("ProgramFiles(x86)");
if (string.IsNullOrEmpty(xvidPath)) {
xvidPath = Environment.GetEnvironmentVariable("ProgramFiles");
}
if (string.IsNullOrEmpty(xvidPath)) {
MessageBox.Show("Couldn't get Xvid install path!");
return;
}
xvidPath += @"\Xvid\uninstall.exe";
if (!File.Exists(xvidPath)) {
MessageBox.Show(
"Xvid codec not installed. The script will install it now and may ask for admin access to install it.");
var xvid = new Process {
Expand Down
12 changes: 10 additions & 2 deletions Datamosh.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,16 @@ public class EntryPoint {
return;
}

const string xvidCheckPath = @"C:\Program Files (x86)\Xvid\uninstall.exe";
if (!File.Exists(xvidCheckPath)) {
var xvidPath = Environment.GetEnvironmentVariable("ProgramFiles(x86)");
if (string.IsNullOrEmpty(xvidPath)) {
xvidPath = Environment.GetEnvironmentVariable("ProgramFiles");
}
if (string.IsNullOrEmpty(xvidPath)) {
MessageBox.Show("Couldn't get Xvid install path!");
return;
}
xvidPath += @"\Xvid\uninstall.exe";
if (!File.Exists(xvidPath)) {
MessageBox.Show(
"Xvid codec not installed. The script will install it now and may ask for admin access to install it.");
var xvid = new Process {
Expand Down
7 changes: 2 additions & 5 deletions Render.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,10 @@ public class EntryPoint {
"RenderClipFolder", finalFolder, RegistryValueKind.String);
}

var path = Path.Combine(vegas.TemporaryFilesPath, Path.GetFileNameWithoutExtension(vegas.Project.FilePath) +
var path = Path.Combine(finalFolder, Path.GetFileNameWithoutExtension(vegas.Project.FilePath) +
"-" +
Guid.NewGuid().ToString("B").ToUpper().Substring(1, 8) +
".avi");
var pathEncoded = Path.Combine(vegas.TemporaryFilesPath,
Path.GetFileNameWithoutExtension(vegas.Project.FilePath) + "-" +
Guid.NewGuid().ToString("B").ToUpper().Substring(1, 8) + ".avi");

var renderArgs = new RenderArgs {
OutputFile = path,
Expand All @@ -208,7 +205,7 @@ public class EntryPoint {
return;
}

File.Delete(pathEncoded + ".sfl");
File.Delete(path + ".sfl");

var media = vegas.Project.MediaPool.AddMedia(path);

Expand Down

0 comments on commit 43fa613

Please sign in to comment.