Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supporting QBXML16. #65

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87,695 changes: 54,459 additions & 33,236 deletions src/QbXml/Objects/Objects.cs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/QbXml/QbXml.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Author>Jean-Sébastien Goupil</Author>
<Authors>Jean-Sébastien Goupil</Authors>
<Copyright>Copyright © Jean-Sébastien Goupil 2015-2021</Copyright>
<Version>3.1.0</Version>
<Version>4.0.0-alpha.1</Version>
<AssemblyName>QbSync.QbXml</AssemblyName>
<RootNamespace>QbSync.QbXml</RootNamespace>
<PackageId>QbSync.QbXml</PackageId>
Expand Down
18 changes: 15 additions & 3 deletions src/QbXml/QbXmlRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,30 @@ public class QbXmlRequest
/// <summary>
/// Version used by QBXML.
/// </summary>
public static readonly Version VERSION = new Version(13, 0);
public static readonly Version VERSION = new Version(16, 0);

private readonly List<QBXMLMsgsRq> qbxmlMsgsRqList;
private readonly Version version;

/// <summary>
/// Creates a QbXmlRequest.
/// </summary>
public QbXmlRequest()
: this(VERSION)
{
qbxmlMsgsRqList = new List<QBXMLMsgsRq>();
}

/// <summary>
/// Creates a QbXmlRequest with a specific version.
/// </summary>
/// <param name="version">The requested QBXML version.</param>
public QbXmlRequest(Version version)
{
qbxmlMsgsRqList = new List<QBXMLMsgsRq>();
this.version = version;
}

/// <summary>
/// Adds a message.
/// </summary>
Expand Down Expand Up @@ -58,13 +70,13 @@ public string GetRequest()
var qbXml = new QBXML
{
Items = qbxmlMsgsRqList.ToArray(),
ItemsElementName = Enumerable.Repeat(ItemsChoiceType99.QBXMLMsgsRq, qbxmlMsgsRqList.Count()).ToArray()
ItemsElementName = Enumerable.Repeat(ItemsChoiceType106.QBXMLMsgsRq, qbxmlMsgsRqList.Count()).ToArray()
};

using var writer = new StringWriter();
using XmlWriter xmlWriter = new QbXmlTextWriter(writer);
xmlWriter.WriteProcessingInstruction("xml", "version=\"1.0\" encoding=\"utf-8\"");
xmlWriter.WriteProcessingInstruction("qbxml", string.Format("version=\"{0}.{1}\"", VERSION.Major, VERSION.Minor));
xmlWriter.WriteProcessingInstruction("qbxml", string.Format("version=\"{0}.{1}\"", version.Major, version.Minor));
var ns = new XmlSerializerNamespaces();
ns.Add("", "");
QbXmlSerializer.Instance.XmlSerializer.Serialize(xmlWriter, qbXml, ns);
Expand Down
Loading