public void PathCreateFromUrlAlloc()
        {
            Console.WriteLine("Filesystem.Shell32.PathCreateFromUrlAlloc()");

            string urlPath  = Shell32.UrlCreateFromPath(AppData);
            string filePath = Shell32.PathCreateFromUrlAlloc(urlPath);

            Console.WriteLine("\n\tDirectory                  : [{0}]", AppData);
            Console.WriteLine("\n\tShell32.UrlCreateFromPath(): [{0}]", urlPath);
            Console.WriteLine("\n\tShell32.PathCreateFromUrlAlloc() == [{0}]\n", filePath);

            bool startsWith    = urlPath.StartsWith("file:///");
            bool equalsAppData = filePath.Equals(AppData);

            Console.WriteLine("\n\turlPath.StartsWith(\"file:///\") == [{0}]: {1}", TextTrue, startsWith);
            Console.WriteLine("\n\tfilePath.Equals(AppData)       == [{0}]: {1}\n", TextTrue, equalsAppData);
            Assert.IsTrue(startsWith);
            Assert.IsTrue(equalsAppData);
        }
Esempio n. 2
0
        public void AlphaFS_Shell32_PathCreateFromUrlAlloc()
        {
            Console.WriteLine("Filesystem.Shell32.PathCreateFromUrlAlloc()");

            var urlPath  = Shell32.UrlCreateFromPath(UnitTestConstants.AppData);
            var filePath = Shell32.PathCreateFromUrlAlloc(urlPath);

            Console.WriteLine("\n\tDirectory                  : [{0}]", UnitTestConstants.AppData);
            Console.WriteLine("\n\tShell32.UrlCreateFromPath(): [{0}]", urlPath);
            Console.WriteLine("\n\tShell32.PathCreateFromUrlAlloc() == [{0}]\n", filePath);

            var startsWith    = urlPath.StartsWith("file:///");
            var equalsAppData = filePath.Equals(UnitTestConstants.AppData);

            Console.WriteLine("\n\turlPath.StartsWith(\"file:///\") == [{0}]: {1}", UnitTestConstants.TextTrue, startsWith);
            Console.WriteLine("\n\tfilePath.Equals(AppData)       == [{0}]: {1}\n", UnitTestConstants.TextTrue, equalsAppData);
            Assert.IsTrue(startsWith);
            Assert.IsTrue(equalsAppData);
        }
        public void UrlIs()
        {
            Console.WriteLine("Filesystem.Shell32.UrlIs()");

            string urlPath  = Shell32.UrlCreateFromPath(AppData);
            string filePath = Shell32.PathCreateFromUrlAlloc(urlPath);

            bool isFileUrl1  = Shell32.UrlIsFileUrl(urlPath);
            bool isFileUrl2  = Shell32.UrlIsFileUrl(filePath);
            bool isNoHistory = Shell32.UrlIs(filePath, Shell32.UrlType.IsNoHistory);
            bool isOpaque    = Shell32.UrlIs(filePath, Shell32.UrlType.IsOpaque);

            Console.WriteLine("\n\tDirectory: [{0}]", AppData);
            Console.WriteLine("\n\tShell32.UrlCreateFromPath()      == IsFileUrl == [{0}] : {1}\t\t[{2}]", TextTrue, isFileUrl1, urlPath);
            Console.WriteLine("\n\tShell32.PathCreateFromUrlAlloc() == IsFileUrl == [{0}]: {1}\t\t[{2}]", TextFalse, isFileUrl2, filePath);

            Console.WriteLine("\n\tShell32.UrlIsFileUrl()   == [{0}]: {1}\t\t[{2}]", TextTrue, isFileUrl1, urlPath);
            Console.WriteLine("\n\tShell32.UrlIsNoHistory() == [{0}]: {1}\t\t[{2}]", TextTrue, isNoHistory, urlPath);
            Console.WriteLine("\n\tShell32.UrlIsOpaque()    == [{0}]: {1}\t\t[{2}]", TextTrue, isOpaque, urlPath);

            Assert.IsTrue(isFileUrl1);
            Assert.IsTrue(isFileUrl2 == false);
        }
Esempio n. 4
0
        public void AlphaFS_Shell32_UrlIs()
        {
            Console.WriteLine("Filesystem.Shell32.UrlIs()");

            var urlPath  = Shell32.UrlCreateFromPath(UnitTestConstants.AppData);
            var filePath = Shell32.PathCreateFromUrlAlloc(urlPath);

            var isFileUrl1  = Shell32.UrlIsFileUrl(urlPath);
            var isFileUrl2  = Shell32.UrlIsFileUrl(filePath);
            var isNoHistory = Shell32.UrlIs(filePath, Shell32.UrlType.IsNoHistory);
            var isOpaque    = Shell32.UrlIs(filePath, Shell32.UrlType.IsOpaque);

            Console.WriteLine("\n\tDirectory: [{0}]", UnitTestConstants.AppData);
            Console.WriteLine("\n\tShell32.UrlCreateFromPath()      == IsFileUrl == [{0}] : {1}\t\t[{2}]", UnitTestConstants.TextTrue, isFileUrl1, urlPath);
            Console.WriteLine("\n\tShell32.PathCreateFromUrlAlloc() == IsFileUrl == [{0}]: {1}\t\t[{2}]", UnitTestConstants.TextFalse, isFileUrl2, filePath);

            Console.WriteLine("\n\tShell32.UrlIsFileUrl()   == [{0}]: {1}\t\t[{2}]", UnitTestConstants.TextTrue, isFileUrl1, urlPath);
            Console.WriteLine("\n\tShell32.UrlIsNoHistory() == [{0}]: {1}\t\t[{2}]", UnitTestConstants.TextTrue, isNoHistory, urlPath);
            Console.WriteLine("\n\tShell32.UrlIsOpaque()    == [{0}]: {1}\t\t[{2}]", UnitTestConstants.TextTrue, isOpaque, urlPath);

            Assert.IsTrue(isFileUrl1);
            Assert.IsTrue(isFileUrl2 == false);
        }