示例#1
0
 public TES5BlockFactory(TES5ChainedCodeChunkFactory chainedCodeChunkFactory, TES5AdditionalBlockChangesPass changesPass, TES5InitialBlockCodeFactory initialBlockCodeFactory, TES5ObjectCallFactory objectCallFactory)
 {
     this.codeChunkFactory        = chainedCodeChunkFactory;
     this.changesPass             = changesPass;
     this.initialBlockCodeFactory = initialBlockCodeFactory;
     this.objectCallFactory       = objectCallFactory;
 }
 public TES5FragmentFactory(TES5ChainedCodeChunkFactory chainedCodeChunkFactory)
 {
     this.codeChunkFactory = chainedCodeChunkFactory;
 }
 public TES5FragmentFactory(TES5ChainedCodeChunkFactory chainedCodeChunkFactory, TES5AdditionalBlockChangesPass changesPass)
 {
     this.codeChunkFactory = chainedCodeChunkFactory;
     this.changesPass      = changesPass;
 }
示例#4
0
        private static TES5SubBranch ConvertSubBranch(TES4SubBranch branch, TES5CodeScope outerCodeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope, TES5ChainedCodeChunkFactory codeChunkFactory, TES5ValueFactory valueFactory)
        {
            ITES5Value     expression   = valueFactory.CreateValue(branch.Expression, outerCodeScope, globalScope, multipleScriptsScope);
            TES5CodeScope  newCodeScope = TES5CodeScopeFactory.CreateCodeScopeRecursive(outerCodeScope.LocalScope);
            TES4CodeChunks branchChunks = branch.CodeChunks;

            if (branchChunks != null)
            {
                foreach (ITES4CodeChunk codeChunk in branchChunks)
                {
                    TES5CodeChunkCollection codeChunks = codeChunkFactory.createCodeChunk(codeChunk, newCodeScope, globalScope, multipleScriptsScope);
                    if (codeChunks != null)
                    {
                        foreach (ITES5CodeChunk newCodeChunk in codeChunks)
                        {
                            newCodeScope.AddChunk(newCodeChunk);
                        }
                    }
                }
            }

            return(new TES5SubBranch(expression, newCodeScope));
        }
示例#5
0
        public static TES5CodeChunkCollection CreateCodeChunk(TES4Branch chunk, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope, TES5ChainedCodeChunkFactory codeChunkFactory, TES5ValueFactory valueFactory)
        {
            TES5SubBranch     mainBranch = ConvertSubBranch(chunk.MainBranch, codeScope, globalScope, multipleScriptsScope, codeChunkFactory, valueFactory);
            TES4SubBranchList branchList = chunk.ElseifBranches;
            TES5SubBranchList convertedElseIfBranches = null;

            if (branchList != null)
            {
                convertedElseIfBranches = new TES5SubBranchList();
                foreach (TES4SubBranch subBranch in branchList.Branches)
                {
                    convertedElseIfBranches.Add(ConvertSubBranch(subBranch, codeScope, globalScope, multipleScriptsScope, codeChunkFactory, valueFactory));
                }
            }

            TES4ElseSubBranch elseBranch          = chunk.ElseBranch;
            TES5ElseSubBranch convertedElseBranch = null;

            if (elseBranch != null)
            {
                convertedElseBranch = ConvertElseBranch(elseBranch, codeScope, globalScope, multipleScriptsScope, codeChunkFactory);
            }

            return(new TES5CodeChunkCollection()
            {
                new TES5Branch(mainBranch, convertedElseIfBranches, convertedElseBranch)
            });
        }
示例#6
0
        private static TES5ElseSubBranch ConvertElseBranch(TES4ElseSubBranch branch, TES5CodeScope outerCodeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope, TES5ChainedCodeChunkFactory codeChunkFactory)
        {
            TES5CodeScope  newCodeScope = TES5CodeScopeFactory.CreateCodeScopeRecursive(outerCodeScope.LocalScope);
            TES4CodeChunks?branchChunks = branch.CodeChunks;

            if (branchChunks != null)
            {
                foreach (ITES4CodeChunk codeChunk in branchChunks)
                {
                    TES5CodeChunkCollection codeChunks = codeChunkFactory.CreateCodeChunk(codeChunk, newCodeScope, globalScope, multipleScriptsScope);
                    foreach (ITES5CodeChunk newCodeChunk in codeChunks)
                    {
                        newCodeScope.AddChunk(newCodeChunk);
                    }
                }
            }
            return(new TES5ElseSubBranch(newCodeScope));
        }