Exemple #1
0
        protected void LoadAllLists(ZipFile arc, Manifest manifest)
        {
            List <ZipEntry> BoneList = new List <ZipEntry>();

            foreach (ZipEntry entry in arc)
            {
                if (entry.Name.StartsWith("abdata/list/characustom", StringComparison.OrdinalIgnoreCase) && entry.Name.EndsWith(".csv", StringComparison.OrdinalIgnoreCase))
                {
                    try
                    {
                        var stream      = arc.GetInputStream(entry);
                        var chaListData = ListLoader.LoadCSV(stream);

                        SetPossessNew(chaListData);
                        UniversalAutoResolver.GenerateResolutionInfo(manifest, chaListData);
                        ListLoader.ExternalDataList.Add(chaListData);
                    }
                    catch (Exception ex)
                    {
                        Logger.Log(LogLevel.Error, $"[SIDELOADER] Failed to load list file \"{entry.Name}\" from archive \"{arc.Name}\" with error: {ex.Message}");
                        Logger.Log(LogLevel.Error, $"[SIDELOADER] Error details: {ex}");
                    }
                }
                if (entry.Name.StartsWith("abdata/studio/info", StringComparison.OrdinalIgnoreCase) && entry.Name.EndsWith(".csv", StringComparison.OrdinalIgnoreCase))
                {
                    if (Path.GetFileNameWithoutExtension(entry.Name).ToLower().StartsWith("itembonelist_"))
                    {
                        BoneList.Add(entry);
                    }
                    else
                    {
                        try
                        {
                            var stream         = arc.GetInputStream(entry);
                            var studioListData = ListLoader.LoadStudioCSV(stream, entry.Name);

                            UniversalAutoResolver.GenerateStudioResolutionInfo(manifest, studioListData);
                            ListLoader.ExternalStudioDataList.Add(studioListData);
                        }
                        catch (Exception ex)
                        {
                            Logger.Log(LogLevel.Error, $"[SIDELOADER] Failed to load list file \"{entry.Name}\" from archive \"{arc.Name}\" with error: {ex.Message}");
                            Logger.Log(LogLevel.Error, $"[SIDELOADER] Error details: {ex}");
                        }
                    }
                }
            }

            //ItemBoneList data must be resolved after the corresponding item so they can be resolved to the same ID
            foreach (ZipEntry entry in BoneList)
            {
                try
                {
                    var stream         = arc.GetInputStream(entry);
                    var studioListData = ListLoader.LoadStudioCSV(stream, entry.Name);

                    UniversalAutoResolver.GenerateStudioResolutionInfo(manifest, studioListData);
                    ListLoader.ExternalStudioDataList.Add(studioListData);
                }
                catch (Exception ex)
                {
                    Logger.Log(LogLevel.Error, $"[SIDELOADER] Failed to load list file \"{entry.Name}\" from archive \"{arc.Name}\" with error: {ex.Message}");
                    Logger.Log(LogLevel.Error, $"[SIDELOADER] Error details: {ex}");
                }
            }
        }
Exemple #2
0
        private void LoadAllLists(ZipFile arc, Manifest manifest)
        {
            List <ZipEntry> BoneList = new List <ZipEntry>();

            foreach (ZipEntry entry in arc)
            {
                if (entry.Name.StartsWith("abdata/list/characustom", StringComparison.OrdinalIgnoreCase) && entry.Name.EndsWith(".csv", StringComparison.OrdinalIgnoreCase))
                {
                    try
                    {
                        var stream      = arc.GetInputStream(entry);
                        var chaListData = Lists.LoadCSV(stream);

                        SetPossessNew(chaListData);
                        UniversalAutoResolver.GenerateResolutionInfo(manifest, chaListData, _gatheredResolutionInfos);
                        Lists.ExternalDataList.Add(chaListData);
                    }
                    catch (Exception ex)
                    {
                        Logger.LogError($"Failed to load list file \"{entry.Name}\" from archive \"{GetRelativeArchiveDir(arc.Name)}\" with error: {ex}");
                    }
                }
#if KK || AI || HS2
                else if (entry.Name.StartsWith("abdata/studio/info", StringComparison.OrdinalIgnoreCase) && entry.Name.EndsWith(".csv", StringComparison.OrdinalIgnoreCase))
                {
                    if (Path.GetFileNameWithoutExtension(entry.Name).ToLower().StartsWith("itembonelist_"))
                    {
                        BoneList.Add(entry);
                    }
                    else
                    {
                        try
                        {
                            var stream         = arc.GetInputStream(entry);
                            var studioListData = Lists.LoadStudioCSV(stream, entry.Name, manifest.GUID);

                            UniversalAutoResolver.GenerateStudioResolutionInfo(manifest, studioListData);
                            Lists.ExternalStudioDataList.Add(studioListData);
                        }
                        catch (Exception ex)
                        {
                            Logger.LogError($"Failed to load list file \"{entry.Name}\" from archive \"{GetRelativeArchiveDir(arc.Name)}\" with error: {ex}");
                        }
                    }
                }
#if AI || HS2
                else if (entry.Name.StartsWith("abdata/list/map/", StringComparison.OrdinalIgnoreCase) && entry.Name.EndsWith(".csv", StringComparison.OrdinalIgnoreCase))
                {
                    try
                    {
                        string assetBundleName = entry.Name;
                        assetBundleName  = assetBundleName.Remove(0, assetBundleName.IndexOf('/') + 1); //Remove "abdata/"
                        assetBundleName  = assetBundleName.Remove(assetBundleName.LastIndexOf('/'));    //Remove the .csv filename
                        assetBundleName += ".unity3d";

                        string assetName = entry.Name;
                        assetName = assetName.Remove(0, assetName.LastIndexOf('/') + 1); //Remove all but the filename
                        assetName = assetName.Remove(assetName.LastIndexOf('.'));        //Remove the .csv

                        var stream = arc.GetInputStream(entry);
                        Lists.LoadExcelDataCSV(assetBundleName, assetName, stream);
                    }
                    catch (Exception ex)
                    {
                        Logger.LogError($"Failed to load list file \"{entry.Name}\" from archive \"{GetRelativeArchiveDir(arc.Name)}\" with error: {ex}");
                    }
                }
#endif
#endif
            }

#if KK || AI || HS2
            //ItemBoneList data must be resolved after the corresponding item so they can be resolved to the same ID
            foreach (ZipEntry entry in BoneList)
            {
                try
                {
                    var stream         = arc.GetInputStream(entry);
                    var studioListData = Lists.LoadStudioCSV(stream, entry.Name, manifest.GUID);

                    UniversalAutoResolver.GenerateStudioResolutionInfo(manifest, studioListData);
                    Lists.ExternalStudioDataList.Add(studioListData);
                }
                catch (Exception ex)
                {
                    Logger.LogError($"Failed to load list file \"{entry.Name}\" from archive \"{GetRelativeArchiveDir(arc.Name)}\" with error: {ex}");
                }
            }
#endif
        }
