Skip to content

Commit

Permalink
Release 1.4 Build 15316
Browse files Browse the repository at this point in the history
Fixes #5 : regression by issue #4
Adding the Developer Tools for UPnP libs to the solution for easily debugging
  • Loading branch information
sebastienwarin committed Nov 12, 2015
1 parent b52dc1d commit 846c0bc
Show file tree
Hide file tree
Showing 147 changed files with 91,413 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
/*
Copyright 2006 - 2010 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

using System;
using System.Text;
using System.Collections;
using System.Runtime.Serialization;
using OpenSource.UPnP;
using OpenSource.UPnP.AV;

namespace OpenSource.UPnP.AV.CdsMetadata
{
/// <summary>
///
/// <para>
/// Accumulator_SystemUpdateID is responsible for accumulating and resetting the values
/// that get sent in the ContentDirectory's ContainerUpdateIDs state variable. The state variable
/// is a moderated state variable that events a maximum of once every 2 seconds,
/// and has a dynamic string value derived from the containers that have recently changed.
/// </para>
///
/// <para>
/// The format of the string is a comma-separated-value (CSV) list in the form of
/// <example>
/// "[containerID]Accumulator_ContainerUpdateIDs.Delimitor[container.UpdateID],[containerIDn]Accumulator_ContainerUpdateIDs.Delimitor[container.UpdatedID]...".
/// </example>
/// </para>
///
/// </summary>
[Serializable()]
public class Accumulator_ContainerUpdateIDs : UPnPModeratedStateVariable.IAccumulator
{
/// <summary>
/// This method is called automatically by the UPNP stack when eventing the
/// ContainerUpdateIDs. Programmers need only set the value of the ContainerUpdateIDs
/// state variable with a single elem
/// </summary>
/// <param name="current">Comma-separated-value list in the string form of "[containerID] UpdateID= [container.UpdateID], [containerIDn] UpdateID= [container.UpdatedID]"</param>
/// <param name="newObject">String that should overwrite an existing comma-separated-value item or append to the existing list, in form "[containerID] UpdateID= [container.UpdateID]"</param>
/// <returns></returns>
public object Merge(object current, object newObject)
{
DText Parser = new DText();
Parser.ATTRMARK = Accumulator_ContainerUpdateIDs.CSV_Delimitor;

DText Parser2 = new DText();
Parser2.ATTRMARK = Accumulator_ContainerUpdateIDs.Delimitor;

if (current == null) current = "";
if (newObject == null) newObject = "";

string curStr = current.ToString();
string newStr = newObject.ToString();

if (newStr == "") return "";

int i;
Hashtable hash = new Hashtable();
if (curStr != "")
{

Parser[0] = curStr;
int cnt = Parser.DCOUNT();
for (i=1; i <= cnt; i++)
{
string id, update;
if (Accumulator_ContainerUpdateIDs.Delimitor == Accumulator_ContainerUpdateIDs.CSV_Delimitor)
{
id = Parser[i];
i++;
update = Parser[i];
hash[id] = update;
}
else
{
string pair = Parser[i];
Parser2[0] = pair;
id = Parser2[1];;
update = Parser2[2];
hash[id] = update;
}

if (id == "")
{
throw new ApplicationException("Bad evil. Container ID is empty string.");
}
if (update == "")
{
throw new ApplicationException("Bad evil. Update ID is empty string.");
}
}
}

/*
* add or overwrite a container update value
*/

Parser2[0] = newStr;
string id2 = Parser2[1];
string update2 = Parser2[2];
hash[id2] = update2;

StringBuilder sb = new StringBuilder(hash.Count * 20);
i=0;
foreach (string key in hash.Keys)
{
if (i > 0)
{
sb.Append(",");
}
i++;

string val = hash[key].ToString();
if (key == "")
{
throw new ApplicationException("Bad evil. Accumulator has empty string for key.");
}
if (val == "")
{
throw new ApplicationException("Bad evil. Accumulator has empty string for value.");
}
sb.AppendFormat("{0}{1}{2}", key, Delimitor, val);
}

return sb.ToString();
}

/// <summary>
/// Called automatically by the UPNP stack. The method is called after
/// the variable is evented, and the "current" value becomes an
/// empty string.
/// </summary>
/// <returns></returns>
public object Reset() { return ""; }

/// <summary>
/// Delimitor value used to separate the ContainerID from the container's updateID.
/// </summary>
public const string Delimitor = ",";

/// <summary>
/// Used to separate out pairs of containerID+updateID from each other
/// in a comma separated value list.
/// </summary>
public const string CSV_Delimitor = ",";


/// <summary>
/// Allows parsing of delimited strings.
/// </summary>
private static DText DT = new DText();
}
}
57 changes: 57 additions & 0 deletions DeveloperToolsForUPnPTechnologies/UPNPAVCDSML/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using System.Reflection;
using System.Runtime.CompilerServices;

//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("UPnP/AV Metadata Library")]
[assembly: AssemblyDescription("Universal Plug & Play AV (UPnP/AV) Metadata Library")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:

[assembly: AssemblyVersion("1.0.*")]

//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyName("")]

0 comments on commit 846c0bc

Please sign in to comment.