Exemple #1
0
 public static string ToString(bCProperty A, object val)
 {
     switch (A.PropertyType)
     {
         case "int":
         case "bool":
         case "short":
         case "float":
         case "long":
         case "char":
             return val.ToString();
         case "eCScriptProxyScript":
             return (val as eCScriptProxyScript).Object;
         case "eCEntityStringProxy":
             return (val as eCEntityStringProxy).Object;
     }
     if (A.PropertyType.EndsWith("String"))
     {
         return val.ToString();
     }
     else if (A.PropertyType.StartsWith("bTPropertyContainer"))
     {
         return val.ToString();
     }
     else throw new Exception();
 }
Exemple #2
0
 public TempHeader(IFile a_Stream)
 {
     Version = a_Stream.Read<short>();
     ID = new bCPropertyID(a_Stream);
     b0 = a_Stream.Read<byte>();
     b1 = a_Stream.Read<byte>();
     bObsolete1 = a_Stream.Read<byte>();
     if (Version < 215u)
         bValue1 = a_Stream.Read<byte>();
     bValue2 = a_Stream.Read<byte>();
     bValue3 = a_Stream.Read<byte>();
     bValue1 = a_Stream.Read<byte>();
     bValue4 = a_Stream.Read<byte>();
     if (Version >= 214u)
         bValue1 = a_Stream.Read<byte>();
     bHasRefTemplateID = a_Stream.Read<byte>();
     if (bHasRefTemplateID == 1)
         m_pRefTemplateID = new bCProperty(a_Stream);
     m_fRenderAlphaValue = a_Stream.Read<float>();
     m_fViewRange = a_Stream.Read<float>();
     enumInsertType = a_Stream.Read<short>();
     st0 = new bCString(a_Stream);
     v0 = a_Stream.Read<Vector3>();
     q0 = a_Stream.Read<Quaternion>();
     if (Version < 213u)
     {
         bValue1 = a_Stream.Read<byte>();
         bValue1 = a_Stream.Read<byte>();
     }
     if (Version < 212u)
         bValue1 = a_Stream.Read<byte>();
     if (Version < 213u)
         a_Stream.Read<float>();
     dt0 = new bCDateTime(a_Stream);
     if (Version < 213u)
         a_Stream.Read<byte>();
     if (Version < 217u)
         a_Stream.Read<float>();
     if (Version < 213u)
     {
         a_Stream.Read<byte>();
         bValue1 = a_Stream.Read<byte>();
     }
     bValue5 = a_Stream.Read<byte>();
     bValue6 = a_Stream.Read<byte>();
     bValue7 = a_Stream.Read<byte>();
     if (Version >= 211u)
         m_u8ScaleGridPercentage = a_Stream.Read<byte>();
     if (Version >= 218u)
         a_Stream.Read<byte>();
 }
Exemple #3
0
 public static object FromString(bCProperty A, string val)
 {
     Func<string, string> F0 = (x) => string.IsNullOrEmpty(x) ? "0" : x;
     Func<string, string> F1 = (x) => string.IsNullOrEmpty(x) ? "false" : x;
     switch (A.PropertyType)
     {
         case "int":
             return int.Parse(F0(val));
         case "bool":
             return bool.Parse(F1(val));
         case "short":
             return short.Parse(F0(val));
         case "float":
             return float.Parse(F0(val));
         case "long":
             return int.Parse(F0(val));
         case "char":
             return string.IsNullOrEmpty(val) ? (char)0 : char.Parse(val);
         case "eCScriptProxyScript":
             return new eCScriptProxyScript(val);
         case "eCEntityStringProxy":
             return new eCEntityStringProxy(val);
     }
     if (A.PropertyType.EndsWith("String"))
     {
         bCString a = (bCString)Activator.CreateInstance(System.Type.GetType(typeof(bCString).FullName.Replace("bCString", A.PropertyType)));
         a.pString = val;
         return a;
     }
     else if (A.PropertyType.StartsWith("bTPropertyContainer"))
     {
         object a = bCProperty.getObject(A.PropertyType, new TempStream(6, null), true);
         return val.Length > 0 ? Enum.Parse(a.GetType(), val) : a;
     }
     else throw new Exception();
 }