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>
 /// 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));
 }