/// <summary> /// Creates a PlanetLab manager run history and saves it to a file. /// </summary> /// <param name="id">The history identifier.</param> /// <param name="state">The manager state.</param> public void Save(PlManagerHistoryId id, PlManagerState state) { // Create a new XML document. XDocument document = new XDocument(); }
/// <summary> /// Opens the history run with the specified identifier. /// </summary> /// <param name="id">The history identifier.</param> /// <returns>The manager history run.</returns> public PlManagerHistoryRun Open(PlManagerHistoryId id) { // Open the history from the file. using (FileStream file = new FileStream(id.FileName, FileMode.Open)) { // Deserialize the history run. return file.Deserialize<PlManagerHistoryRun>(); } }
/// <summary> /// Adds a new manager state to the the manager history. /// </summary> /// <param name="state">The manager state.</param> /// <returns>The manager history identifier.</returns> public PlManagerHistoryId Add(PlManagerState state) { // Create a new run identifier for the specified state. PlManagerHistoryId id = new PlManagerHistoryId(state.Slice.Id, state.StartTime, state.FinishTime); // Save the history to the file. using (PlManagerHistoryRun run = new PlManagerHistoryRun(state)) { // Ensure the file directory exists. if (DotNetApi.IO.Directory.EnsureFileDirectoryExists(id.FileName)) { // Create the new file. using (FileStream file = new FileStream(id.FileName, FileMode.Create)) { run.Serialize(file); } } } // Add the history to the list. this.runs.Add(id); // Return the identifier. return id; }
/// <summary> /// Adds a new run with the specified identifier. /// </summary> /// <param name="id">The history identifier.</param> private void OnAddHistory(PlManagerHistoryId id) { // Add the identifier to the combo box. this.comboBoxHistoryRun.Items.Add(id); }