Esempio n. 1
0
        public static ICodeBlock GetLoadCallsForRfs(ReferencedFileSave referencedFile, string fileName, AssetTypeInfo ati, string variableName, ICodeBlock codeBlock, bool useGlobalContent, bool isContentPipeline)
        {
            var currentBlock = codeBlock;

            if (referencedFile.IsCsvOrTreatedAsCsv == false)
            {
                string modifiedFileName = fileName.ToLower();

                string contentManagerString = GetContentManagerString(referencedFile);

                string fileNameToLoad = ProjectBase.AccessContentDirectory + modifiedFileName;

                // If the file isn't part of the content pipeline we have
                // to manually unload it
                if (!useGlobalContent && !isContentPipeline)
                {
                    currentBlock = currentBlock
                                   .If(string.Format("!FlatRedBall.FlatRedBallServices.IsLoaded<{2}>(@\"{0}\", {1})", ProjectBase.AccessContentDirectory + modifiedFileName, contentManagerString, ati.QualifiedRuntimeTypeName.QualifiedType));
                    if (referencedFile.GetContainerType() == ContainerType.Entity)
                    {
                        currentBlock.Line("registerUnload = true;");
                    }

                    currentBlock = currentBlock.End();
                }

                ReferencedFileSaveCodeGenerator.GetLoadCallForAtiFile(referencedFile, ati, variableName, contentManagerString, fileNameToLoad, codeBlock);
            }
            return(currentBlock);
        }