Preparing for blockchain fork code upgrade
This commit is contained in:
@@ -57,6 +57,7 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Types\Common\BlockchainHash.cs" />
|
||||
<Compile Include="Types\Financial\BasicHotBitcoinAddress.cs" />
|
||||
<Compile Include="Types\Financial\BasicHotBitcoinAddressUnspent.cs" />
|
||||
<Compile Include="Types\Financial\BasicVatReport.cs" />
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Swarmops.Common.Enums;
|
||||
|
||||
namespace Swarmops.Basic.Types.Common
|
||||
{
|
||||
[Serializable]
|
||||
public class BlockchainHash
|
||||
{
|
||||
[Obsolete("Do not call the parameterless ctor", true)]
|
||||
public BlockchainHash()
|
||||
{
|
||||
// do not call the parameterless ctor; it is there for serialization to work
|
||||
}
|
||||
|
||||
public BlockchainHash(BitcoinChain chain, string hash)
|
||||
{
|
||||
this.Chain = chain;
|
||||
this.Hash = hash;
|
||||
}
|
||||
|
||||
public BitcoinChain Chain { get; private set; }
|
||||
public string Hash { get; private set; }
|
||||
|
||||
public static BlockchainHash Parse(string input)
|
||||
{
|
||||
int indexOfDash = input.IndexOf('-');
|
||||
if (indexOfDash < 0)
|
||||
{
|
||||
throw new ArgumentException("Invalid chain hash");
|
||||
}
|
||||
|
||||
string chainPart = input.Substring(0, indexOfDash);
|
||||
string hashPart = input.Substring(indexOfDash + 1);
|
||||
BitcoinChain chain = (BitcoinChain) Enum.Parse(typeof (BitcoinChain), chainPart);
|
||||
|
||||
return new BlockchainHash(chain, hashPart);
|
||||
}
|
||||
|
||||
public new string ToString()
|
||||
{
|
||||
return this.Chain.ToString() + "-" + this.Hash;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
using System;
|
||||
using Swarmops.Common.Enums;
|
||||
using Swarmops.Common.Interfaces;
|
||||
|
||||
namespace Swarmops.Basic.Types.Structure
|
||||
{
|
||||
public class BasicDocument : IHasIdentity
|
||||
{
|
||||
private readonly string clientFileName;
|
||||
private readonly int documentId;
|
||||
private readonly DocumentType documentType;
|
||||
private readonly Int64 fileSize;
|
||||
private readonly int foreignId;
|
||||
private readonly int uploadedByPersonId;
|
||||
private readonly DateTime uploadedDateTime;
|
||||
private string description;
|
||||
private string serverFileName;
|
||||
|
||||
#region IHasIdentity Members
|
||||
|
||||
public int Identity
|
||||
{
|
||||
get { return this.DocumentId; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public BasicDocument (int documentId, string serverFileName, string clientFileName, string description,
|
||||
DocumentType documentType, int foreignId, Int64 fileSize, int uploadedByPersonId, DateTime uploadedDateTime)
|
||||
{
|
||||
this.documentId = documentId;
|
||||
this.serverFileName = serverFileName;
|
||||
this.clientFileName = clientFileName;
|
||||
this.description = description;
|
||||
this.documentType = documentType;
|
||||
this.foreignId = foreignId;
|
||||
this.fileSize = fileSize;
|
||||
this.uploadedByPersonId = uploadedByPersonId;
|
||||
this.uploadedDateTime = uploadedDateTime;
|
||||
}
|
||||
|
||||
public BasicDocument (BasicDocument original) :
|
||||
this (original.documentId, original.serverFileName, original.clientFileName, original.description,
|
||||
original.documentType, original.foreignId, original.fileSize, original.uploadedByPersonId,
|
||||
original.uploadedDateTime)
|
||||
{
|
||||
// empty ctor apart from calling the other one
|
||||
}
|
||||
|
||||
public int DocumentId
|
||||
{
|
||||
get { return this.documentId; }
|
||||
}
|
||||
|
||||
public string ServerFileName
|
||||
{
|
||||
get { return this.serverFileName; }
|
||||
protected set { this.serverFileName = value; }
|
||||
}
|
||||
|
||||
public string ClientFileName
|
||||
{
|
||||
get { return this.clientFileName; }
|
||||
}
|
||||
|
||||
public string Description
|
||||
{
|
||||
get { return this.description; }
|
||||
protected set { this.description = value; }
|
||||
}
|
||||
|
||||
public DocumentType DocumentType
|
||||
{
|
||||
get { return this.documentType; }
|
||||
}
|
||||
|
||||
public int ForeignId
|
||||
{
|
||||
get { return this.foreignId; }
|
||||
}
|
||||
|
||||
public Int64 FileSize
|
||||
{
|
||||
get { return this.fileSize; }
|
||||
}
|
||||
|
||||
public int UploadedByPersonId
|
||||
{
|
||||
get { return this.uploadedByPersonId; }
|
||||
}
|
||||
|
||||
public DateTime UploadedDateTime
|
||||
{
|
||||
get { return this.uploadedDateTime; }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user