Пример #1
0
        public static bool CreateFromResRef(ResRefType resRefType, string resRef, Action <CResGFF, CResStruct> deserializeAction)
        {
            if (string.IsNullOrEmpty(resRef))
            {
                return(false);
            }

            if (!ResourceManager.IsValidResource(resRef, resRefType))
            {
                return(false);
            }

            CResGFF resGff = new CResGFF((ushort)resRefType, $"{resRefType} ".GetNullTerminatedString(), resRef.ToResRef());

            if (!resGff.m_bLoaded.ToBool())
            {
                Log.Warn($"Unable to load ResRef: {resRef}");
                return(false);
            }

            CResStruct resStruct = new CResStruct();

            resGff.GetTopLevelStruct(resStruct).ToBool();
            deserializeAction(resGff, resStruct);

            resStruct.Dispose();
            resGff.Dispose();
            return(true);
        }
Пример #2
0
        private void Dispose(bool disposing)
        {
            resGff.Dispose();
            rootStruct.Dispose();

            if (disposing)
            {
                GC.SuppressFinalize(this);
            }
        }