コード例 #1
0
 public ControllerDefaultMapping(ControllerDefaultMappingFile file, string deviceTypeStr)
 {
     File          = file;
     DeviceTypeStr = deviceTypeStr;
     if (File.TsiFile != null)
     {
         DefaultDevice = File.TsiFile.Devices.FirstOrDefault(d => d.TypeStr.Equals(DeviceTypeStr));
     }
 }
コード例 #2
0
        private async Task addDefaultMappings(int count, string pathToDefaultFile)
        {
            FileInfo fi           = new FileInfo(pathToDefaultFile);
            string   manufacturer = fi.Directory.Name;
            string   controller   = Path.GetFileNameWithoutExtension(fi.Name)
                                    .Split(new[] { " - " }, StringSplitOptions.RemoveEmptyEntries)
                                    .Last();

            TsiFile tsi = await loadTsiAsync(pathToDefaultFile);

            if (tsi == null)
            {
                Debug.WriteLine("Could not load " + pathToDefaultFile);
                return;
            }

            var file = new ControllerDefaultMappingFile(manufacturer, controller, pathToDefaultFile);

            file.DefaultMappings.AddRange(tsi.Devices.Select(pd => new ControllerDefaultMapping(file, pd.TypeStr)));
            this.Add(file);

            Interlocked.Increment(ref _progressCounter);
            App.SetStatus("Loading defaults for proprietary devices ... " + ((double)_progressCounter / count * 100) + "%");
        }