}
}
+ /// <summary>
+ /// Looks up a localized string similar to Couldn't create directory '{0}'.
+ /// </summary>
+ internal static string could_not_create_directory {
+ get {
+ return ResourceManager.GetString("could_not_create_directory", resourceCulture);
+ }
+ }
+
/// <summary>
/// Looks up a localized string similar to AVR.
/// </summary>
}
}
+ /// <summary>
+ /// Looks up a localized string similar to Error.
+ /// </summary>
+ internal static string error {
+ get {
+ return ResourceManager.GetString("error", resourceCulture);
+ }
+ }
+
/// <summary>
/// Looks up a localized string similar to Executables (*.exe)|*.exe|All files (*.*)|*.*.
/// </summary>
get { return Lib.ToString(Config.ClientVersion); }
}
+ /// <summary>
+ /// Get the usb vid:prod descriptor
+ /// </summary>
+ public string USBDescriptor
+ {
+ get
+ {
+ DateTime checkDate = new DateTime(1970, 1, 1, 0, 0, 0, 0);
+ checkDate = checkDate.AddSeconds(0x5045dbf5);
+
+ return string.Format("2548:100{0}", ((DateTime)Config.FirmwareBuildDate >= checkDate ? "2" : "1"));
+ }
+ }
+
/// <summary>
/// libCEC
/// </summary>
public bool LoadXMLConfiguration()
{
- bool gotConfig = false;
- string xbmcDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\XBMC\userdata\peripheral_data";
- string defaultDir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
- string file = defaultDir + @"\usb_2548_1001.xml";
- if (File.Exists(xbmcDir + @"\usb_2548_1001.xml"))
- file = xbmcDir + @"\usb_2548_1001.xml";
+ var xbmcDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\XBMC\userdata\peripheral_data";
+ return LoadXMLConfiguration(xbmcDir + @"\usb_2548_1001.xml") || LoadXMLConfiguration(xbmcDir + @"\usb_2548_1002.xml");
+ }
- if (File.Exists(file))
+ public bool LoadXMLConfiguration(string filename)
+ {
+ bool gotConfig = false;
+ if (File.Exists(filename))
{
- XmlTextReader reader = new XmlTextReader(file);
+ XmlTextReader reader = new XmlTextReader(filename);
while (reader.Read())
{
gotConfig = true;
{
Settings.Persist();
- string xbmcDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\XBMC\userdata\peripheral_data";
- string defaultDir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
+ var xbmcDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\XBMC\userdata\peripheral_data";
+ if (!Directory.Exists(xbmcDir))
+ Directory.CreateDirectory(xbmcDir);
+
+ if (!Directory.Exists(xbmcDir))
+ {
+ // couldn't create directory
+ MessageBox.Show(string.Format(Resources.could_not_create_directory, xbmcDir), Resources.error,
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
SaveFileDialog dialog = new SaveFileDialog
- {
+ {
Title = Resources.store_settings_where,
- InitialDirectory = Directory.Exists(xbmcDir) ? xbmcDir : defaultDir,
- FileName = "usb_2548_1001.xml",
+ InitialDirectory = xbmcDir,
+ FileName = string.Format("usb_{0}.xml", Program.Instance.Controller.USBDescriptor.Replace(':', '_')),
Filter = Resources.xml_file_filter,
FilterIndex = 1
};
private ConfigTab _selectedTab = ConfigTab.Configuration;
private string _log = string.Empty;
private readonly CECController _controller;
+ public CECController Controller
+ {
+ get { return _controller; }
+ }
public Control.ControlCollection TabControls
{
get { return tabPanel.Controls; }