示例#1
0
        public bool Compile(PhactoryHost.Database.Resource resource)
        {
            FileInfo fileInfo = Host.GetFileInfo(resource);

            if (fileInfo == null)
            {
                return(false);
            }

            if (!IsResourceSupported(resource))
            {
                return(false);
            }

            List <String> resourceFilenames = new List <String>();
            List <String> paddingFilenames  = new List <String>();
            List <int>    address           = new List <int>();

            Document.Document document = Host.XMLRead <Document.Document>(Host.GetFileInfo(resource).FullName);
            if (document == null)
            {
                return(false);
            }

            document.Expand();

            foreach (Document.File file in document.Files)
            {
                PhactoryHost.Database.Resource iResource = Host.GetResource(file.ResourceID);
                if (iResource == null)
                {
                    Host.Log("Unknown resource identifier : " + file.ResourceID);
                    return(false);
                }

                FileInfo iFileInfo = Host.GetFileInfo(iResource);

                resourceFilenames.Add(iFileInfo.FullName);
                paddingFilenames.Add(file.Pad256 ? "true" : "false");
                address.Add((file.SetAddress == false)?0:file.Address);
            }

            var compiler = new Phactory.Modules.BigFile.Compiler.BigFileCompiler();

            string resourceRelativePathNoExt = resource.RelativePath;

            resourceRelativePathNoExt = resourceRelativePathNoExt.Replace(".cpcbigfile", "");

            App.Controller.View.AppDoEvents();

            string baseFilename   = Host.MakeFullPath(resourceRelativePathNoExt);
            string headerFilename = Host.MakeFullPath(resourceRelativePathNoExt + ".H");

            if (!compiler.Compile(baseFilename, headerFilename, resourceFilenames, paddingFilenames, address, document.TruncateFiles, document.FilesInBank, document.BaseAddress))
            {
                return(false);
            }

            return(true);
        }
示例#2
0
文件: View.cs 项目: rgiot/phactory
        private void Add_Click(object sender, EventArgs e)
        {
            List <PhactoryHost.Database.Resource> resources = Plugin.ControllerEditor.Host.ShowResourceSelector(null, true);

            if (resources != null)
            {
                foreach (PhactoryHost.Database.Resource resource in resources)
                {
                    var file = new CPCBigFile.Document.File(resource.Id);
                    Document.Files.Add(file);
                }

                Document.Expand();

                SetModified(true);
                RefreshUI();
            }
        }