public static void LoadProjectFiles(NIDigital nIDigital, ProjectFiles projectFiles) { if (string.IsNullOrEmpty(projectFiles.PinMapFile)) { throw new ArgumentException("A pin map file is required by the instrument", "ProjectFiles.PinMapFile"); } else { nIDigital.LoadPinMap(projectFiles.PinMapFile); } if (projectFiles.SpecificationsFiles.Length > 0) { nIDigital.LoadSpecifications(projectFiles.SpecificationsFiles); } //Specifications sheets are not required by the instrument if (projectFiles.PinLevelsFiles.Length > 0) { nIDigital.LoadLevels(projectFiles.PinLevelsFiles); } else { throw new ArgumentException("At least one levels sheet must be supplied to the instrument", "PinLevelsFiles"); } if (projectFiles.TimingFiles.Length > 0) { nIDigital.LoadTiming(projectFiles.TimingFiles); } else { throw new ArgumentException("At least one timing sheet must be supplied to the instrument", "TimingFiles"); } foreach (string path in projectFiles.DigitalPatternFiles) { nIDigital.LoadPattern(path); } if (projectFiles.PinLevelsFiles.Length == 1 && projectFiles.TimingFiles.Length == 1) { nIDigital.ApplyLevelsAndTiming("", projectFiles.PinLevelsFiles[0], projectFiles.TimingFiles[0]); } }
public static void LoadDigitalProject(NIDigital session) { string assemblyPath = Assembly.GetExecutingAssembly().Location; string assemblyDirectory = Path.GetDirectoryName(assemblyPath); string digitalProjectDirectory = Path.Combine(assemblyDirectory, "digiproj"); string pinMapPath = Path.Combine(digitalProjectDirectory, "PinMap.pinmap"); session.LoadPinMap(pinMapPath); session.LoadSpecifications(Path.Combine(digitalProjectDirectory, "Specifications.specs")); string levelsPath = Path.Combine(digitalProjectDirectory, "PinLevels.digilevels"); session.LoadLevels(levelsPath); string timingPath = Path.Combine(digitalProjectDirectory, "Timing.digitiming"); session.LoadTiming(timingPath); session.ApplyLevelsAndTiming("", levelsPath, timingPath); string[] digitalPatternPaths = Directory.GetFiles(digitalProjectDirectory, "*.digipat"); foreach (string path in digitalPatternPaths) { session.LoadPattern(path); } }