コード例 #1
0
ファイル: ShareObject.cs プロジェクト: marler8997/More.Nfs
 void SetShareLeafName(String shareLeafName)
 {
     if (PlatformPath.IsValidUnixFileName(shareLeafName))
     {
         this.shareLeafName = shareLeafName;
     }
     else
     {
         String newShareLeafName = NfsPath.LeafName(shareLeafName);
         if (!PlatformPath.IsValidUnixFileName(newShareLeafName))
         {
             throw new InvalidOperationException(String.Format("The file you supplied '{0}' is not a valid unix file name", shareLeafName));
         }
         this.shareLeafName = newShareLeafName;
     }
 }
コード例 #2
0
        public void TestLeafName()
        {
            Assert.AreEqual(null, NfsPath.LeafName(null));
            Assert.AreEqual(null, NfsPath.LeafName(""));
            Assert.AreEqual(null, NfsPath.LeafName("/"));
            Assert.AreEqual("a", NfsPath.LeafName("a"));
            Assert.AreEqual("a", NfsPath.LeafName("/a"));
            Assert.AreEqual("a", NfsPath.LeafName("a/"));
            Assert.AreEqual("a", NfsPath.LeafName("/a/"));

            Assert.AreEqual("leafname", NfsPath.LeafName("leafname"));
            Assert.AreEqual("leafname", NfsPath.LeafName("/leafname"));
            Assert.AreEqual("leafname", NfsPath.LeafName("leafname/"));
            Assert.AreEqual("leafname", NfsPath.LeafName("/leafname/"));

            Assert.AreEqual("a", NfsPath.LeafName("leafname/a"));
            Assert.AreEqual("a", NfsPath.LeafName("leafname/a/"));
            Assert.AreEqual("a", NfsPath.LeafName("/leafname/a"));
            Assert.AreEqual("a", NfsPath.LeafName("/leafname/a/"));
        }
コード例 #3
0
 public Nfs3Procedure.Status TryGetSharedObject(String localPathAndName, out ShareObject shareObject)
 {
     return(TryGetSharedObject(localPathAndName, NfsPath.LeafName(localPathAndName), out shareObject));
 }