Example #1
0
        private void OnRequestAssembly(string assembly)
        {
            string assemblyName = $"{assembly}{MonoManager.AssemblyExtension}";

            foreach (ResourcesFile file in m_resources)
            {
                if (file.Name == assemblyName)
                {
                    using (PartialStream stream = new PartialStream(file.Stream, file.Offset, file.Size))
                    {
                        ReadAssembly(stream, assemblyName);
                    }
                    Logger.Instance.Log(LogType.Info, LogCategory.Import, $"Assembly '{assembly}' has been loaded");
                    return;
                }
            }

            m_assemblyCallback?.Invoke(assembly);
        }
Example #2
0
 public void ReadResourcesFile(FileCollection collection)
 {
     if (m_stream.StreamType == SmartStreamType.Memory && m_stream.Length > m_size)
     {
         // create separate stream so resouce file don't refer to huge memory blob and this blob will be released
         using (SmartStream resStream = SmartStream.CreateMemory(new byte[m_size]))
         {
             using (PartialStream partStream = new PartialStream(m_stream, m_offset, m_size))
             {
                 partStream.CopyTo(resStream);
             }
             collection.ReadResourceFile(resStream, FilePath, Name, 0, m_size);
         }
     }
     else
     {
         collection.ReadResourceFile(m_stream, FilePath, Name, m_offset, m_size);
     }
 }