Beispiel #1
0
        public static IAssembly LoadAssembly(string path, bool delbins)
        {
            try
            {
                if (!Path.IsPathRooted(path))
                {
                    path = Path.Combine(Environment.CurrentDirectory, path);
                }

                var asm = CommonLanguageInfrastructure.Deserialize(path, null);
                if (asm == null)
                {
                    LogError(Errors.UnableToLoadAssembly, path);
                    Environment.Exit(-1);
                }
                return(asm);
            }
            catch (Exception e)
            {
                LogException(e, Errors.UnableToLoadAssembly, path);
                Environment.Exit(-1);
            }
            finally
            {
                if (delbins)
                {
                    DeleteBins(path);
                }
            }
            return(null);
        }
Beispiel #2
0
 static IAssembly LoadAssembly(string path)
 {
     try
     {
         CommonLanguageInfrastructure.SubstituteFrameworkAssemblies = false;
         if (!Path.IsPathRooted(path))
         {
             path = Path.Combine(Environment.CurrentDirectory, path);
         }
         return(CommonLanguageInfrastructure.Deserialize(path, null));
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         Environment.Exit(-1);
         return(null);
     }
 }
Beispiel #3
0
        //TODO: revise error handling, e.g. throw exception

        public static IAssembly Load(string path, VM vm, string tcroot, ref string error)
        {
            SetupCli(vm);

#if DEBUG
            CommonLanguageInfrastructure.Debug             = true;
            CommonLanguageInfrastructure.TestCaseDirectory = tcroot;
#endif

            IAssembly asm;
            try
            {
                asm = CommonLanguageInfrastructure.Deserialize(path, null);
            }
            catch (Exception e)
            {
                error = String.Format("Unable to deserialize assembly.\nException:\n{0}", e);
                return(null);
            }

            return(asm);
        }
Beispiel #4
0
        private static void FLI_Serialize()
        {
            using (var dlg = new OpenFileDialog())
            {
                dlg.Filter      = "Managed Assemblies (*.dll, *.exe)|*.dll;*.exe";
                dlg.Multiselect = true;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                try
                {
                    string path = dlg.FileName;
                    var    asm  = CommonLanguageInfrastructure.Deserialize(path, null);
                    FlashLanguageInfrastructure.Serialize(asm, Path.ChangeExtension(path, ".swf"), "/format:swf");
                }
                catch (Exception exc)
                {
                    MessageBox.Show(exc.ToString());
                }
            }
        }
Beispiel #5
0
        private static IAssembly LoadAssembly(string path)
        {
            try
            {
                if (!Path.IsPathRooted(path))
                {
                    path = Path.Combine(Environment.CurrentDirectory, path);
                }

                var asm = CommonLanguageInfrastructure.Deserialize(path, null);
                if (asm == null)
                {
                    Console.WriteLine("Unable to load assembly '{0}'", path);
                    Environment.Exit(-1);
                }
                return(asm);
            }
            catch (Exception e)
            {
                Console.WriteLine("Unable to load assembly '{0}'", path);
                Environment.Exit(-1);
            }
            return(null);
        }
Beispiel #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="JsCompiler"/> class.
 /// </summary>
 /// <param name="assemblyFile">The file of the assembly to be compiled.</param>
 public JsCompiler(FileInfo assemblyFile)
     : this((IAssembly)CommonLanguageInfrastructure.Deserialize(assemblyFile.FullName, null))
 {
 }