private static void Write(IBuildTarget qfBuildTarget, IBuildTarget tifBuildTarget, TES4Record record, StageIndexAndLogIndex?stageIndexAndLogIndex, IReadOnlyList <string> aliases)
        {
            if (!aliases.Any())
            {
                return;
            }
#if !NEWBT
            bool playerRefFound = false;
            aliases = aliases.Where(a =>
            {
                if (a == TES5PlayerReference.PlayerRefName)
                {
                    playerRefFound = true; return(false);
                }
                return(true);
            }).ToArray();
#endif
            IBuildTarget buildTarget;
            string       prefix;
            GetBuildTargetAndPrefix(qfBuildTarget, tifBuildTarget, record, out buildTarget, out prefix);
            string fileNameNoExt = BuildTargetsWriter.GetFileNameNoExt(prefix, record, true, stageIndexAndLogIndex);
            string aliasesPath   = buildTarget.GetSourcePath() + fileNameNoExt + ".references";
            string contents      = string.Join("\r\n", aliases)
#if !NEWBT
                                   + (playerRefFound && aliases.Any() ? "\r\n" : "") + "\r\n\r\n"
#endif
            ;
            FileWriter.WriteAllTextOrThrowIfExists(aliasesPath, contents);
        }
        private static string GetPath(string directory, string scriptNamePrefix, TES4Record record, bool includeFormID, StageIndexAndLogIndex?stageIndexAndLogIndex)
        {
            string fileNameNoExt = BuildTargetsWriter.GetFileNameNoExt(scriptNamePrefix, record, includeFormID, stageIndexAndLogIndex);
            string path          = directory + fileNameNoExt + ".txt";

            return(path);
        }
Exemple #3
0
        public static void Write(string sourcePath, TES4Record qust)
        {
            string[] aliases         = ESMAnalyzer.GetReferenceAliases(qust).ToArray();
            string   fileNameNoExt   = BuildTargetsWriter.GetFileNameNoExt(TES5ReferenceFactory.qf_Prefix, qust, true, null);
            string   aliasesPath     = sourcePath + fileNameNoExt + ".aliases";
            string   aliasesContents = string.Join("\r\n", aliases)
#if !NEWBT
                                       + "\r\n"
#endif
            ;

            FileWriter.WriteAllTextOrThrowIfExists(aliasesPath, aliasesContents);
        }
        public static void Write()
        {
            BuildTarget              qfBuildTarget = BuildTargetFactory.Construct(BuildTargetFactory.QFName, new Build(DataDirectory.GetBuildPath()));
            string                   sourcePath    = qfBuildTarget.GetSourcePath();
            TES4Collection           collection    = TES4CollectionFactory.CreateForQUSTStageMapExportingFromESM(DataDirectory.GetESMDirectoryPath(), DataDirectory.TES4GameFileName);
            IEnumerable <TES4Record> qusts         = collection.GetGrupRecords(TES4RecordType.QUST);

            foreach (TES4Record qust in qusts)
            {
                string fileNameNoExt  = BuildTargetsWriter.GetFileNameNoExt(TES5ReferenceFactory.qf_Prefix, qust, true, null);
                string fileName       = fileNameNoExt + ".map";
                string mapFilePath    = sourcePath + Path.DirectorySeparatorChar + fileName;
                string contentsString = StageMapFromESMBuilder.BuildString(qust);
                FileWriter.WriteAllTextOrThrowIfExists(mapFilePath, contentsString);
            }
        }
        public static void Write()
        {
            BuildTarget qfBuildTarget  = BuildTargetFactory.Construct(BuildTargetFactory.QFName, new Build(DataDirectory.GetBuildPath()));
            string      transpiledPath = qfBuildTarget.GetTranspiledPath();
            string      sourcePath     = qfBuildTarget.GetSourcePath();

            foreach (string pscPath in Directory.EnumerateFiles(transpiledPath, "*.psc"))
            {
                Write(sourcePath, pscPath);
            }
            TES4Collection           collection  = TES4CollectionFactory.CreateForQUSTStageMapExportingFromPSCFiles(DataDirectory.GetESMDirectoryPath(), DataDirectory.TES4GameFileName);
            IEnumerable <TES4Record> qustRecords = collection.GetGrupRecords(TES4RecordType.QUST);

            foreach (TES4Record qust in qustRecords)
            {
                string path = sourcePath + BuildTargetsWriter.GetFileNameNoExt(TES5ReferenceFactory.qf_Prefix, qust, true, null) + ".map2";
                FileWriter.WriteAllTextIfNotExists(path, "");
            }
        }