- remove bool return value and todo

master
Simon G 5 years ago
parent 6b34b5ec06
commit a29700e38b
  1. 6
      GBase/DataHandling/XmlDataWriter.cs
  2. 2
      GBase/Interfaces/DataHandling/IDataWriter.cs

@ -27,18 +27,16 @@ namespace GBase.DataHandling
/// <param name="cancellationToken">A <see cref="CancellationToken"/> to cancel the async operation</param> /// <param name="cancellationToken">A <see cref="CancellationToken"/> to cancel the async operation</param>
/// <returns>Returns true if successful, false if not</returns> /// <returns>Returns true if successful, false if not</returns>
/// <exception cref="Exception">No root element found</exception> /// <exception cref="Exception">No root element found</exception>
public async Task<bool> InitFile(FileStream file, string rootElementName, CancellationToken cancellationToken) public async Task InitFile(FileStream file, string rootElementName, CancellationToken cancellationToken)
{ {
//if the xml file isn't empty, return //if the xml file isn't empty, return
if (file.Length > 3) //> 3 because of BOM if (file.Length > 3) //> 3 because of BOM
return true; //TODO: Don't return bool? return;
XDocument xmlDocument = new XDocument(); XDocument xmlDocument = new XDocument();
xmlDocument.Add(new XElement(rootElementName)); xmlDocument.Add(new XElement(rootElementName));
file.Seek(0, SeekOrigin.Begin); //reset stream to it's beginning to be able to save it file.Seek(0, SeekOrigin.Begin); //reset stream to it's beginning to be able to save it
await xmlDocument.SaveAsync(file, SaveOptions.OmitDuplicateNamespaces, cancellationToken); await xmlDocument.SaveAsync(file, SaveOptions.OmitDuplicateNamespaces, cancellationToken);
return true;
} }
/// <summary> /// <summary>

@ -21,7 +21,7 @@ namespace GBase.Interfaces.DataHandling
/// <param name="rootElementName"></param> /// <param name="rootElementName"></param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> to cancel the async operation</param> /// <param name="cancellationToken">A <see cref="CancellationToken"/> to cancel the async operation</param>
/// <returns>Returns true if successful, false if not</returns> /// <returns>Returns true if successful, false if not</returns>
Task<bool> InitFile(FileStream file, string rootElementName, CancellationToken cancellationToken); Task InitFile(FileStream file, string rootElementName, CancellationToken cancellationToken);
/// <summary> /// <summary>
/// Write the data of a property /// Write the data of a property

Loading…
Cancel
Save