// Token: 0x06000127 RID: 295 RVA: 0x00009D74 File Offset: 0x00007F74 public void Write(bool writeAlways) { if (!writeAlways && !this._isDirty) { return; } if (FileUtil2.Exists(this._cachePath)) { if (FileUtil2.IsReadOnly(this._cachePath)) { this.ShowCacheFileReadOnlyMessage(true); } if (FileUtil2.IsReadOnly(this._cachePath)) { return; } } using (MemoryStream memoryStream = new MemoryStream(1048576)) { using (BinaryWriter binaryWriter = new BinaryWriter(memoryStream)) { binaryWriter.Write(322416638u); binaryWriter.Write(this._fileVersion); List <T> list = new List <T>(this._lut.Values); binaryWriter.Write(list.Count); BinarySerializer data = new BinarySerializer(binaryWriter); foreach (T t in list) { t.Serialize(data); } } File.WriteAllBytes(this._cachePath, memoryStream.ToArray()); this._isDirty = false; } }
// Token: 0x06000124 RID: 292 RVA: 0x00009B30 File Offset: 0x00007D30 public void Read() { this._isDirty = false; this._lut = new Dictionary <string, T>(); try { if (FileUtil2.Exists(this._cachePath)) { if (FileUtil2.IsReadOnly(this._cachePath)) { this.ShowCacheFileReadOnlyMessage(false); } using (MemoryStream memoryStream = new MemoryStream(File.ReadAllBytes(this._cachePath))) { using (BinaryReader binaryReader = new BinaryReader(memoryStream)) { uint num = binaryReader.ReadUInt32(); if (num != 322416638u) { Debug.Log(string.Format("{0}: Cache file '{1}' contains an invalid header magic.", this._appTitle, this._cachePath)); } else { int num2 = binaryReader.ReadInt32(); if ((long)num2 != (long)((ulong)this._fileVersion)) { Debug.Log(string.Format("{0}: Incompatible cache file detected, generating new one. ('{1}').\nThe most likely reason is you upgraded the plugin to a newer version. Existing cache file version is '{2}', required version is '{3}'.", new object[] { this._appTitle, this._cachePath, num2, this._fileVersion })); } else { BinarySerializer data = new BinarySerializer(binaryReader); int num3 = binaryReader.ReadInt32(); for (int i = 0; i < num3; i++) { T value = (default(T) == null) ? Activator.CreateInstance <T>() : default(T); value.Serialize(data); string assetGuid = value.GetAssetGuid(); this._lut[assetGuid] = value; } } } } } } } catch (Exception ex) { Debug.LogError(string.Format("{0}: Could not read cache file '{1}'.\n{2}", this._appTitle, this._cachePath, ex.ToString())); } }
// Token: 0x06000184 RID: 388 RVA: 0x0000B764 File Offset: 0x00009964 public static bool IsReadOnly(string assetPath) { if (!FileUtil2.Exists(assetPath)) { return(false); } FileInfo fileInfo = new FileInfo(assetPath); return(fileInfo.IsReadOnly); }
// Token: 0x060001A8 RID: 424 RVA: 0x0000C810 File Offset: 0x0000AA10 protected override void OnItemContextMenu(GUIListViewContextMenuArgs args) { base.OnItemContextMenu(args); if (base.SelectedItemsCount < 1) { return; } FindAssetUsage.AssetProxy assetProxy = args.Model as FindAssetUsage.AssetProxy; bool flag = FileUtil2.Exists(assetProxy.AssetPath); GenericMenu genericMenu = new GenericMenu(); genericMenu.AddItem(new GUIContent((Application.platform == null) ? "Reveal in Finder" : "Show in Explorer"), false, flag ? new GenericMenu.MenuFunction(this.OnContextMenuShowInExplorer) : null); genericMenu.AddItem(new GUIContent("Open %enter"), false, FileUtil2.Exists(assetProxy.AssetPath) ? new GenericMenu.MenuFunction(this.OnContextMenuOpenWithDefaultApp) : null); genericMenu.AddItem(new GUIContent(string.Empty), false, null); genericMenu.AddItem(new GUIContent("Select in Project _enter"), false, flag ? new GenericMenu.MenuFunction(this.OnContextMenuSelect) : null); genericMenu.AddItem(new GUIContent("Find References in Scene"), false, (base.SelectedItemsCount == 1) ? new GenericMenu.MenuFunction(this.OnContextMenuFindReferencesInScene) : null); genericMenu.AddItem(new GUIContent(string.Empty), false, null); genericMenu.AddItem(new GUIContent("Copy Full Path"), false, flag ? new GenericMenu.MenuFunction(this.OnContextMenuCopyFullPath) : null); genericMenu.DropDown(new Rect(args.MenuLocation.x, args.MenuLocation.y, 0f, 0f)); Event.current.Use(); base.Editor.Repaint(); }