예제 #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");
        }
예제 #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);
        }
예제 #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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        public void ShouldParseANamespacedScriptWithMemberName()
        {
            var identifier = ObjectIdentifier.Parse("NamespaceA:NamespaceB:ScriptName#StructName");

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

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