Пример #1
0
 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));
 }