Beispiel #1
0
        /// <summary>
        /// Get the <see cref="NetFieldExportGroup"/> by the Actor guid.
        /// </summary>
        /// <param name="netguid"></param>
        /// <returns><see cref="NetFieldExportGroup"/></returns>
        public NetFieldExportGroup GetNetFieldExportGroup(uint netguid)
        {
            if (!_archTypeToExportGroup.TryGetValue(netguid, out var group))
            {
                if (!NetGuidToPathName.TryGetValue(netguid, out var path))
                {
                    return(null);
                }

                if (NetFieldExportGroupMapPathFixed.TryGetValue(netguid, out group))
                {
                    _archTypeToExportGroup[netguid] = NetFieldExportGroupMapPathFixed[netguid];
                    return(group);
                }

                foreach (var groupPathKvp in NetFieldExportGroupMap)
                {
                    var groupPath = groupPathKvp.Key;

                    if (!_cleanedPaths.TryGetValue(groupPathKvp.Value.PathNameIndex, out var groupPathFixed))
                    {
                        groupPathFixed = groupPath.RemoveAllPathPrefixes();
                        _cleanedPaths[groupPathKvp.Value.PathNameIndex] = groupPathFixed;
                    }

                    if (path.Contains(groupPathFixed, StringComparison.Ordinal))
                    {
                        NetFieldExportGroupMapPathFixed[netguid] = NetFieldExportGroupMap[groupPath];
                        _archTypeToExportGroup[netguid]          = NetFieldExportGroupMap[groupPath];

                        return(NetFieldExportGroupMap[groupPath]);
                    }
                }

                var cleanedPath = path.CleanPathSuffix();
                foreach (var groupPathKvp in NetFieldExportGroupMap)
                {
                    var groupPath = groupPathKvp.Key;

                    if (_cleanedPaths.TryGetValue(groupPathKvp.Value.PathNameIndex, out var groupPathFixed))
                    {
                        if (groupPathFixed.Contains(cleanedPath, StringComparison.Ordinal))
                        {
                            NetFieldExportGroupMapPathFixed[netguid] = NetFieldExportGroupMap[groupPath];
                            _archTypeToExportGroup[netguid]          = NetFieldExportGroupMap[groupPath];

                            return(NetFieldExportGroupMap[groupPath]);
                        }
                    }
                }

                return(null);
            }

            return(group);
        }
Beispiel #2
0
        /// <summary>
        /// Empty the NetGuidCache
        /// </summary>
        public void Cleanup()
        {
            NetFieldExportGroupIndexToGroup.Clear();
            NetFieldExportGroupMap.Clear();
            NetGuidToPathName.Clear();
            ObjectLookup.Clear();
            NetFieldExportGroupMapPathFixed.Clear();

            _archTypeToExportGroup.Clear();
            _cleanedPaths.Clear();
            _cleanedClassNetCache.Clear();
        }
Beispiel #3
0
        /// <summary>
        /// Empty the NetGuidCache
        /// </summary>
        public void Cleanup()
        {
            NetFieldExportGroupIndexToGroup.Clear();
            NetFieldExportGroupMap.Clear();
            NetGuidToPathName.Clear();
            //ObjectLookup.Clear();
            NetFieldExportGroupMapPathFixed.Clear();
            _networkGameplayTagNodeIndex = null;

            _archTypeToExportGroup.Clear();
            _cleanedPaths.Clear();
            _cleanedClassNetCache.Clear();
            _failedPaths.Clear();
        }
        public void ClearCache()
        {
            NetFieldExportGroupMap.Clear();
            NetFieldExportGroupIndexToGroup.Clear();
            NetGuidToPathName.Clear();
            NetFieldExportGroupMapPathFixed.Clear();
            NetworkGameplayTagNodeIndex = null;

            _archTypeToExportGroup.Clear();
            _cleanedClassNetCache.Clear();
            _partialPathNames.Clear();
            _cleanedPaths.Clear();
            _failedPaths.Clear();
            _pathToExportGroup.Clear();
        }
Beispiel #5
0
 /// <summary>
 /// Tries to resolve the netguid using the <see cref="NetGuidToPathName"/>
 /// </summary>
 /// <param name="netguid"></param>
 /// <param name="pathName"></param>
 /// <returns>true if netguid was resolved, false otherwise</returns>
 public bool TryGetPathName(uint netguid, out string pathName)
 {
     return(NetGuidToPathName.TryGetValue(netguid, out pathName));
 }
        public NetFieldExportGroup GetNetFieldExportGroup(uint guid)
        {
            if (!_archTypeToExportGroup.ContainsKey(guid))
            {
                if (!NetGuidToPathName.ContainsKey(guid))
                {
                    return(null);
                }

                var path = NetGuidToPathName[guid];

                //Don't need to recheck. Some export groups are added later though
                if (_failedPaths.Contains(path))
                {
                    return(null);
                }

                path = CoreRedirects.GetRedirect(path);

                if (_partialPathNames.TryGetValue(path, out string redirectPath))
                {
                    path = redirectPath;
                }

                if (NetFieldExportGroupMapPathFixed.TryGetValue(guid, out var exportGroup) || _pathToExportGroup.TryGetValue(path, out exportGroup))
                {
                    _archTypeToExportGroup[guid] = exportGroup;

                    return(exportGroup);
                }

                foreach (var groupPathKvp in NetFieldExportGroupMap)
                {
                    var groupPath = groupPathKvp.Key;

                    if (groupPathKvp.Value.CleanedPath == null)
                    {
                        groupPathKvp.Value.CleanedPath = RemoveAllPathPrefixes(groupPath);
                    }

                    if (path.Contains(groupPathKvp.Value.CleanedPath))
                    {
                        NetFieldExportGroupMapPathFixed[guid] = groupPathKvp.Value;
                        _archTypeToExportGroup[guid]          = groupPathKvp.Value;
                        _pathToExportGroup[path] = groupPathKvp.Value;

                        return(groupPathKvp.Value);
                    }
                }

                //Try fixing ...

                var cleanedPath = CleanPathSuffix(path);

                foreach (var groupPathKvp in NetFieldExportGroupMap)
                {
                    if (groupPathKvp.Value.CleanedPath.Contains(cleanedPath))
                    {
                        NetFieldExportGroupMapPathFixed[guid] = groupPathKvp.Value;
                        _archTypeToExportGroup[guid]          = groupPathKvp.Value;
                        _pathToExportGroup[path] = groupPathKvp.Value;

                        return(groupPathKvp.Value);
                    }
                }

                _failedPaths.Add(path);

                return(null);
            }
            else
            {
                return(_archTypeToExportGroup[guid]);
            }
        }