private IOConnectionInfo ImportFileToInternalDirectory(IOConnectionInfo sourceIoc)
        {
            Java.IO.File internalDirectory = IoUtil.GetInternalDirectory(Activity);
            string       targetPath        = UrlUtil.GetFileName(sourceIoc.Path);

            targetPath = targetPath.Trim("|\\?*<\":>+[]/'".ToCharArray());
            if (targetPath == "")
            {
                targetPath = "imported";
            }
            if (new File(internalDirectory, targetPath).Exists())
            {
                int c   = 1;
                var ext = UrlUtil.GetExtension(targetPath);
                var filenameWithoutExt = UrlUtil.StripExtension(targetPath);
                do
                {
                    c++;
                    targetPath = filenameWithoutExt + c;
                    if (!String.IsNullOrEmpty(ext))
                    {
                        targetPath += "." + ext;
                    }
                } while (new File(internalDirectory, targetPath).Exists());
            }
            var targetIoc = IOConnectionInfo.FromPath(new File(internalDirectory, targetPath).CanonicalPath);

            IoUtil.Copy(targetIoc, sourceIoc, App.Kp2a);
            return(targetIoc);
        }
            public override void Run()
            {
                StatusLogger.UpdateMessage(UiStringKey.exporting_database);

                try
                {
                    var fileStorage = _app.GetFileStorage(_targetIoc);
                    if (fileStorage is IOfflineSwitchable)
                    {
                        ((IOfflineSwitchable)fileStorage).IsOffline = false;
                    }

                    CompositeKey masterKey = App.Kp2a.CurrentDb.KpDatabase.MasterKey;
                    var          sourceIoc = ((KcpKeyFile)masterKey.GetUserKey(typeof(KcpKeyFile))).Ioc;

                    IoUtil.Copy(_targetIoc, sourceIoc, App.Kp2a);

                    if (fileStorage is IOfflineSwitchable)
                    {
                        ((IOfflineSwitchable)fileStorage).IsOffline = App.Kp2a.OfflineMode;
                    }

                    Finish(true);
                }
                catch (Exception ex)
                {
                    Finish(false, ex.Message);
                }
            }
 protected virtual void CopyFile(IOConnectionInfo targetIoc, IOConnectionInfo sourceIoc)
 {
     IoUtil.Copy(targetIoc, sourceIoc, _app);
 }