74 lines
2.5 KiB
C#
74 lines
2.5 KiB
C#
//-----------------------------------------------------------------------
|
|
// <copyright file="BinaryModel.cs" company="BTU/IIT">
|
|
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
|
|
// </copyright>
|
|
// <author>Stubbfel</author>
|
|
// <date>15.10.2013</date>
|
|
// <summary>Implements the binary model class</summary>
|
|
//-----------------------------------------------------------------------
|
|
namespace CampusAppWP8.Model
|
|
{
|
|
using CampusAppWPortalLib8.Model;
|
|
|
|
/// <summary> Binary model. </summary>
|
|
/// <remarks> Stubbfel, 03.09.2013. </remarks>
|
|
/// <seealso cref="T:CampusAppWP8.Model.MainModel{System.Byte[]}"/>
|
|
public abstract class BinaryModel : MainModel<byte[]>
|
|
{
|
|
#region Constructor
|
|
|
|
/// <summary> Initializes a new instance of the BinaryModel class. </summary>
|
|
/// <remarks> Stubbfel, 03.09.2013. </remarks>
|
|
/// <param name="modelType"> Type of the model. </param>
|
|
/// <param name="fileName"> Filename of the file. </param>
|
|
/// <param name="url"> URL of the document. </param>
|
|
public BinaryModel(ModelType modelType, string fileName, string url)
|
|
: base(modelType, fileName, url)
|
|
{
|
|
}
|
|
|
|
/// <summary> Initializes a new instance of the BinaryModel class. </summary>
|
|
/// <remarks> Stubbfel, 03.09.2013. </remarks>
|
|
/// <param name="modelType"> Type of the model. </param>
|
|
/// <param name="sourceName"> Name of the source. </param>
|
|
public BinaryModel(ModelType modelType, string sourceName)
|
|
: base(modelType, sourceName)
|
|
{
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Method
|
|
|
|
/// <summary> Deserialize model. </summary>
|
|
/// <remarks> Stubbfel, 03.09.2013. </remarks>
|
|
/// <param name="modelData"> Information describing the model. </param>
|
|
/// <returns> true if it succeeds, false if it fails. </returns>
|
|
protected override bool DeserializeModel(byte[] modelData)
|
|
{
|
|
bool retValue = true;
|
|
|
|
if (modelData != null)
|
|
{
|
|
this.Model = modelData;
|
|
}
|
|
else
|
|
{
|
|
retValue = false;
|
|
}
|
|
|
|
return retValue;
|
|
}
|
|
|
|
/// <summary> Gets the serialize model. </summary>
|
|
/// <remarks> Stubbfel, 03.09.2013. </remarks>
|
|
/// <returns> an byte Array. </returns>
|
|
protected override byte[] SerializeModel()
|
|
{
|
|
return this.Model;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|