Exemple #3
0
        private void LoadAllLists(ZipFile arc, Manifest manifest)
        {
            List <ZipEntry> BoneList = new List <ZipEntry>();

            foreach (ZipEntry entry in arc)
            {
                if (entry.Name.StartsWith("abdata/list/characustom", StringComparison.OrdinalIgnoreCase) && entry.Name.EndsWith(".csv", StringComparison.OrdinalIgnoreCase))
                {
                    try
                    {
                        var stream      = arc.GetInputStream(entry);
                        var chaListData = Lists.LoadCSV(stream);

                        SetPossessNew(chaListData);
                        UniversalAutoResolver.GenerateResolutionInfo(manifest, chaListData, _gatheredResolutionInfos);
                        Lists.ExternalDataList.Add(chaListData);
                    }
                    catch (Exception ex)
                    {
                        Logger.LogError($"Failed to load list file \"{entry.Name}\" from archive \"{GetRelativeArchiveDir(arc.Name)}\" with error: {ex}");
                    }
                }
#if KK || AI
                else if (entry.Name.StartsWith("abdata/studio/info", StringComparison.OrdinalIgnoreCase) && entry.Name.EndsWith(".csv", StringComparison.OrdinalIgnoreCase))
                {
                    if (Path.GetFileNameWithoutExtension(entry.Name).ToLower().StartsWith("itembonelist_"))
                    {
                        BoneList.Add(entry);
                    }
                    else
                    {
                        try
                        {
                            var stream         = arc.GetInputStream(entry);
                            var studioListData = Lists.LoadStudioCSV(stream, entry.Name);

                            UniversalAutoResolver.GenerateStudioResolutionInfo(manifest, studioListData);
                            Lists.ExternalStudioDataList.Add(studioListData);
                        }
                        catch (Exception ex)
                        {
                            Logger.LogError($"Failed to load list file \"{entry.Name}\" from archive \"{GetRelativeArchiveDir(arc.Name)}\" with error: {ex}");
                        }
                    }
                }
#if KK
                else if (entry.Name.StartsWith("abdata/map/list/mapinfo/", StringComparison.OrdinalIgnoreCase) && entry.Name.EndsWith(".csv", StringComparison.OrdinalIgnoreCase))
                {
                    try
                    {
                        var     stream      = arc.GetInputStream(entry);
                        MapInfo mapListData = Lists.LoadMapCSV(stream);

                        Lists.ExternalMapList.Add(mapListData);
                    }
                    catch (Exception ex)
                    {
                        Logger.LogError($"Failed to load list file \"{entry.Name}\" from archive \"{GetRelativeArchiveDir(arc.Name)}\" with error: {ex}");
                    }
                }
#endif
#endif
            }

#if KK || AI
            //ItemBoneList data must be resolved after the corresponding item so they can be resolved to the same ID
            foreach (ZipEntry entry in BoneList)
            {
                try
                {
                    var stream         = arc.GetInputStream(entry);
                    var studioListData = Lists.LoadStudioCSV(stream, entry.Name);

                    UniversalAutoResolver.GenerateStudioResolutionInfo(manifest, studioListData);
                    Lists.ExternalStudioDataList.Add(studioListData);
                }
                catch (Exception ex)
                {
                    Logger.LogError($"Failed to load list file \"{entry.Name}\" from archive \"{GetRelativeArchiveDir(arc.Name)}\" with error: {ex}");
                }
            }
#endif
        }