Exemple #1
0
        public bool CompileASM(PhactoryHost.Database.Resource resource)
        {
            if (resource.IdOutputs.Count == 1)
            {
                PhactoryHost.Database.Resource outputResource = Host.GetResource(resource.IdOutputs[0]);

                if (Host.IsResourceReferencedByOtherResources(outputResource).Count == 0)
                {
                    // simply skip compilation
                    return(true);
                }
            }

            FileInfo fileInfo = Host.GetFileInfo(resource);

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

            string exeFullPath = Host.GetPluginsPath() + "Pasmo.exe";
            string arguments   = "--bin \"" + fileInfo.FullName + "\" \"" + fileInfo.FullName.Replace(".asm", ".bin") + "\"";

            bool isOK = Host.StartProcess(exeFullPath, arguments, fileInfo.DirectoryName, true);

            if (isOK)
            {
                if (Host.GetLastErrorOutput().ToUpper().IndexOf("ERROR") != -1)
                {
                    isOK = false;
                    Host.Log("\nCompilation failed with '" + resource.DisplayName + "'..\nLog output:\n" + Host.GetLastErrorOutput());
                }
            }

            return(isOK);
        }