예제 #1
0
        public void Copy(string from, string to)
        {
            try
            {
                IIOContext io     = IOContext.Current;
                string     source = io.TranslateLocalPath(from);
                string     dest   = io.TranslateLocalPath(to);

                if (!io.Exists(source))
                {
                    throw new NonFatalException(D.FILE_NOT_EXISTS + ": " + from);
                }
                if (io.Exists(dest))
                {
                    throw new NonFatalException(D.FILE_ALREADY_EXISTS + ": " + to);
                }

                io.Copy(source, dest);
            }
            catch (CustomException e)
            {
                throw ClientException(e.FriendlyMessage);
            }
            catch (ArgumentException)
            {
                throw ClientException(D.INVALID_PATH + ": " + from + "; " + to);
            }
            catch (Exception e)
            {
                HandleException(e, "Exists");
                throw ClientException(D.UNEXPECTED_ERROR_OCCURED);
            }
        }