// Load sources from file private void LoadSources() { // Clear sources list CurrentSources.Clear(); // Check if source file exists string sourcesFile = Path.Combine(AppDataDir, "sources.txt"); if (!File.Exists(sourcesFile)) { return; } // Read tag data from file using (StreamReader sr = new StreamReader(File.OpenRead(sourcesFile))) { string line = sr.ReadLine(); while (!string.IsNullOrWhiteSpace(line)) { string[] split = line.Split(' '); CurrentSources.Add(new ImageSource(split[3], bool.Parse(split[0]), bool.Parse(split[1]), bool.Parse(split[2]))); line = sr.ReadLine(); } } }
public void Add(IComponentBase component) { if (component is Node) { Node_2 = component as Node; FindDirection(); return; } AllComponentsInBrunch.Add(component); if (component is ICurrentSource) { CurrentSources.Add(component as ICurrentSource); } if (component is IVoltageSource) { VoltageSources.Add(component as IVoltageSource); } }