Пример #1
0
            private bool TryParseReadWriteIndexOrFail()
            {
                // If the read-write index doesn't exist. Just keep 'ReadWriteIndex' empty as it is.
                if (!File.Exists(m_Owner.ReadWriteIndexPath))
                {
                    return(true);
                }

                try
                {
                    using (var stream = File.OpenRead(m_Owner.ReadWriteIndexPath))
                    {
                        using (var br = new BinaryReader(stream))
                        {
                            DeserializeAssetIndex(br, ReadWriteIndex);
                        }
                    }
                }
                catch (Exception e)
                {
                    InternalLog.Warning($"Cannot parse the index file with exception '{e}'. Will try to clean up read-write path.");
                    ReadWriteIndex.Clear();
                    return(!File.Exists(m_Owner.ReadWriteIndexPath) || m_Owner.TryCleanUpReadWritePathOrFail(Fail));
                }

                return(true);
            }