TH1/Unity/Assets/Plugins/ViSDK/ViSystem/ViSerializer.cs
2025-08-20 02:24:48 +08:00

390 lines
8.6 KiB
C#

using System;
using System.Collections.Generic;
using ViArrayIdx = System.Int32;
using Int8 = System.SByte;
using UInt8 = System.Byte;
public static class ViStringSerialize
{
public static void Read(string strValue, out bool value)
{
value = Convert.ToBoolean(strValue);
}
public static void Read(string strValue, out Int8 value)
{
value = Convert.ToSByte(strValue);
}
public static void Read(string strValue, out UInt8 value)
{
value = Convert.ToByte(strValue);
}
public static void Read(string strValue, out Int16 value)
{
value = Convert.ToInt16(strValue);
}
public static void Read(string strValue, out UInt16 value)
{
value = Convert.ToUInt16(strValue);
}
public static void Read(string strValue, out Int32 value)
{
value = Convert.ToInt32(strValue);
}
public static void Read(string strValue, out UInt32 value)
{
value = Convert.ToUInt32(strValue);
}
public static void Read(string strValue, out Int64 value)
{
value = Convert.ToInt64(strValue);
}
public static void Read(string strValue, out UInt64 value)
{
value = Convert.ToUInt64(strValue);
}
public static void Read(string strValue, out float value)
{
value = Convert.ToSingle(strValue);
}
public static void Read(string strValue, out double value)
{
value = Convert.ToDouble(strValue);
}
public static void Read(string strValue, out string value)
{
value = strValue;
}
public static void PrintTo(Int8 value, ref string strValue)
{
strValue += value;
}
public static void PrintTo(List<Int8> list, ref string strValue)
{
strValue += "(";
for (int iter = 0; iter < list.Count; ++iter)
{
Int8 value = list[iter];
strValue += value;
strValue += ",";
}
strValue += ")";
}
public static void PrintTo(UInt8 value, ref string strValue)
{
strValue += value;
}
public static void PrintTo(List<UInt8> list, ref string strValue)
{
strValue += "(";
for (int iter = 0; iter < list.Count; ++iter)
{
UInt8 value = list[iter];
strValue += value;
strValue += ",";
}
strValue += ")";
}
public static void PrintTo(Int16 value, ref string strValue)
{
strValue += value;
}
public static void PrintTo(List<Int16> list, ref string strValue)
{
strValue += "(";
for (int iter = 0; iter < list.Count; ++iter)
{
Int16 value = list[iter];
strValue += value;
strValue += ",";
}
strValue += ")";
}
public static void PrintTo(UInt16 value, ref string strValue)
{
strValue += value;
}
public static void PrintTo(List<UInt16> list, ref string strValue)
{
strValue += "(";
for (int iter = 0; iter < list.Count; ++iter)
{
UInt16 value = list[iter];
strValue += value;
strValue += ",";
}
strValue += ")";
}
public static void PrintTo(Int32 value, ref string strValue)
{
strValue += value;
}
public static void PrintTo(List<Int32> list, ref string strValue)
{
strValue += "(";
for (int iter = 0; iter < list.Count; ++iter)
{
Int32 value = list[iter];
strValue += value;
strValue += ",";
}
strValue += ")";
}
public static void PrintTo(UInt32 value, ref string strValue)
{
strValue += value;
}
public static void PrintTo(List<UInt32> list, ref string strValue)
{
strValue += "(";
for (int iter = 0; iter < list.Count; ++iter)
{
UInt32 value = list[iter];
strValue += value;
strValue += ",";
}
strValue += ")";
}
public static void PrintTo(Int64 value, ref string strValue)
{
strValue += value;
}
public static void PrintTo(List<Int64> list, ref string strValue)
{
strValue += "(";
for (int iter = 0; iter < list.Count; ++iter)
{
Int64 value = list[iter];
strValue += value;
strValue += ",";
}
strValue += ")";
}
public static void PrintTo(UInt64 value, ref string strValue)
{
strValue += value;
}
public static void PrintTo(List<UInt64> list, ref string strValue)
{
strValue += "(";
for (int iter = 0; iter < list.Count; ++iter)
{
UInt64 value = list[iter];
strValue += value;
strValue += ",";
}
strValue += ")";
}
public static void PrintTo(float value, ref string strValue)
{
strValue += value;
}
public static void PrintTo(List<float> list, ref string strValue)
{
strValue += "(";
for (int iter = 0; iter < list.Count; ++iter)
{
float value = list[iter];
strValue += value;
strValue += ",";
}
strValue += ")";
}
public static void PrintTo(double value, ref string strValue)
{
strValue += value;
}
public static void PrintTo(List<double> list, ref string strValue)
{
strValue += "(";
for (int iter = 0; iter < list.Count; ++iter)
{
double value = list[iter];
strValue += value;
strValue += ",";
}
strValue += ")";
}
public static void PrintTo(string value, ref string strValue)
{
strValue += value;
}
public static void PrintTo(List<string> list, ref string strValue)
{
strValue += "(";
for (int iter = 0; iter < list.Count; ++iter)
{
string value = list[iter];
strValue += value;
strValue += ",";
}
strValue += ")";
}
public static void PrintTo(Int8 value, ViStringBuilder strValue)
{
strValue.Add(value);
}
public static void PrintTo(List<Int8> list, ViStringBuilder strValue)
{
strValue.Add("(");
for (int iter = 0; iter < list.Count; ++iter)
{
Int8 value = list[iter];
strValue.Add(value);
strValue.Add(",");
}
strValue.Add(")");
}
public static void PrintTo(UInt8 value, ViStringBuilder strValue)
{
strValue.Add(value);
}
public static void PrintTo(List<UInt8> list, ViStringBuilder strValue)
{
strValue.Add("(");
for (int iter = 0; iter < list.Count; ++iter)
{
UInt8 value = list[iter];
strValue.Add(value);
strValue.Add(",");
}
strValue.Add(")");
}
public static void PrintTo(Int16 value, ViStringBuilder strValue)
{
strValue.Add(value);
}
public static void PrintTo(List<Int16> list, ViStringBuilder strValue)
{
strValue.Add("(");
for (int iter = 0; iter < list.Count; ++iter)
{
Int16 value = list[iter];
strValue.Add(value);
strValue.Add(",");
}
strValue.Add(")");
}
public static void PrintTo(UInt16 value, ViStringBuilder strValue)
{
strValue.Add(value);
}
public static void PrintTo(List<UInt16> list, ViStringBuilder strValue)
{
strValue.Add("(");
for (int iter = 0; iter < list.Count; ++iter)
{
UInt16 value = list[iter];
strValue.Add(value);
strValue.Add(",");
}
strValue.Add(")");
}
public static void PrintTo(Int32 value, ViStringBuilder strValue)
{
strValue.Add(value);
}
public static void PrintTo(List<Int32> list, ViStringBuilder strValue)
{
strValue.Add("(");
for (int iter = 0; iter < list.Count; ++iter)
{
Int32 value = list[iter];
strValue.Add(value);
strValue.Add(",");
}
strValue.Add(")");
}
public static void PrintTo(UInt32 value, ViStringBuilder strValue)
{
strValue.Add(value);
}
public static void PrintTo(List<UInt32> list, ViStringBuilder strValue)
{
strValue.Add("(");
for (int iter = 0; iter < list.Count; ++iter)
{
UInt32 value = list[iter];
strValue.Add(value);
strValue.Add(",");
}
strValue.Add(")");
}
public static void PrintTo(Int64 value, ViStringBuilder strValue)
{
strValue.Add(value);
}
public static void PrintTo(List<Int64> list, ViStringBuilder strValue)
{
strValue.Add("(");
for (int iter = 0; iter < list.Count; ++iter)
{
Int64 value = list[iter];
strValue.Add(value);
strValue.Add(",");
}
strValue.Add(")");
}
public static void PrintTo(UInt64 value, ViStringBuilder strValue)
{
strValue.Add(value);
}
public static void PrintTo(List<UInt64> list, ViStringBuilder strValue)
{
strValue.Add("(");
for (int iter = 0; iter < list.Count; ++iter)
{
UInt64 value = list[iter];
strValue.Add(value);
strValue.Add(",");
}
strValue.Add(")");
}
public static void PrintTo(float value, ViStringBuilder strValue)
{
strValue.Add(value);
}
public static void PrintTo(List<float> list, ViStringBuilder strValue)
{
strValue.Add("(");
for (int iter = 0; iter < list.Count; ++iter)
{
float value = list[iter];
strValue.Add(value);
strValue.Add(",");
}
strValue.Add(")");
}
public static void PrintTo(double value, ViStringBuilder strValue)
{
strValue.Add(value);
}
public static void PrintTo(List<double> list, ViStringBuilder strValue)
{
strValue.Add("(");
for (int iter = 0; iter < list.Count; ++iter)
{
double value = list[iter];
strValue.Add(value);
strValue.Add(",");
}
strValue.Add(")");
}
public static void PrintTo(string value, ViStringBuilder strValue)
{
strValue.Add(value);
}
public static void PrintTo(List<string> list, ViStringBuilder strValue)
{
strValue.Add("(");
for (int iter = 0; iter < list.Count; ++iter)
{
string value = list[iter];
strValue.Add(value);
strValue.Add(",");
}
strValue.Add(")");
}
}