//把manifest文件信息保存在本地 public static void SaveManifest2Local(ManifestInfo manifestInfo) { try { string path = GetLocalManifestPath(); string dir = ResUtil.GetDirectoryByPath(path); if (!System.IO.Directory.Exists(dir)) { System.IO.Directory.CreateDirectory(dir); } System.IO.File.WriteAllBytes(path, GetBytesFromManifest(manifestInfo)); } catch (Exception e) { Debugger.LogError("SaveManifest2Local:" + e); } finally { } }
public static void Save2LocalFullPath(string path, byte[] bytes) { try { string dir = ResUtil.GetDirectoryByPath(path); if (!System.IO.Directory.Exists(dir)) { System.IO.Directory.CreateDirectory(dir); } System.IO.FileStream fs = System.IO.File.Open(path, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite, System.IO.FileShare.ReadWrite); fs.SetLength(0); if (bytes != null) { fs.Write(bytes, 0, bytes.Length); } fs.Close(); fs.Dispose(); Debugger.Log("Save2Local:{0}", path); } catch (Exception e) { Debugger.LogError("Save2Local:{0} error {1}!", path, e.ToString()); } }