1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- using System.IO;
- namespace fis.Vid.Visuals
- {
- public enum VinnoModeType
- {
- Undefined =0,
- Tissue,
- Flow,
- Doppler,
- TissueTM,
- Tissue3D,
- FlowM,
- };
- public class VinnoMode
- {
- public string Name { get; }
- public string DisplayName { get; }
- public VinnoModeType Type { get; }
- public VinnoMode(string name, string displayName, VinnoModeType type)
- {
- Name = name;
- DisplayName = displayName;
- Type = type;
- }
- public byte[] ToBytes()
- {
- byte[] result;
- using (var stream = new MemoryStream())
- {
- var writer = new VinnoStreamWriter(stream);
- writer.WriteString(Name);
- writer.WriteString(DisplayName);
- writer.WriteByte((byte) Type);
- result = stream.ToArray();
- }
- return result;
- }
- public static VinnoMode FromBytes(byte[] bytes)
- {
- VinnoMode result;
- using (var stream = new MemoryStream(bytes))
- {
- stream.Position = 0;
- var reader = new VinnoStreamReader(stream);
- var name = reader.ReadString();
- var displayName = reader.ReadString();
- var type = (VinnoModeType)reader.ReadByte();
- result = new VinnoMode(name,displayName,type);
- }
- return result;
- }
- }
- }
|