示例#1
0
        public void LoadFile(string scriptFile)
        {
            try
            {
                using (GetPushRuntime())
                {
                    var assemblyStream = new BinaryReader(new FxStreamWrapper(m_scriptHost.OpenHostFile(scriptFile)));
                    var assemblyBytes  = assemblyStream.ReadBytes((int)assemblyStream.BaseStream.Length);

                    byte[] symbolBytes = null;

                    try
                    {
                        var symbolStream = new BinaryReader(new FxStreamWrapper(m_scriptHost.OpenHostFile(scriptFile + ".mdb")));
                        symbolBytes = symbolStream.ReadBytes((int)symbolStream.BaseStream.Length);
                    }
                    catch
                    {
                        // nothing
                    }

                    m_intManager.CreateAssembly(assemblyBytes, symbolBytes);
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.ToString());

                throw;
            }
        }
示例#2
0
        Assembly LoadAssembly(string name)
        {
            try
            {
                var assemblyStream = new BinaryReader(new FxStreamWrapper(ms_scriptHost.OpenHostFile(name + ".dll")));
                var assemblyBytes  = assemblyStream.ReadBytes((int)assemblyStream.BaseStream.Length);

                byte[] symbolBytes = null;

                try
                {
                    var symbolStream = new BinaryReader(new FxStreamWrapper(ms_scriptHost.OpenHostFile(name + ".dll.mdb")));
                    symbolBytes = symbolStream.ReadBytes((int)symbolStream.BaseStream.Length);
                }
                catch
                {
                    // nothing
                }

                return(CreateAssemblyInternal(assemblyBytes, symbolBytes));
            }
            catch { }

            return(null);
        }
示例#3
0
 public fxIStream OpenHostFile([MarshalAs(UnmanagedType.LPStr)] string fileName)
 {
     return(new WrapIStream(m_realHost.OpenHostFile(fileName)));
 }