Exemple #1
0
        public void ShouldParseANamespacedScriptName()
        {
            var identifier = ObjectIdentifier.Parse("NamespaceA:NamespaceB:ScriptName");

            Assert.AreEqual(identifier.NamespaceParts.Length, 2);
            Assert.AreEqual(identifier.NamespaceParts[0], "NamespaceA");
            Assert.AreEqual(identifier.NamespaceParts[1], "NamespaceB");
            Assert.AreEqual(identifier.ScriptName, "ScriptName");
        }
Exemple #2
0
        public void ShouldParseAndConvertToAFilePath()
        {
            var identifierA = ObjectIdentifier.Parse("NamespaceA:NamespaceB:ScriptName");
            var identifierB = ObjectIdentifier.FromScriptFilePath("NamespaceA/NamespaceB/ScriptName.psc");
            var path        = identifierB.ToScriptFilePath();
            var identifierC = ObjectIdentifier.FromScriptFilePath(path);

            Assert.AreEqual(identifierA, identifierB);
            Assert.AreEqual(identifierB, identifierC);
        }
Exemple #3
0
        public void ShouldBeEquatableWithCaseInsensitivity()
        {
            var identifierA = ObjectIdentifier.Parse("NamespaceA:NamespaceB:ScriptName#StructName");
            var identifierB = ObjectIdentifier.Parse("namespacea:namespaceb:scriptname#structname");

            Assert.IsTrue(identifierA == identifierB);
            Assert.AreEqual(identifierA, identifierB);

            var identifierC = ObjectIdentifier.Parse("NamespaceA:NamespaceB:ScriptName");

            Assert.IsTrue(identifierB != identifierC);
            Assert.AreNotEqual(identifierB, identifierC);
        }
        public ComplexType GetTypeForObjectId(ObjectIdentifier objectIdentifier)
        {
            var scriptIdentifier = ObjectIdentifier.Parse(objectIdentifier.FullScriptName);

            _program.ScriptFiles.TryGetValue(scriptIdentifier, out var scriptFile);
            var scriptType = scriptFile?.Type;

            if (scriptType == null)
            {
                return(null);
            }

#if FALLOUT4
            if (!string.IsNullOrEmpty(objectIdentifier.StructName))
            {
                scriptType.StructTypes.TryGetValue(objectIdentifier, out var structType);
                return(structType);
            }
#endif

            return(scriptType);
        }
Exemple #5
0
        public void ShouldParseANamespacedScriptWithMemberName()
        {
            var identifier = ObjectIdentifier.Parse("NamespaceA:NamespaceB:ScriptName#StructName");

            Assert.AreEqual(identifier.StructName, "StructName");
        }
Exemple #6
0
        public void ShouldParseANonNamespacedScriptName()
        {
            var identifier = ObjectIdentifier.Parse("ScriptName");

            Assert.AreEqual(identifier.ScriptName, "ScriptName");
        }
Exemple #7
0
 public ScriptSymbol(ScriptNode node) :
     base(node, node.Header.Identifier, null, ObjectIdentifier.Parse(node.Header.Identifier.Text))
 {
 }
Exemple #8
0
 public StructSymbol(StructDefinitionNode node, PapyrusSymbol parent) :
     base(node, node.Header.Identifier, parent, ObjectIdentifier.Parse(parent.Name + "#" + node.Header.Identifier.Text))
 {
 }