Skip to content

Commit

Permalink
init pot impl
Browse files Browse the repository at this point in the history
  • Loading branch information
alec1o committed May 17, 2024
1 parent c43eef0 commit f4714b7
Show file tree
Hide file tree
Showing 6 changed files with 271 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/src/interfance/IPot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ namespace Byter
public interface IPot
{
bool IsValid { get; }
int Count { get; }
byte[] Data { get; }
IAdd Add { get; }
IGet Get { get; }
IPotAdd Add { get; }
IPotGet Get { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Byter
{
public interface IAdd
public interface IPotAdd
{
// 1 byte (3)
void Bool(bool value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Byter
{
public interface IGet
public interface IPotGet
{
// 1 byte (3)
bool Bool();
Expand Down
33 changes: 33 additions & 0 deletions src/src/partials/Pot.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;

namespace Byter
{
public partial class Pot : IPot
{
private readonly List<byte> _bytes;
public bool IsValid { get; }
public byte[] Data => _bytes.ToArray();
public IPotAdd Add { get; }
public IPotGet Get { get; }

public Pot() : this(null)
{
}

public Pot(byte[] data)
{
Get = new PotGet(this);
Add = new PotAdd(this);

IsValid = false;

_bytes = new List<byte>();

if (data != null && data.Length > 0)
{
_bytes.AddRange(data);
}
}
}
}
117 changes: 117 additions & 0 deletions src/src/partials/PotAdd.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
using System;
using System.Collections.Generic;

namespace Byter
{
public partial class Pot
{
private class PotAdd : IPotAdd
{
private Pot _pot;
public PotAdd(Pot pot)
{
_pot = pot;
}

public void Bool(bool value)
{
throw new NotImplementedException();
}

public void Byte(byte value)
{
throw new NotImplementedException();
}

public void SByteInt(sbyte value)
{
throw new NotImplementedException();
}

public void Char(char value)
{
throw new NotImplementedException();
}

public void Short(short value)
{
throw new NotImplementedException();
}

public void UShort(ushort value)
{
throw new NotImplementedException();
}

public void Int(int value)
{
throw new NotImplementedException();
}

public void UInt(uint value)
{
throw new NotImplementedException();
}

public void Float(float value)
{
throw new NotImplementedException();
}

public void Enum(Enum value)
{
throw new NotImplementedException();
}

public void Long(long value)
{
throw new NotImplementedException();
}

public void ULong(ulong value)
{
throw new NotImplementedException();
}

public void Double(double value)
{
throw new NotImplementedException();
}

public void DateTime(DateTime value)
{
throw new NotImplementedException();
}

public void Decimal(decimal value)
{
throw new NotImplementedException();
}

public void String(string value)
{
throw new NotImplementedException();
}

public void Class(object value)
{
throw new NotImplementedException();
}

public void Struct(object value)
{
throw new NotImplementedException();
}

public void Array<T>(IList<T> value)
{
throw new NotImplementedException();
}

public void List<T>(List<T> value)
{
throw new NotImplementedException();
}
}
}
}
117 changes: 117 additions & 0 deletions src/src/partials/PotGet.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
using System;
using System.Collections.Generic;

namespace Byter
{
public partial class Pot
{
private class PotGet : IPotGet
{
private Pot _pot;
public PotGet(Pot pot)
{
_pot = pot;
}

public bool Bool()
{
throw new NotImplementedException();
}

public byte Byte()
{
throw new NotImplementedException();
}

public sbyte SByteInt()
{
throw new NotImplementedException();
}

public char Char()
{
throw new NotImplementedException();
}

public short Short()
{
throw new NotImplementedException();
}

public ushort UShort()
{
throw new NotImplementedException();
}

public int Int()
{
throw new NotImplementedException();
}

public uint UInt()
{
throw new NotImplementedException();
}

public float Float()
{
throw new NotImplementedException();
}

public Enum Enum()
{
throw new NotImplementedException();
}

public long Long()
{
throw new NotImplementedException();
}

public ulong ULong()
{
throw new NotImplementedException();
}

public double Double()
{
throw new NotImplementedException();
}

public DateTime DateTime()
{
throw new NotImplementedException();
}

public decimal Decimal()
{
throw new NotImplementedException();
}

public string String()
{
throw new NotImplementedException();
}

public T Class<T>()
{
throw new NotImplementedException();
}

public T Struct<T>()
{
throw new NotImplementedException();
}

public IList<T> Array<T>()
{
throw new NotImplementedException();
}

public List<T> List<T>()
{
throw new NotImplementedException();
}
}
}
}

0 comments on commit f4714b7

Please sign in to comment.