Esempio n. 1
0
        bool ReadChildAssemblies(GlobalContainer Global)
        {
            var RetValue = true;
            var Count    = ReadLEB128_Int();

            ChildAssemblies = new Assembly[Count];

            for (var i = 0; i < Count; i++)
            {
                var Name   = ReadLEB128_String();
                var Random = Reader.ReadInt32();
                ReadLEB128_Int();

                var Assembly = Global.GetLoadedAssembly(Name);
                if (Assembly == null)
                {
                    var Path = new AssemblyPath(Name, true);
                    Assembly = Global.LoadAssembly(Path);
                }

                if (Assembly == null || Random != Assembly.Random)
                {
                    RetValue = false;
                    continue;
                }

                ChildAssemblies[i] = Assembly;
            }

            return(RetValue);
        }
Esempio n. 2
0
        public bool Compile(CodeFile[] CodeFiles, List <AssemblyPath> Assemblies = null, List <IncBinReference> IncBins = null)
        {
            Reset();
            InitializeScopes(CodeFiles);
            DefineMacroes();

            if (Assemblies != null)
            {
                var RetValue = true;
                for (var i = 0; i < Assemblies.Count; i++)
                {
                    if (GlobalContainer.GetLoadedAssembly(Assemblies[i].Name) == null)
                    {
                        if (GlobalContainer.LoadAssembly(Assemblies[i]) == null)
                        {
                            RetValue = false;
                        }
                    }
                }

                if (!RetValue)
                {
                    return(false);
                }
            }

            if (IncBins != null)
            {
                var RetValue = true;
                for (var i = 0; i < IncBins.Count; i++)
                {
                    var File     = IncBins[i].File;
                    var FileInfo = new FileInfo(File);

                    if (!FileInfo.Exists)
                    {
                        Messages.Add(MessageId.FileDoesntExists, new CodeString(File));
                        RetValue = false;
                        continue;
                    }

                    var IncBin = new IncludedBinary(IncBins[i].Name, File, FileInfo.Length);
                    GlobalContainer.IncludedBinaries.Add(IncBin);
                }

                if (!RetValue)
                {
                    return(false);
                }
            }

            GlobalContainer.SearchCommonIdentifiers();
            return(Arch.Compile(this, CodeFiles));
        }