public static DisplayAndPrintSettings loadSettings(DisplayAndPrintSettingsType settingsType) { DisplayAndPrintSettings settings = new DisplayAndPrintSettings(); if (settingsType == DisplayAndPrintSettingsType.DisplaySettings) { settings = XmlReaderWriter.readSettings(Settings.GlobalApplicationSettings.DisplaySettingsFileName); if (settings == null) { settings = new DisplayAndPrintSettings(DisplayAndPrintSettingsType.DisplaySettings); } settings.SettingsFilePath = Settings.GlobalApplicationSettings.DisplaySettingsFileName; } else if (settingsType == DisplayAndPrintSettingsType.PrintSettings) { settings = XmlReaderWriter.readSettings(Settings.GlobalApplicationSettings.PrintSettingsFilename); if (settings == null) { settings = new DisplayAndPrintSettings(DisplayAndPrintSettingsType.PrintSettings); } settings.SettingsFilePath = Settings.GlobalApplicationSettings.PrintSettingsFilename; } else if (settingsType == DisplayAndPrintSettingsType.TabletSettings) { settings = XmlReaderWriter.readSettings(Settings.GlobalApplicationSettings.TabletSettingsFilename); if (settings == null) { settings = new DisplayAndPrintSettings(DisplayAndPrintSettingsType.TabletSettings); } settings.SettingsFilePath = Settings.GlobalApplicationSettings.TabletSettingsFilename; } return(settings); }
public void WriteTestSequenceShouldWriteCorrectFileContentsIfTestCompletedIsTrue() { var xmlReaderWriter = new XmlReaderWriter(); var testObject = new BlameTestObject(new TestCase("Abc.UnitTest1", new Uri("test:/abc"), "Abc.dll")); testObject.DisplayName = "UnitTest1"; var testSequence = new List <Guid> { testObject.Id }; var testObjectDictionary = new Dictionary <Guid, BlameTestObject> { { testObject.Id, testObject } }; testObjectDictionary[testObject.Id].IsCompleted = true; var filePath = xmlReaderWriter.WriteTestSequence(testSequence, testObjectDictionary, Path.GetTempPath()); var testCaseList = xmlReaderWriter.ReadTestSequence(filePath); File.Delete(filePath); Assert.AreEqual("Abc.UnitTest1", testCaseList.First().FullyQualifiedName); Assert.AreEqual("UnitTest1", testCaseList.First().DisplayName); Assert.AreEqual("Abc.dll", testCaseList.First().Source); Assert.IsTrue(testCaseList.First().IsCompleted); }
private void 启用ToolStripMenuItem_Click(object sender, EventArgs e) { int BoxId = 0; if (listViewBox.SelectedItems.Count != 0) { listViewBox.SelectedItems[0].ImageIndex = 0; switch (listViewBox.SelectedItems[0].Text) { case "Box1": BoxId = 1; break; case "Box2": BoxId = 2; break; case "Box3": BoxId = 3; break; case "Box4": BoxId = 4; break; case "Box5": BoxId = 5; break; case "Box6": BoxId = 6; break; default: break; } XmlReaderWriter.SetBoxAttribute(Files.BoxData, BoxId, ShieldBoxItem.State, "Enable"); buttonBoxLoad_Click(null, null); } else { MessageBox.Show("Please Select Box!"); } }
public void saveSet() { if (this.setName != "" && changeMade == true) { xmlSetSongCollection = new XmlSetSongCollection(songList); XmlReaderWriter.writeSet(Settings.GlobalApplicationSettings.SetsFolder + this.setName, this); changeMade = false; } }
public static Set loadSet(string setName) { Set set = XmlReaderWriter.readSet(Settings.GlobalApplicationSettings.SetsFolder + setName); set.setName = setName; set.changeMade = false; set.indexOfCurrentSong = set.songList.Count - 1; set.songSetSize = set.songList.Count; return(set); }
/// <summary> /// returns true if new song /// </summary> /// <returns></returns> public bool saveSong() { //make sure the "Just Lyrics" are recreated _justLyrics = null; if (this.title == "") { throw new Exception("Song title cannot be blank"); } return(XmlReaderWriter.writeSong(Settings.GlobalApplicationSettings.SongsFolder, this)); }
//load settings file from indicated path public static UserInterfaceSettings loadSettings() { var settings = XmlReaderWriter.readUserInterfaceSettings(Settings.GlobalApplicationSettings.UserInterfaceSettingsFileName); if (settings == null) { settings = new UserInterfaceSettings(); } return(settings); }
private void buttonCreateXml_Click(object sender, EventArgs e) { try { XmlReaderWriter.CreateStorageFile("RackData.xml"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private static Song loadSongFromFileSystem(string SongName) { string filename = Settings.GlobalApplicationSettings.SongsFolder + SongName; if (!File.Exists(filename)) { throw new Exception(string.Format("Song: {0} does not exist", SongName)); } Song song = XmlReaderWriter.readSong(Settings.GlobalApplicationSettings.SongsFolder, SongName); return(song); }
//load settings file from indicated path public static DisplayAndPrintSettings loadSettings(DisplayAndPrintSettingsType settingsType, string path) { var settings = XmlReaderWriter.readSettings(path); if (settings == null) { settings = new DisplayAndPrintSettings(settingsType, path); } settings.SettingsFilePath = path; settings.settingsType = settingsType; return(settings); }
/// <summary> /// writes the current set as an OpenSong set /// </summary> /// <param name="set">The Original OpenChords set</param> private static void writeOpenSongSet(Set set) { try { var filename = Settings.GlobalApplicationSettings.OpenSongSetFolder + set.setName; XmlReaderWriter.writeSet(filename, set); } catch (Exception Ex) { logger.Error("Error writing opensong set", Ex); } }
private void buttonOK6_Click(object sender, EventArgs e) { try { string Com = comboBox6.SelectedItem.ToString(); _portName.Remove(Com); ClearItem(); if (comboBox6.Items.Contains(Com) == false) { comboBox6.Items.Add(Com); } XmlReaderWriter.SetBoxAttribute(Files.BoxData, 6, ShieldBoxItem.COM, Com); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void buttonBoxLoad_Click(object sender, EventArgs e) { string[] _PortName = SerialPort.GetPortNames(); if (_portName == null) { _portName = new ArrayList(_PortName); } ClearItem(); foreach (var item in _portName) { comboBox1.Items.Add(item); comboBox2.Items.Add(item); comboBox3.Items.Add(item); comboBox4.Items.Add(item); comboBox5.Items.Add(item); comboBox6.Items.Add(item); } comboBox1.Text = XmlReaderWriter.GetBoxAttribute(Files.BoxData, 1, ShieldBoxItem.COM); comboBox2.Text = XmlReaderWriter.GetBoxAttribute(Files.BoxData, 2, ShieldBoxItem.COM); comboBox3.Text = XmlReaderWriter.GetBoxAttribute(Files.BoxData, 3, ShieldBoxItem.COM); comboBox4.Text = XmlReaderWriter.GetBoxAttribute(Files.BoxData, 4, ShieldBoxItem.COM); comboBox5.Text = XmlReaderWriter.GetBoxAttribute(Files.BoxData, 5, ShieldBoxItem.COM); comboBox6.Text = XmlReaderWriter.GetBoxAttribute(Files.BoxData, 6, ShieldBoxItem.COM); listViewBox.Items[0].ImageIndex = XmlReaderWriter.GetBoxAttribute(Files.BoxData, 1, ShieldBoxItem.State) == "Enable" ? 0 : 1; listViewBox.Items[1].ImageIndex = XmlReaderWriter.GetBoxAttribute(Files.BoxData, 2, ShieldBoxItem.State) == "Enable" ? 0 : 1; listViewBox.Items[2].ImageIndex = XmlReaderWriter.GetBoxAttribute(Files.BoxData, 3, ShieldBoxItem.State) == "Enable" ? 0 : 1; listViewBox.Items[3].ImageIndex = XmlReaderWriter.GetBoxAttribute(Files.BoxData, 4, ShieldBoxItem.State) == "Enable" ? 0 : 1; listViewBox.Items[4].ImageIndex = XmlReaderWriter.GetBoxAttribute(Files.BoxData, 5, ShieldBoxItem.State) == "Enable" ? 0 : 1; listViewBox.Items[5].ImageIndex = XmlReaderWriter.GetBoxAttribute(Files.BoxData, 6, ShieldBoxItem.State) == "Enable" ? 0 : 1; comboBox1.Enabled = XmlReaderWriter.GetBoxAttribute(Files.BoxData, 1, ShieldBoxItem.State) == "Enable" ? true : false; buttonOK1.Enabled = XmlReaderWriter.GetBoxAttribute(Files.BoxData, 1, ShieldBoxItem.State) == "Enable" ? true : false; comboBox2.Enabled = XmlReaderWriter.GetBoxAttribute(Files.BoxData, 2, ShieldBoxItem.State) == "Enable" ? true : false; buttonOK2.Enabled = XmlReaderWriter.GetBoxAttribute(Files.BoxData, 2, ShieldBoxItem.State) == "Enable" ? true : false; comboBox3.Enabled = XmlReaderWriter.GetBoxAttribute(Files.BoxData, 3, ShieldBoxItem.State) == "Enable" ? true : false; buttonOK3.Enabled = XmlReaderWriter.GetBoxAttribute(Files.BoxData, 3, ShieldBoxItem.State) == "Enable" ? true : false; comboBox4.Enabled = XmlReaderWriter.GetBoxAttribute(Files.BoxData, 4, ShieldBoxItem.State) == "Enable" ? true : false; buttonOK4.Enabled = XmlReaderWriter.GetBoxAttribute(Files.BoxData, 4, ShieldBoxItem.State) == "Enable" ? true : false; comboBox5.Enabled = XmlReaderWriter.GetBoxAttribute(Files.BoxData, 5, ShieldBoxItem.State) == "Enable" ? true : false; buttonOK5.Enabled = XmlReaderWriter.GetBoxAttribute(Files.BoxData, 5, ShieldBoxItem.State) == "Enable" ? true : false; comboBox6.Enabled = XmlReaderWriter.GetBoxAttribute(Files.BoxData, 6, ShieldBoxItem.State) == "Enable" ? true : false; buttonOK6.Enabled = XmlReaderWriter.GetBoxAttribute(Files.BoxData, 6, ShieldBoxItem.State) == "Enable" ? true : false; }
private TargetPosition LoadPosition(TeachPos pos, Location id) { TargetPosition target = new TargetPosition { Id = id, XPos = Convert.ToDouble( XmlReaderWriter.GetTeachAttribute(Files.RackData, pos, PosItem.XPos)), YPos = Convert.ToDouble( XmlReaderWriter.GetTeachAttribute(Files.RackData, pos, PosItem.YPos)), ZPos = Convert.ToDouble( XmlReaderWriter.GetTeachAttribute(Files.RackData, pos, PosItem.ZPos)), RPos = Convert.ToDouble( XmlReaderWriter.GetTeachAttribute(Files.RackData, pos, PosItem.RPos)), APos = Convert.ToDouble( XmlReaderWriter.GetTeachAttribute(Files.RackData, pos, PosItem.APos)), ApproachHeight = Convert.ToDouble( XmlReaderWriter.GetTeachAttribute(Files.RackData, pos, PosItem.ApproachHeight)) }; return(target); }
private void 禁用ToolStripMenuItem_Click(object sender, EventArgs e) { if (listViewBox.SelectedItems.Count != 0) { int BoxId = 0; string Com = "None"; if (listViewBox.SelectedItems.Count != 0) { listViewBox.SelectedItems[0].ImageIndex = 1; switch (listViewBox.SelectedItems[0].Text) { case "Box1": BoxId = 1; Com = comboBox1.Text; comboBox1.Text = "None"; break; case "Box2": BoxId = 2; Com = comboBox2.Text; comboBox2.Text = "None"; break; case "Box3": BoxId = 3; Com = comboBox3.Text; comboBox3.Text = "None"; break; case "Box4": BoxId = 4; Com = comboBox4.Text; comboBox4.Text = "None"; break; case "Box5": BoxId = 5; Com = comboBox5.Text; comboBox5.Text = "None"; break; case "Box6": BoxId = 6; Com = comboBox6.Text; comboBox6.Text = "None"; break; default: break; } XmlReaderWriter.SetBoxAttribute(Files.BoxData, BoxId, ShieldBoxItem.State, "Disable"); XmlReaderWriter.SetBoxAttribute(Files.BoxData, BoxId, ShieldBoxItem.COM, "None"); if (_portName.Contains(Com) == false) { _portName.Add(Com); } buttonBoxLoad_Click(null, null); } else { MessageBox.Show("Please Select Box!"); } } }
public void ShieldBoxSetupForSimulation() { ShieldBox1 = new ShieldBox(1); ShieldBox2 = new ShieldBox(2); ShieldBox3 = new ShieldBox(3); ShieldBox4 = new ShieldBox(4); ShieldBox5 = new ShieldBox(5); ShieldBox6 = new ShieldBox(6); ShieldBoxs = new ShieldBox[6] { ShieldBox1, ShieldBox2, ShieldBox3, ShieldBox4, ShieldBox5, ShieldBox6 }; foreach (var box in ShieldBoxs) { box.PortName = XmlReaderWriter.GetBoxAttribute(Files.BoxData, box.Id, ShieldBoxItem.COM); box.Enabled = XmlReaderWriter.GetBoxAttribute(Files.BoxData, box.Id, ShieldBoxItem.State) == "Enable"; box.Empty = true; box.Available = true; box.Position = ConvertBoxIdToTargetPosition(box.Id); } }
public void saveSettings() { XmlReaderWriter.writeUserInterfaceSettings(Settings.GlobalApplicationSettings.UserInterfaceSettingsFileName, this); }
internal void saveSong(string destination) { XmlReaderWriter.writeSong(destination, this); }
private void button4_Click(object sender, EventArgs e) { XmlReaderWriter.CreateStorageFile("RackData.xml"); }
// Use this for initialization void Start() { LoadCalibrationData (); clusters = new List<GameObject>(); clusters.AddRange(GameObject.FindGameObjectsWithTag("Cluster")); annotations = new Dictionary<int,Annotation>(); gameObjectsInTheScene = new List<GameObject> (); canvas = GameObject.Find("/Canvas"); xmlReaderWriter = new XmlReaderWriter (xmlPath); xmlReaderWriter.LoadFromFile (); Take take = xmlReaderWriter.Take; currentCalibration = take.Name; //organize annotations per time and duration // write text annotation Annotation value; textAnnotationList = take.TextAnnotationList; int idTextAnnoations = 0; // use this as id because the id on the xml might not be in sequence foreach (AnnotationText annotationText in textAnnotationList) { //if(!annotations.TryGetValue(annotationText.Begin, out value)) annotations.Add(idTextAnnoations, annotationText); idTextAnnoations++; //else { // int beginning = annotationText.Begin + 5; // annotations.Add(beginning, annotationText); //} //WriteTextAnnotation(annotationText); } inkAnnotationList = take.InkAnnotationList; foreach (AnnotationInk annotationInk in inkAnnotationList) { //if(!annotations.TryGetValue(annotationInk.Begin, out value)) annotations.Add(annotationInk.ID, annotationInk); //else // annotations.Add(++annotationInk.Begin, annotationInk); //WriteInkAnnotation(annotationInk); } linkAnnotationList = take.LinkAnnotationList; foreach (AnnotationLink annotationLink in linkAnnotationList) { //if(!annotations.TryGetValue(annotationLink.Begin, out value)) annotations.Add(annotationLink.ID, annotationLink); //else // annotations.Add(++annotationLink.Begin, annotationLink); //WriteLinkAnnotation(annotationLink); } //TODO: ADD MARK ANNOTATIONS //markAnnotationList = take.MarkAnnotationList; annotationListOrderByID = annotations.Keys.ToList(); //DebugAnnotationSorting (); }
public void saveSettings(string path) { XmlReaderWriter.writeSettings(path, this); }
private void buttonBoxSave_Click(object sender, EventArgs e) { XmlReaderWriter.CreateBoxDataFile(Files.BoxData); }
public AppMetadataStore(DirectoryInfo aStoreDirectory) { var xmlReaderWriter = new XmlReaderWriter(AppMetadataSchemaSet, Logger); iDiskStore = new DiskStore<AppMetadata>( aStoreDirectory, AppFileExtension, aReader => ParseAppElement(xmlReaderWriter.ReadFile(aReader)), (aWriter, aApp) => xmlReaderWriter.WriteFile(aWriter, AppToXElement(aApp))); }
internal void saveSong(string destination) { _dictionaryOfAllSongs[this.SongSubFolder + @"\" + this.title] = this; XmlReaderWriter.writeSong(destination, this); }