Skip to content

Commit

Permalink
fixed 0002292: Move TuningParameters to ProgramData dir
Browse files Browse the repository at this point in the history
  • Loading branch information
chefkoch committed Jun 24, 2009
1 parent f335cea commit 69c2217
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 33 deletions.
4 changes: 2 additions & 2 deletions TvEngine3/TVLibrary/Setup/setup.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ ${MementoSection} "MediaPortal TV Server" SecServer

#---------------------------- File Copy ----------------------
; Tuning Parameter Directory
SetOutPath $INSTDIR\TuningParameters
SetOutPath "${COMMON_APPDATA}\TuningParameters"
File /r /x .svn "${TVSERVER.BASE}\TuningParameters\*"

; The Plugin Directory
Expand Down Expand Up @@ -555,7 +555,7 @@ ${MementoSectionEnd}

${LOG_TEXT} "INFO" "remove files..."
; Remove TuningParameters
RMDir /r $INSTDIR\TuningParameters
RMDir /r "${COMMON_APPDATA}\TuningParameters"

; Remove Plugins
Delete $INSTDIR\Plugins\ComSkipLauncher.dll
Expand Down
4 changes: 2 additions & 2 deletions TvEngine3/TVLibrary/SetupTv/Sections/CardAtsc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void Init()
mpComboBoxFrequencies.Items.Clear();
try
{
string[] files = System.IO.Directory.GetFiles(String.Format(@"{0}\TuningParameters", Utils.ApplicationDirectory));
string[] files = System.IO.Directory.GetFiles(String.Format(@"{0}\TuningParameters", Log.GetPathName()));
for (int i = 0; i < files.Length; ++i)
{
string ext = System.IO.Path.GetExtension(files[i]).ToLowerInvariant();
Expand Down Expand Up @@ -172,7 +172,7 @@ private void mpButtonScanTv_Click(object sender, EventArgs e)
MessageBox.Show(this, "Card is locked. Scanning not possible at the moment ! Perhaps you are scanning an other part of a hybrid card.");
return;
}
LoadList(String.Format(@"{0}\Tuningparameters\{1}.qam", Utils.ApplicationDirectory, mpComboBoxFrequencies.SelectedItem));
LoadList(String.Format(@"{0}\Tuningparameters\{1}.qam", Log.GetPathName(), mpComboBoxFrequencies.SelectedItem));
Thread scanThread = new Thread(DoScan);
scanThread.Name = "ATSC scan thread";
scanThread.Start();
Expand Down
4 changes: 2 additions & 2 deletions TvEngine3/TVLibrary/SetupTv/Sections/CardDvbC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ void Init()
mpComboBoxCountry.Items.Clear();
try
{
string[] files = System.IO.Directory.GetFiles(String.Format(@"{0}\TuningParameters", Utils.ApplicationDirectory));
string[] files = System.IO.Directory.GetFiles(String.Format(@"{0}\TuningParameters", Log.GetPathName()));
for (int i = 0; i < files.Length; ++i)
{
string ext = System.IO.Path.GetExtension(files[i]).ToLowerInvariant();
Expand Down Expand Up @@ -276,7 +276,7 @@ private void mpButtonScanTv_Click_1(object sender, EventArgs e)
MessageBox.Show(this, "Card is locked. Scanning not possible at the moment ! Perhaps you are scanning an other part of a hybrid card.");
return;
}
LoadList(String.Format(@"{0}\Tuningparameters\{1}.dvbc", Utils.ApplicationDirectory, mpComboBoxCountry.SelectedItem));
LoadList(String.Format(@"{0}\Tuningparameters\{1}.dvbc", Log.GetPathName(), mpComboBoxCountry.SelectedItem));
Thread scanThread = new Thread(DoScan);
scanThread.Name = "DVB-C scan thread";
scanThread.Start();
Expand Down
6 changes: 3 additions & 3 deletions TvEngine3/TVLibrary/SetupTv/Sections/CardDvbIP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void Init()
{
mpComboBoxService.Items.Clear();
mpComboBoxService.Items.Add("SAP Announcements");
String tuningFolder = String.Format(@"{0}\TuningParameters\iptv", Utils.ApplicationDirectory);
String tuningFolder = String.Format(@"{0}\TuningParameters\iptv", Log.GetPathName());
if (Directory.Exists(tuningFolder))
{
string[] files = Directory.GetFiles(tuningFolder, "*.m3u");
Expand Down Expand Up @@ -177,8 +177,8 @@ void DoScan()
else
{
IPlayListIO playlistIO =
PlayListFactory.CreateIO(String.Format(@"{0}\TuningParameters\iptv\{1}.m3u", Utils.ApplicationDirectory, mpComboBoxService.SelectedItem));
playlistIO.Load(playlist, String.Format(@"{0}\TuningParameters\iptv\{1}.m3u", Utils.ApplicationDirectory, mpComboBoxService.SelectedItem));
PlayListFactory.CreateIO(String.Format(@"{0}\TuningParameters\iptv\{1}.m3u", Log.GetPathName(), mpComboBoxService.SelectedItem));
playlistIO.Load(playlist, String.Format(@"{0}\TuningParameters\iptv\{1}.m3u", Log.GetPathName(), mpComboBoxService.SelectedItem));
}
if (playlist.Count == 0) return;

Expand Down
8 changes: 4 additions & 4 deletions TvEngine3/TVLibrary/SetupTv/Sections/CardDvbS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ void ReadTransponders(SatteliteContext context)
Log.Info("DVBS: Also using DVB-S2 transponder scanning information");
string transpondername = Path.GetFileNameWithoutExtension(tsfilename).ToLowerInvariant();
//@"\Tuningparameters\"
tsfilename = String.Format(@"{0}\TuningParameters\{1}-S2.ini", Utils.ApplicationDirectory, transpondername);
tsfilename = String.Format(@"{0}\TuningParameters\{1}-S2.ini", Log.GetPathName(), transpondername);
if (!File.Exists(tsfilename))
{
Log.Info("DVBS: {0} transponder scanning file not present!", tsfilename);
Expand Down Expand Up @@ -417,7 +417,7 @@ static List<SatteliteContext> LoadSattelites()
{
List<SatteliteContext> satellites = new List<SatteliteContext>();
XmlDocument doc = new XmlDocument();
doc.Load(String.Format(@"{0}\TuningParameters\satellites.xml", Utils.ApplicationDirectory));
doc.Load(String.Format(@"{0}\TuningParameters\satellites.xml", Log.GetPathName()));
XmlNodeList nodes = doc.SelectNodes("/satellites/satellite");
if (nodes != null)
foreach (XmlNode node in nodes)
Expand All @@ -426,12 +426,12 @@ static List<SatteliteContext> LoadSattelites()
ts.SatteliteName = node.Attributes.GetNamedItem("name").Value;
ts.Url = node.Attributes.GetNamedItem("url").Value;
string name = Utils.FilterFileName(ts.SatteliteName);
ts.FileName = String.Format(@"{0}\TuningParameters\{1}.ini", Utils.ApplicationDirectory, name);
ts.FileName = String.Format(@"{0}\TuningParameters\{1}.ini", Log.GetPathName(), name);
satellites.Add(ts);
}

/*
string[] files = System.IO.Directory.GetFiles(Utils.ApplicationDirectory + @"\Tuningparameters", "*.tpl");
string[] files = System.IO.Directory.GetFiles(Log.GetPathName() + @"\Tuningparameters", "*.tpl");
foreach (string file in files)
{
Expand Down
4 changes: 2 additions & 2 deletions TvEngine3/TVLibrary/SetupTv/Sections/CardDvbT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void Init()
try
{
XmlDocument doc = new XmlDocument();
doc.Load(String.Format(@"{0}\TuningParameters\dvbt.xml", Utils.ApplicationDirectory));
doc.Load(String.Format(@"{0}\TuningParameters\dvbt.xml", Log.GetPathName()));
XmlNodeList list = doc.SelectNodes("/dvbt/country");
if (list != null)
foreach (XmlNode node in list)
Expand Down Expand Up @@ -181,7 +181,7 @@ void DoScan()

Dictionary<int, int> frequencies = new Dictionary<int, int>();
XmlDocument doc = new XmlDocument();
doc.Load(String.Format(@"{0}\TuningParameters\dvbt.xml", Utils.ApplicationDirectory));
doc.Load(String.Format(@"{0}\TuningParameters\dvbt.xml", Log.GetPathName()));
XmlNodeList countryList = doc.SelectNodes("/dvbt/country");
if (countryList != null)
foreach (XmlNode nodeCountry in countryList)
Expand Down
18 changes: 0 additions & 18 deletions TvEngine3/TVLibrary/SetupTv/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -989,23 +989,5 @@ public static bool CheckRegistryForInstalledSoftware(string aSoftwareName)
}
return AppFound;
}

private static string _applicationDirectory;
/// <summary>
/// Holds the Path, which contains the Application.exe.
/// This is not the same like StartupPath (WorkingDirectory).
/// </summary>
public static string ApplicationDirectory
{
get
{
if (String.IsNullOrEmpty(_applicationDirectory))
{
_applicationDirectory = Directory.GetParent(Application.ExecutablePath).FullName;
}

return _applicationDirectory;
}
}
}
}

0 comments on commit 69c2217

Please sign in to comment.