12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- namespace AtlasUtility
- {
- using UnityEditor;
- using UnityEngine;
- using System;
- using System.IO;
- using System.Linq;
- using System.Collections;
- using System.Collections.Generic;
- public class PlatformReferenceTable
- {
- #region Variable
- protected static string ReferenceTablePath
- {
- get { return AssetDatabase.GetAssetPath(InstanceManager.SearchInstance<AtlasUtility>().PlatformReferenceTable); }
- }
- #endregion
- public static List<PlatformReferenceSet> ReadAllLine()
- {
- StreamReader streamReader = new StreamReader(ReferenceTablePath);
- string referenceTable = streamReader.ReadToEnd().Trim();
- streamReader.Close();
- if (referenceTable == "")
- {
- return new List<PlatformReferenceSet>();
- }
- else
- {
- List<PlatformReferenceSet> list = new List<PlatformReferenceSet>();
- foreach (var content in referenceTable.Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).ToList())
- {
- list.Add(new PlatformReferenceSet(content));
- }
- return list;
- }
- }
- public static void WriteAllLine(List<PlatformReferenceSet> referenceSetList, bool append = false)
- {
- List<string> lineList = new List<string>();
- foreach (var referencePair in referenceSetList)
- {
- lineList.Add(referencePair.Content);
- }
- WriteAllLine(lineList, append);
- }
- public static void WriteAllLine(List<string> lineList, bool append = false)
- {
- StreamWriter streamWriter = new StreamWriter(ReferenceTablePath, append);
- for (int i = 0; i < lineList.Count; i++)
- {
- streamWriter.WriteLine(lineList[i]);
- }
- streamWriter.Close();
- }
- }
- }
|