コード例 #1
0
ファイル: AssemblyAsset.cs プロジェクト: DF-thangld/web_game
        /// <summary>
        /// Constructs an asset from the given assembly. If the resource
        /// does not exist, this throws an AssetException.
        /// </summary>
        public AssemblyAsset(AssemblyAssetProvider provider, NodeRef path)
        {
            // Save the fields
            this.provider = provider;
            this.path = path.ToString();

            if (provider.StripLeadingSlash)
                this.path = this.path.Substring(1);

            // Make sure it exists
            bool found = false;

            foreach (string name in provider.Assembly.GetManifestResourceNames())
            {
                if (name == this.path)
                {
                    found = true;
                    break;
                }
            }

            if (!found)
                throw new AssetException("Cannot find resource '"
                    + path + "' from assembly '"
                    + provider.Assembly.FullName
                    + "'");
        }
コード例 #2
0
ファイル: NodeRefTest.cs プロジェクト: DF-thangld/web_game
 public void TestEscapedStar()
 {
     NodeRef nr = new NodeRef("/*/*/*");
     Assert.AreEqual("/*/*/*", nr.ToString(),
         "String comparison");
     Assert.IsTrue(nr.Includes(new NodeRef("/*/*/*/abb")),
         "nr.Includes");
 }
コード例 #3
0
ファイル: NodeRefTest.cs プロジェクト: DF-thangld/web_game
 public void TestEscapedNone()
 {
     NodeRef nr = new NodeRef("/a/b/c");
     Assert.AreEqual("/a/b/c", nr.ToString(),
         "String comparison");
 }
コード例 #4
0
ファイル: NodeRefTest.cs プロジェクト: DF-thangld/web_game
 public void ParsePluses()
 {
     NodeRef nr = new NodeRef("/Test/Test +1/Test +2");
     Assert.AreEqual("/Test/Test +1/Test +2", nr.ToString());
     Assert.AreEqual("Test +2", nr.Name);
 }
コード例 #5
0
ファイル: NodeRef.cs プロジェクト: DF-thangld/web_game
 /// <summary>
 /// Returns true if this path includes the given path. This means
 /// that given path is under or part of this node's path.
 /// </summary>
 public bool Includes(NodeRef path)
 {
     // We have a real easy way of finding this
     return Regex.IsMatch(path.ToString(), "^" + regexable);
 }
コード例 #6
0
 /// <summary>
 /// Returns the attribute tree node for the given path. If it does
 /// not exist, a null is returned.
 /// </summary>
 public AttributeTree this[NodeRef nref]
 {
     get { return this[nref, false]; }
     set { BaseSet(nref.ToString(), value); }
 }
コード例 #7
0
ファイル: AttributeTree.cs プロジェクト: DF-thangld/web_game
        /// <summary>
        /// Called when a new child is created (but not cloned).
        /// </summary>
        public virtual void OnCreatedAsChild(NodeRef nref,
			AttributeTree parent)
        {
            Path = new NodeRef(parent.Path.ToString() + nref.ToString());
        }