Skip to content

Commit

Permalink
Extract ElementWithSchemas.WriteCommandCollection
Browse files Browse the repository at this point in the history
References #8
  • Loading branch information
andreashuber-lawo committed Dec 28, 2015
1 parent d98376b commit 4f13c07
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
20 changes: 20 additions & 0 deletions Lawo.EmberPlusSharp/Glow/GlowCommandNumber.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// <copyright>Copyright 2012-2015 Lawo AG (http://www.lawo.com).</copyright>
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

namespace Lawo.EmberPlusSharp.Glow
{
internal enum GlowCommandNumber : long
{
/// <summary><c>Subscribe</c> command</summary>
Subscribe = 30,

/// <summary><c>Unsubscribe</c> command</summary>
Unsubscribe = 31,

/// <summary><c>GetDirectory</c> command</summary>
GetDirectory = 32
}
}
1 change: 1 addition & 0 deletions Lawo.EmberPlusSharp/Lawo.EmberPlusSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
<Compile Include="Ember\EmberConverter.cs" />
<Compile Include="Crc.cs" />
<Compile Include="Ember\EmberType.cs" />
<Compile Include="Glow\GlowCommandNumber.cs" />
<Compile Include="Glow\GlowInvocationResult.cs" />
<Compile Include="Glow\GlowInvocation.cs" />
<Compile Include="Glow\GlowSource.cs" />
Expand Down
10 changes: 10 additions & 0 deletions Lawo.EmberPlusSharp/Model/ElementWithSchemas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Lawo.EmberPlusSharp.Model
using System.Collections.Generic;

using Ember;
using Glow;

/// <summary>This class is not intended to be referenced in your code.</summary>
/// <remarks>Provides the common implementation for all elements with schemas in the object tree accessible through
Expand Down Expand Up @@ -83,6 +84,15 @@ internal RequestState RequestState
}
}

internal void WriteCommandCollection(
EmberWriter writer, GlowCommandNumber commandNumber, RequestState requestState)
{
writer.WriteStartApplicationDefinedType(GlowElementCollection.Element.OuterId, GlowCommand.InnerNumber);
writer.WriteValue(GlowCommand.Number.OuterId, (long)commandNumber);
writer.WriteEndContainer();
this.RequestState = requestState;
}

internal void ReadSchemaIdentifiers(EmberReader reader)
{
this.SchemaIdentifiers = reader.AssertAndReadContentsAsString().Split('\n');
Expand Down
5 changes: 1 addition & 4 deletions Lawo.EmberPlusSharp/Model/NodeBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ internal void WriteRequestCollection(EmberWriter writer)
{
if (this.children.Count == 0)
{
writer.WriteStartApplicationDefinedType(GlowElementCollection.Element.OuterId, GlowCommand.InnerNumber);
writer.WriteValue(GlowCommand.Number.OuterId, 32);
writer.WriteEndContainer();
this.RequestState = RequestState.RequestSent;
this.WriteCommandCollection(writer, GlowCommandNumber.GetDirectory, RequestState.RequestSent);
}
else
{
Expand Down

0 comments on commit 4f13c07

Please sign in to comment.