fix artist editor

This commit is contained in:
Luke Pulverenti
2016-09-06 01:02:05 -04:00
parent d4324b7e89
commit 67505e24bd
15 changed files with 126 additions and 77 deletions

View File

@@ -20,7 +20,9 @@ netsh advfirewall firewall add rule name="Port %3" dir=in action=allow protocol=
if [%4]==[] GOTO DONE
netsh advfirewall firewall delete rule name="mediabrowser.serverapplication.exe"
netsh advfirewall firewall delete rule name="Emby Server"
netsh advfirewall firewall add rule name="Emby Server" dir=in action=allow protocol=TCP program=%4 enable=yes
netsh advfirewall firewall add rule name="Emby Server" dir=in action=allow protocol=UDP program=%4 enable=yes

View File

@@ -208,5 +208,60 @@ namespace MediaBrowser.ServerApplication.Native
{
LoopUtil.Run(appName);
}
public bool PortsRequireAuthorization(string applicationPath)
{
var appNameSrch = Path.GetFileName(applicationPath);
var startInfo = new ProcessStartInfo
{
FileName = "netsh",
Arguments = "advfirewall firewall show rule \"" + appNameSrch + "\"",
CreateNoWindow = true,
UseShellExecute = false,
WindowStyle = ProcessWindowStyle.Hidden,
ErrorDialog = false,
RedirectStandardOutput = true
};
using (var process = Process.Start(startInfo))
{
process.Start();
try
{
var data = process.StandardOutput.ReadToEnd() ?? string.Empty;
//_logger.Debug("Found windows firewall rule: " + data);
if (data.IndexOf("Block", StringComparison.OrdinalIgnoreCase) != -1)
{
return true;
}
//var parts = data.Split('\n');
//return parts.Length > 4;
return false;
}
catch (Exception ex)
{
_logger.ErrorException("Error querying windows firewall", ex);
// Hate having to do this
try
{
process.Kill();
}
catch (Exception ex1)
{
_logger.ErrorException("Error killing process", ex1);
}
throw;
}
}
}
}
}