Buffer.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4. using System.IO;
  5. using System.Runtime.CompilerServices;
  6. using System.Text;
  7. using Newtonsoft.Json;
  8. using UnityEngine;
  9. namespace Unity.Services.Analytics.Internal
  10. {
  11. interface IBuffer
  12. {
  13. string UserID { get; set; }
  14. string InstallID { get; set; }
  15. string PlayerID { get; set; }
  16. string SessionID { get; set; }
  17. string Serialize(List<Buffer.Token> tokens);
  18. void InsertTokens(List<Buffer.Token> tokens);
  19. void PushStartEvent(string name, DateTime datetime, Int64? eventVersion, bool addPlayerIdsToEventBody = false);
  20. void PushEndEvent();
  21. void PushObjectStart(string name = null);
  22. void PushObjectEnd();
  23. void PushArrayStart(string name = null);
  24. void PushArrayEnd();
  25. void PushDouble(double val, string name = null);
  26. void PushFloat(float val, string name = null);
  27. void PushString(string val, string name = null);
  28. void PushInt64(Int64 val, string name = null);
  29. void PushInt(int val, string name = null);
  30. void PushBool(bool val, string name = null);
  31. void PushTimestamp(DateTime val, string name = null);
  32. void FlushToDisk();
  33. void ClearDiskCache();
  34. void ClearBuffer();
  35. void LoadFromDisk();
  36. void PushEvent(Event evt);
  37. List<Buffer.Token> CloneTokens();
  38. }
  39. /// <summary>
  40. /// Captures the data as tokens so that can be used to build up the JSON
  41. /// Later. We do this so as not to serialize inside other peoples functions
  42. /// but also because we might not have all the info we need to serialize at
  43. /// that point in time.
  44. /// This is _NOT_ a thread safe buffer, its the job of the calling code to
  45. /// handle that.
  46. /// </summary>
  47. class Buffer : IBuffer
  48. {
  49. public string UserID { get; set; }
  50. public string SessionID { get; set; }
  51. public string PlayerID { get; set; }
  52. public string InstallID { get; set; }
  53. // With the exception of EventStart, EventEnd, these tokens map to the
  54. // DDNA JSON Schema. The full schema at the time of writing is. OBJECT,
  55. // ARRAY, STRING, INTEGER, BOOLEAN, TIMESTAMP, EVENT_TIMESTAMP, FLOAT.
  56. internal enum TokenType
  57. {
  58. EventStart,
  59. EventEnd,
  60. EventParamsStart,
  61. EventParamsEnd,
  62. EventObjectStart, // Maps to OBJECT
  63. EventObjectEnd, // Maps to OBJECT
  64. EventArrayStart, // Maps to ARRAY
  65. EventArrayEnd, // Maps to ARRAY
  66. Boolean, // Maps to BOOLEAN
  67. Float64, // Maps to FLOAT
  68. String, // Maps to STRING
  69. Int64, // Maps to INTEGER
  70. Timestamp, // Maps to TIMESTAMP
  71. EventTimestamp, // Maps to EVENT_TIMESTAMP
  72. StandardEventIds,
  73. }
  74. // The event information is broken into name, type, and data. The name
  75. // usually ends up being the key in the JSON and the type and data are
  76. // for serialization.
  77. internal struct Token
  78. {
  79. public string Name;
  80. public TokenType Type;
  81. // NOTE: A union was tried and did show some minor speed increase
  82. // but it seemed to trigger a bug in the mono runtime, the volume of
  83. // data running through this should be low enough not to notice
  84. // anything. using 'object' doesn't trigger the issue.
  85. public object Data;
  86. }
  87. readonly List<Token> m_Tokens = new List<Token>();
  88. readonly string m_CacheFilePath = CanUseDiskPersistence() ? $"{Application.persistentDataPath}/eventcache" : "";
  89. readonly long m_CacheFileMaximumSize = 1024 * 1024 * 5; // 5MB
  90. const string k_NoBufferSupportMessage = "Unity Analytics cache is not supported on this platform, data will not be locally persisted.";
  91. int m_DiskCacheLastFlushedToken;
  92. long m_DiskCacheSize;
  93. public Buffer()
  94. {
  95. LoadFromDisk();
  96. ClearDiskCache();
  97. }
  98. public List<Token> CloneTokens()
  99. {
  100. var tokens = new List<Token>(m_Tokens);
  101. m_Tokens.Clear();
  102. return tokens;
  103. }
  104. public void InsertTokens(List<Token> tokens)
  105. {
  106. m_Tokens.AddRange(tokens);
  107. }
  108. // LOSDK-165 need to be mindful of 5MB limit in future.
  109. // LOSDK-166 need to honor the enabled list.
  110. // LOSDK-174 generate the data better.
  111. /// <summary>
  112. /// If the DataBuffer knows about the UserID and the Session ID calling this function
  113. /// will return a JSON blob of all the data in the buffer, it will then clear the
  114. /// internal data.
  115. /// </summary>
  116. /// <returns>String of JSON or Null</returns>
  117. public string Serialize(List<Token> tokens)
  118. {
  119. #if UNITY_ANALYTICS_DEVELOPMENT
  120. Debug.Assert(!string.IsNullOrEmpty(UserID));
  121. Debug.Assert(!string.IsNullOrEmpty(SessionID));
  122. #endif
  123. if (tokens.Count == 0)
  124. {
  125. return null;
  126. }
  127. var data = new StringBuilder();
  128. // The JSON output has not been tested with DDNA yet, we the ability
  129. // to actually send the info to the backend next.
  130. data.Append("{\"eventList\":[");
  131. foreach (var t in tokens)
  132. {
  133. switch (t.Type)
  134. {
  135. case TokenType.EventStart:
  136. {
  137. data.Append("{");
  138. data.Append("\"eventName\":\"");
  139. data.Append(t.Name);
  140. data.Append("\",");
  141. data.Append("\"userID\":\"");
  142. data.Append(UserID);
  143. data.Append("\",");
  144. data.Append("\"sessionID\":\"");
  145. data.Append(SessionID);
  146. data.Append("\",");
  147. data.Append("\"eventUUID\":\"");
  148. data.Append(Guid.NewGuid().ToString());
  149. data.Append("\",");
  150. #if UNITY_ANALYTICS_EVENT_LOGS
  151. Debug.LogFormat("Serializing event {0} for dispatch...", t.Name);
  152. #endif
  153. // Session ID and UserID are also needed here.
  154. break;
  155. }
  156. case TokenType.EventEnd:
  157. {
  158. // object
  159. data.Append("},");
  160. break;
  161. }
  162. case TokenType.EventObjectEnd:
  163. {
  164. if (data[data.Length - 1] == ',')
  165. {
  166. data.Remove(data.Length - 1, 1);
  167. }
  168. data.Append("},");
  169. break;
  170. }
  171. case TokenType.EventArrayEnd:
  172. {
  173. if (data[data.Length - 1] == ',')
  174. {
  175. data.Remove(data.Length - 1, 1);
  176. }
  177. data.Append("],");
  178. break;
  179. }
  180. case TokenType.EventParamsStart:
  181. {
  182. data.Append("\"eventParams\":{");
  183. break;
  184. }
  185. case TokenType.EventParamsEnd:
  186. {
  187. if (data[data.Length - 1] == ',')
  188. {
  189. data.Remove(data.Length - 1, 1);
  190. }
  191. // event params
  192. data.Append("}");
  193. break;
  194. }
  195. case TokenType.Float64:
  196. {
  197. if (null != t.Name)
  198. {
  199. data.Append("\"");
  200. data.Append(t.Name);
  201. data.Append("\":");
  202. }
  203. data.AppendFormat(CultureInfo.InvariantCulture, "{0}", (double)t.Data);
  204. data.Append(",");
  205. break;
  206. }
  207. case TokenType.Boolean:
  208. {
  209. if (null != t.Name)
  210. {
  211. data.Append("\"");
  212. data.Append(t.Name);
  213. data.Append("\":");
  214. }
  215. data.Append((bool)t.Data ? "true" : "false");
  216. data.Append(",");
  217. break;
  218. }
  219. case TokenType.Int64:
  220. {
  221. if (null != t.Name)
  222. {
  223. data.Append("\"");
  224. data.Append(t.Name);
  225. data.Append("\":");
  226. }
  227. data.Append((Int64)t.Data);
  228. data.Append(",");
  229. break;
  230. }
  231. case TokenType.String:
  232. {
  233. if (null != t.Name)
  234. {
  235. data.Append("\"");
  236. data.Append(t.Name);
  237. data.Append("\":");
  238. }
  239. data.Append(JsonConvert.ToString((string)t.Data));
  240. data.Append(",");
  241. break;
  242. }
  243. case TokenType.Timestamp:
  244. {
  245. data.Append("\"");
  246. data.Append(t.Name);
  247. data.Append("\":\"");
  248. data.Append(SaveDateTime((DateTime)t.Data));
  249. data.Append("\",");
  250. break;
  251. }
  252. case TokenType.EventTimestamp:
  253. {
  254. data.Append("\"eventTimestamp\":\"");
  255. data.Append(SaveDateTime((DateTime)t.Data));
  256. data.Append("\",");
  257. break;
  258. }
  259. case TokenType.EventObjectStart:
  260. {
  261. if (null != t.Name)
  262. {
  263. data.Append("\"");
  264. data.Append(t.Name);
  265. data.Append("\":");
  266. }
  267. data.Append("{");
  268. break;
  269. }
  270. case TokenType.EventArrayStart:
  271. {
  272. data.Append("\"");
  273. data.Append(t.Name);
  274. data.Append("\":");
  275. data.Append("[");
  276. break;
  277. }
  278. case TokenType.StandardEventIds:
  279. {
  280. data.Append("\"unityInstallationID\":\"");
  281. data.Append(InstallID);
  282. data.Append("\",");
  283. if (!string.IsNullOrEmpty(PlayerID))
  284. {
  285. data.Append("\"unityPlayerID\":\"");
  286. data.Append(PlayerID);
  287. data.Append("\",");
  288. }
  289. break;
  290. }
  291. }
  292. if (t.Type == TokenType.EventEnd && IsRequestOverSizeLimit(data.ToString()))
  293. {
  294. break;
  295. }
  296. }
  297. // JSON doesn't like trailing ',' so we remove the last one.
  298. if (data[data.Length - 1] == ',')
  299. {
  300. data.Remove(data.Length - 1, 1);
  301. }
  302. data.Append("]}");
  303. return data.ToString();
  304. }
  305. public static string SaveDateTime(DateTime dateTime)
  306. {
  307. return dateTime.ToString("yyyy-MM-dd HH:mm:ss zzz", CultureInfo.InvariantCulture);
  308. }
  309. static DateTime ParseDateTime(string dateTime)
  310. {
  311. return DateTime.ParseExact(dateTime, "yyyy-MM-dd HH:mm:ss zzz", CultureInfo.InvariantCulture);
  312. }
  313. bool IsRequestOverSizeLimit(string data)
  314. {
  315. var byteCount = Encoding.Unicode.GetByteCount(data);
  316. var byteLimit = 4194304;
  317. return byteCount >= byteLimit;
  318. }
  319. public void PushStartEvent(string name, DateTime datetime, Int64? eventVersion, bool addPlayerIdsToEventBody = false)
  320. {
  321. #if UNITY_ANALYTICS_EVENT_LOGS
  322. Debug.LogFormat("Recorded event {0} at {1} (UTC)", name, SaveDateTime(datetime));
  323. #endif
  324. m_Tokens.Add(new Token
  325. {
  326. Name = name,
  327. Type = TokenType.EventStart,
  328. Data = null
  329. });
  330. m_Tokens.Add(new Token
  331. {
  332. Name = name,
  333. Type = TokenType.EventTimestamp,
  334. Data = datetime
  335. });
  336. if (eventVersion != null)
  337. {
  338. m_Tokens.Add(new Token
  339. {
  340. Name = "eventVersion",
  341. Type = TokenType.Int64,
  342. Data = eventVersion
  343. });
  344. }
  345. if (addPlayerIdsToEventBody)
  346. {
  347. m_Tokens.Add(new Token
  348. {
  349. Name = null,
  350. Type = TokenType.StandardEventIds,
  351. Data = null
  352. });
  353. }
  354. m_Tokens.Add(new Token
  355. {
  356. Name = null,
  357. Type = TokenType.EventParamsStart,
  358. Data = null
  359. });
  360. }
  361. public void PushEndEvent()
  362. {
  363. m_Tokens.Add(new Token
  364. {
  365. Name = null,
  366. Type = TokenType.EventParamsEnd,
  367. Data = null
  368. });
  369. m_Tokens.Add(new Token
  370. {
  371. Name = null,
  372. Type = TokenType.EventEnd,
  373. Data = null
  374. });
  375. }
  376. public void PushObjectStart(string name = null)
  377. {
  378. m_Tokens.Add(new Token
  379. {
  380. Name = name,
  381. Type = TokenType.EventObjectStart,
  382. Data = null
  383. });
  384. }
  385. public void PushObjectEnd()
  386. {
  387. m_Tokens.Add(new Token
  388. {
  389. Name = null,
  390. Type = TokenType.EventObjectEnd,
  391. Data = null
  392. });
  393. }
  394. public void PushArrayStart(string name = null)
  395. {
  396. m_Tokens.Add(new Token
  397. {
  398. Name = name,
  399. Type = TokenType.EventArrayStart,
  400. Data = null
  401. });
  402. }
  403. public void PushArrayEnd()
  404. {
  405. m_Tokens.Add(new Token
  406. {
  407. Name = null,
  408. Type = TokenType.EventArrayEnd,
  409. Data = null
  410. });
  411. }
  412. public void PushDouble(double val, string name = null)
  413. {
  414. m_Tokens.Add(new Token
  415. {
  416. Name = name,
  417. Type = TokenType.Float64,
  418. Data = val
  419. });
  420. }
  421. public void PushFloat(float val, string name = null)
  422. {
  423. PushDouble(val, name);
  424. }
  425. public void PushString(string val, string name = null)
  426. {
  427. #if UNITY_ANALYTICS_DEVELOPMENT
  428. Debug.AssertFormat(!string.IsNullOrEmpty(val), "Required to have a value");
  429. #endif
  430. m_Tokens.Add(new Token
  431. {
  432. Name = name,
  433. Type = TokenType.String,
  434. Data = val
  435. });
  436. }
  437. public void PushInt64(Int64 val, string name = null)
  438. {
  439. m_Tokens.Add(new Token
  440. {
  441. Name = name,
  442. Type = TokenType.Int64,
  443. Data = val
  444. });
  445. }
  446. public void PushInt(int val, string name = null)
  447. {
  448. PushInt64(val, name);
  449. }
  450. public void PushBool(bool val, string name = null)
  451. {
  452. m_Tokens.Add(new Token
  453. {
  454. Name = name,
  455. Type = TokenType.Boolean,
  456. Data = val
  457. });
  458. }
  459. public void PushTimestamp(DateTime val, string name)
  460. {
  461. m_Tokens.Add(new Token
  462. {
  463. Name = name,
  464. Type = TokenType.Timestamp,
  465. Data = val
  466. });
  467. }
  468. public void FlushToDisk()
  469. {
  470. if (!CanUseDiskPersistence())
  471. {
  472. Debug.Log(k_NoBufferSupportMessage);
  473. return;
  474. }
  475. if (m_DiskCacheSize > m_CacheFileMaximumSize)
  476. {
  477. // Cache is full, do not keep spaffing into it.
  478. return;
  479. }
  480. using (var stream = File.Open(m_CacheFilePath, FileMode.OpenOrCreate))
  481. {
  482. using (var writer = new BinaryWriter(stream, Encoding.UTF8))
  483. {
  484. writer.Seek(0, SeekOrigin.End);
  485. for (var i = m_DiskCacheLastFlushedToken; i < m_Tokens.Count; i++)
  486. {
  487. WriteToken(writer, m_Tokens[i]);
  488. m_DiskCacheLastFlushedToken++;
  489. }
  490. m_DiskCacheSize = stream.Length;
  491. Debug.Log($"Flushed up to token index {m_DiskCacheLastFlushedToken}, cache file is {m_DiskCacheSize}B");
  492. }
  493. }
  494. }
  495. public void ClearDiskCache()
  496. {
  497. if (!CanUseDiskPersistence())
  498. {
  499. Debug.Log(k_NoBufferSupportMessage);
  500. return;
  501. }
  502. m_DiskCacheLastFlushedToken = 0;
  503. if (File.Exists(m_CacheFilePath))
  504. {
  505. File.Delete(m_CacheFilePath);
  506. }
  507. }
  508. public void ClearBuffer()
  509. {
  510. m_Tokens.Clear();
  511. ClearDiskCache();
  512. }
  513. public void LoadFromDisk()
  514. {
  515. if (!CanUseDiskPersistence())
  516. {
  517. Debug.Log(k_NoBufferSupportMessage);
  518. return;
  519. }
  520. m_Tokens.Clear();
  521. if (File.Exists(m_CacheFilePath))
  522. {
  523. try
  524. {
  525. var incomingEvents = new List<Token>();
  526. using (var stream = File.Open(m_CacheFilePath, FileMode.Open))
  527. {
  528. using (var reader = new BinaryReader(stream, Encoding.UTF8))
  529. {
  530. var length = stream.Length;
  531. while (stream.Position != length)
  532. {
  533. incomingEvents.Add(ReadToken(reader));
  534. }
  535. m_Tokens.AddRange(incomingEvents);
  536. m_DiskCacheSize = length;
  537. m_DiskCacheLastFlushedToken = m_Tokens.Count - 1;
  538. }
  539. }
  540. }
  541. catch (Exception e)
  542. {
  543. Debug.LogWarning($"Error loading cached events: file was corrupt (probably due to improper app/system shutdown). Cached events have been discarded and other operations will continue as normal. Error was {e.Message}");
  544. m_DiskCacheSize = 0;
  545. m_DiskCacheLastFlushedToken = 0;
  546. }
  547. }
  548. }
  549. void WriteToken(BinaryWriter writer, Token token)
  550. {
  551. writer.Write((int)token.Type);
  552. var hasName = null != token.Name;
  553. writer.Write(hasName);
  554. if (hasName)
  555. {
  556. writer.Write(token.Name);
  557. }
  558. switch (token.Type)
  559. {
  560. case TokenType.Boolean:
  561. writer.Write((bool)token.Data);
  562. break;
  563. case TokenType.Int64:
  564. writer.Write((long)token.Data);
  565. break;
  566. case TokenType.Float64:
  567. writer.Write((double)token.Data);
  568. break;
  569. case TokenType.String:
  570. writer.Write((string)token.Data);
  571. break;
  572. case TokenType.Timestamp:
  573. case TokenType.EventTimestamp:
  574. writer.Write(SaveDateTime((DateTime)token.Data));
  575. break;
  576. }
  577. }
  578. Token ReadToken(BinaryReader reader)
  579. {
  580. var token = new Token
  581. {
  582. Type = (TokenType)reader.ReadInt32()
  583. };
  584. var hasName = reader.ReadBoolean();
  585. if (hasName)
  586. {
  587. token.Name = reader.ReadString();
  588. }
  589. switch (token.Type)
  590. {
  591. case TokenType.Boolean:
  592. token.Data = reader.ReadBoolean();
  593. break;
  594. case TokenType.Int64:
  595. token.Data = reader.ReadInt64();
  596. break;
  597. case TokenType.Float64:
  598. token.Data = reader.ReadDouble();
  599. break;
  600. case TokenType.String:
  601. token.Data = reader.ReadString();
  602. break;
  603. case TokenType.Timestamp:
  604. case TokenType.EventTimestamp:
  605. token.Data = ParseDateTime(reader.ReadString());
  606. break;
  607. }
  608. return token;
  609. }
  610. public void PushEvent(Event evt)
  611. {
  612. // Serialize event
  613. var dateTime = DateTime.Now;
  614. PushStartEvent(evt.Name, dateTime, evt.Version);
  615. // Serialize event params
  616. var eData = evt.Parameters;
  617. foreach (var data in eData.Data)
  618. {
  619. if (data.Value is float f32Val)
  620. {
  621. PushFloat(f32Val, data.Key);
  622. }
  623. else if (data.Value is double f64Val)
  624. {
  625. PushDouble(f64Val, data.Key);
  626. }
  627. else if (data.Value is string strVal)
  628. {
  629. PushString(strVal, data.Key);
  630. }
  631. else if (data.Value is int intVal)
  632. {
  633. PushInt(intVal, data.Key);
  634. }
  635. else if (data.Value is Int64 int64Val)
  636. {
  637. PushInt64(int64Val, data.Key);
  638. }
  639. else if (data.Value is bool boolVal)
  640. {
  641. PushBool(boolVal, data.Key);
  642. }
  643. }
  644. PushEndEvent();
  645. }
  646. static bool CanUseDiskPersistence()
  647. {
  648. // Switch requires a specific setup to have write access to the disc so it won't be handled here.
  649. return
  650. Application.platform != RuntimePlatform.Switch &&
  651. #if !UNITY_2021_1_OR_NEWER
  652. Application.platform != RuntimePlatform.XboxOne &&
  653. #endif
  654. Application.platform != RuntimePlatform.GameCoreXboxOne &&
  655. Application.platform != RuntimePlatform.GameCoreXboxSeries
  656. && !string.IsNullOrEmpty(Application.persistentDataPath);
  657. }
  658. }
  659. class BufferRevoked : IBuffer
  660. {
  661. public string UserID { get; set; }
  662. public string InstallID { get; set; }
  663. public string PlayerID { get; set; }
  664. public string SessionID { get; set; }
  665. public void ClearBuffer()
  666. {
  667. }
  668. public void ClearDiskCache()
  669. {
  670. }
  671. public List<Buffer.Token> CloneTokens()
  672. {
  673. return new List<Buffer.Token>();
  674. }
  675. public void InsertTokens(List<Buffer.Token> tokens)
  676. {
  677. }
  678. public void FlushToDisk()
  679. {
  680. }
  681. public void LoadFromDisk()
  682. {
  683. }
  684. public void PushArrayEnd()
  685. {
  686. }
  687. public void PushArrayStart(string name = null)
  688. {
  689. }
  690. public void PushBool(bool val, string name = null)
  691. {
  692. }
  693. public void PushDouble(double val, string name = null)
  694. {
  695. }
  696. public void PushEndEvent()
  697. {
  698. }
  699. public void PushEvent(Event evt)
  700. {
  701. }
  702. public void PushFloat(float val, string name = null)
  703. {
  704. }
  705. public void PushInt(int val, string name = null)
  706. {
  707. }
  708. public void PushInt64(long val, string name = null)
  709. {
  710. }
  711. public void PushObjectEnd()
  712. {
  713. }
  714. public void PushObjectStart(string name = null)
  715. {
  716. }
  717. public void PushStartEvent(string name, DateTime datetime, long? eventVersion, bool addPlayerIdsToEventBody = false)
  718. {
  719. }
  720. public void PushString(string val, string name = null)
  721. {
  722. }
  723. public void PushTimestamp(DateTime val, string name = null)
  724. {
  725. }
  726. public string Serialize(List<Buffer.Token> tokens)
  727. {
  728. return String.Empty;
  729. }
  730. }
  731. }