Ejemplo n.º 1
0
        public bool CreateLocalCopy(String filepath)
        {
            if (IsDirectory(filepath))
            {
                return(false);
            }

            bool isLocalCopyAvailable = CheckIsLocalCopyAvailable(filepath);

            if (!isLocalCopyAvailable)
            {
                Directory.CreateDirectory(@m_tempPath);
                String filename      = Path.GetFileName(filepath);
                String localCopyPath = @m_tempPath + filename;
                try
                {
                    if (m_library.TestFilePathExistance(@filepath))
                    {
                        File.Copy(@filepath, @localCopyPath);
                        if (m_library.TestFilePathExistance(localCopyPath))
                        {
                            isFilePathValid = true;
                        }
                    }
                }
                catch (System.IO.FileNotFoundException fnfe)
                {
                    String exception = fnfe.ToString();
                    isLocalCopyAvailable = false;
                    isFilePathValid      = false;
                    return(false);
                }
                isLocalCopyAvailable = CheckIsLocalCopyAvailable(filepath);
            }

            return(isLocalCopyAvailable);
        }
Ejemplo n.º 2
0
        // Regression test:  VideoSyncClient1Tests.cs::Set_tempPathTest() and all the other specific tests too.
        private bool SetArbitraryFilePath(String newFilePath, ref String globalToSet, ref bool globalIsSet)
        {
            bool didSucceed = false;

            if (m_library.TestFilePathExistance(newFilePath))
            {
                globalToSet = newFilePath;
                globalIsSet = true;
                didSucceed  = true;
            }
            else
            {
                globalIsSet = false;
                didSucceed  = false;
            }

            return(didSucceed);
        }