コード例 #1
0
 public TES5Property(string name, ITES5Type propertyType, string?referenceEDID, Nullable <int> tes4FormID, Nullable <int> tes5FormID)
 {
     this.IsPlayerRef             = name == TES5PlayerReference.PlayerRefName && propertyType == TES5PlayerReference.TES5TypeStatic && referenceEDID == TES5PlayerReference.PlayerRefName;
     this.OriginalName            = name;
     this.AllowNameTransformation = !this.IsPlayerRef;
     this.Name            = AllowNameTransformation ? AddPropertyNameSuffix(PapyrusCompiler.FixReferenceName(name)) : name;
     this.propertyType    = propertyType;
     originalPropertyType = propertyType;
     this.ReferenceEDID   = referenceEDID;
     this.TES4FormID      = tes4FormID;
     this.tes5FormID      = tes5FormID;
     this.trackedScript   = null;
 }
        /*
         * Create a generic-purpose reference.
         */
        public ITES5Referencer CreateReference(string referenceName, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope, TES5LocalScope localScope)
        {
            if (TES5PlayerReference.EqualsPlayer(referenceName))
            {
                return(CreateReferenceToPlayer());
            }

            referenceName = PapyrusCompiler.FixReferenceName(referenceName);
            Match match = PropertyNameRegex.Match(referenceName);

            if (match.Success)
            {
                ITES5Referencer    mainReference     = this.CreateReference(match.Groups[1].Value, globalScope, multipleScriptsScope, localScope);
                TES5ObjectProperty propertyReference = this.objectPropertyFactory.CreateObjectProperty(multipleScriptsScope, mainReference, match.Groups[2].Value); //Todo rethink the prefix adding
                return(propertyReference);
            }

            ITES5VariableOrProperty property = localScope.GetVariable(referenceName);

            if (property == null)
            {
                property = globalScope.GetPropertyByName(referenceName); //todo rethink how to unify the prefix searching
                if (property == null)
                {
                    TES5Property propertyToAddToGlobalScope = null;
                    ITES5Type    specialConversion;
                    if (specialConversions.TryGetValue(referenceName, out specialConversion))
                    {
                        propertyToAddToGlobalScope = new TES5Property(referenceName, specialConversion, referenceName);
                    }

                    if (propertyToAddToGlobalScope == null)
                    {
                        if (!multipleScriptsScope.ContainsGlobalVariable(referenceName))
                        {
                            propertyToAddToGlobalScope = new TES5Property(referenceName, TES5BasicType.T_FORM, referenceName);
                        }
                        else
                        {
                            propertyToAddToGlobalScope = new TES5Property(referenceName, TES5BasicType.T_GLOBALVARIABLE, referenceName);
                        }
                    }
                    globalScope.AddProperty(propertyToAddToGlobalScope);
                    property = propertyToAddToGlobalScope;
                }
            }

            return(new TES5Reference(property));
        }
コード例 #3
0
        private void StartCompilation()
        {
            textBox1.Text = "";
            //PapyrusCompiler.Compile(scriptList.GetItemText(scriptList.SelectedItem));
            //PapyrusCompiler.Arguments.InputPath = globalConfigForm.InputScriptsPath;
            //PapyrusCompiler.Arguments.InputPath += $@";{Application.StartupPath}\scripts\combat";
            //PapyrusCompiler.Arguments.AddPath($@"{Application.StartupPath}\scripts\combat");
            //PapyrusCompiler.Arguments.AddPath($@"{localMoPath}\{projectList.GetItemText(projectList.SelectedItem)}\scripts\source");
            DirectoryInfo modPath = new DirectoryInfo($"{localMoPath}\\{projectList.GetItemText(projectList.SelectedItem)}\\scripts\\source");

            // Add the mod's dependencies from the list to the compiler's input path
            foreach (string dependency in dependsOnList.Items)
            {
                PapyrusCompiler.Arguments.AddPath(dependency);
            }
            PapyrusCompiler.Arguments.AddPath($"{localMoPath}\\{projectList.GetItemText(projectList.SelectedItem)}\\scripts\\source");

            string selectedMod = projectList.GetItemText(projectList.SelectedItem);

            string[] selectedScripts = (from string script in scriptList.SelectedItems select script).ToArray();

            new Thread(() => {
                foreach (string script in selectedScripts)
                {
                    PapyrusCompiler.Arguments.OutputPath = $@"{Application.StartupPath}\output\{selectedMod}\scripts";

                    PapyrusCompiler.Compile(script);

                    if (PapyrusCompiler.StdOut.Contains("Assembly succeeded"))
                    {
                        textBox1.Text += PapyrusCompiler.StdOut;
                    }
                    else
                    {
                        textBox1.Text += PapyrusCompiler.StdErr;
                    }
                    //ShowErrorOutput();
                }
            }).Start();


            outputTextBox.ForeColor = Color.Red;
        }
 public TES4VariableDeclaration(string variableName, TES4Type variableType)
 {
     this.VariableName = PapyrusCompiler.FixReferenceName(variableName);
     this.VariableType = variableType;
 }
コード例 #5
0
 public void Compile(string sourcePath, string workspacePath, string outputPath, string standardOutputFilePath, string standardErrorFilePath)
 {
     PapyrusCompiler.Run(sourcePath, workspacePath, outputPath, standardOutputFilePath, standardErrorFilePath);
 }
コード例 #6
0
 private void directCompileBtn_Click(object sender, EventArgs e)
 {
     PapyrusCompiler.DirectCompile(compilerArguments.Text);
     ShowErrorOutput();
     Console.WriteLine(PapyrusCompiler.StdOut);
 }