static void Main(string[] args) { if (args.Length != 2) { Console.WriteLine("Usage: BuildPresets C:\\Spooky2 presets.db"); return; } string spooky2dir = args[0]; string outfile = args[1]; var provider = new Spooky2.Provider(spooky2dir); var presets = ProgramFolder.Clone(provider.RootPresetCollection); presets.SaveDatabase(outfile); using (var file = File.OpenRead(outfile + ".idx")) { var root = new StoredProgramFolder(); root.Stream = file; root.Offset = 0; } Console.WriteLine("Successfully generated database"); }
public MainWindow() { InitializeComponent(); spooky2 = new Spooky2.Provider(@"C:\Spooky2"); var position = new System.Drawing.Point(260, 40); generatorControl = new ManualGeneratorControl(); generatorControl.SuspendLayout(); generatorControl.Location = position; this.Controls.Add(this.generatorControl); generatorControl.ResumeLayout(false); generatorControl.PerformLayout(); generatorControl.Hide(); programControl = new ProgramControl(); programControl.SuspendLayout(); programControl.Location = position; this.Controls.Add(this.programControl); programControl.ResumeLayout(false); programControl.PerformLayout(); programControl.Hide(); channelControl = new GeneratorControl2(); channelControl.SuspendLayout(); channelControl.Location = position; this.Controls.Add(channelControl); channelControl.ResumeLayout(false); channelControl.PerformLayout(); channelControl.Hide(); generatorNode = treeView.Nodes.Add("Signal generators"); pulsesNode = treeView.Nodes.Add("Heart rate monitors"); biofeedbackNode = treeView.Nodes.Add("Biofeedback"); biofeedbackNode.ContextMenuStrip = biofeedbackMenu; var programsNode = treeView.Nodes.Add("Programs"); programsNode.Tag = spooky2.RootPresetCollection; programsNode.Nodes.Add("Dummy"); var customNode = treeView.Nodes.Add("Custom programs"); bookmarksNode = treeView.Nodes.Add("Bookmarks"); foreach (var pulse in spooky2.HeartRateMonitors) { this.pulse = pulse; pulseMonitor.DoWork += new DoWorkEventHandler(UpdatePulse); pulseMonitor.RunWorkerAsync(pulse); pulseMonitor.RunWorkerCompleted += new RunWorkerCompletedEventHandler(UpdateCompleted); var n = pulsesNode.Nodes.Add(pulse.Name); n.Tag = pulse; } var gl = spooky2.Generators; spooky2.GeneratorAdded += OnGeneratorAdded; spooky2.GeneratorRemoved += OnGeneratorRemoved; foreach (var gen in gl) { AddGenerator(gen); // gen.Reset(); } // Read the user file foreach (var prog in spooky2.Custom.Programs) { AddRunnable(customNode.Nodes, prog); } }