当前位置: 首页>>代码示例>>C++>>正文


C++ FileOperationList类代码示例

本文整理汇总了C++中FileOperationList的典型用法代码示例。如果您正苦于以下问题:C++ FileOperationList类的具体用法?C++ FileOperationList怎么用?C++ FileOperationList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FileOperationList类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DoWork

bool CFileOperationJob::DoWork()
{
  FileOperationList ops;
  double totalTime = 0.0;

  if (m_displayProgress && GetProgressDialog() == NULL)
  {
    CGUIDialogExtendedProgressBar* dialog =
      (CGUIDialogExtendedProgressBar*)g_windowManager.GetWindow(WINDOW_DIALOG_EXT_PROGRESS);
    SetProgressBar(dialog->GetHandle(GetActionString(m_action)));
  }

  bool success = DoProcess(m_action, m_items, m_strDestFile, ops, totalTime);

  unsigned int size = ops.size();

  double opWeight = 100.0 / totalTime;
  double current = 0.0;

  for (unsigned int i = 0; i < size && success; i++)
    success &= ops[i].ExecuteOperation(this, current, opWeight);

  MarkFinished();

  return success;
}
开发者ID:evilhamster,项目名称:xbmc,代码行数:26,代码来源:FileOperationJob.cpp

示例2: DoProcessFolder

bool CFileOperationJob::DoProcessFolder(FileAction action, const CStdString& strPath, const CStdString& strDestFile, FileOperationList &fileOperations, double &totalTime)
{
  // check whether this folder is a filedirectory - if so, we don't process it's contents
  CFileItem item(strPath, false);
  IFileDirectory *file = CFactoryFileDirectory::Create(strPath, &item);
  if (file)
  {
    delete file;
    return true;
  }
  CLog::Log(LOGDEBUG,"FileManager, processing folder: %s",strPath.c_str());
  CFileItemList items;
  //m_rootDir.GetDirectory(strPath, items);
  CDirectory::GetDirectory(strPath, items, "", false, false, DIR_CACHE_ONCE, true, false, true);
  for (int i = 0; i < items.Size(); i++)
  {
    CFileItemPtr pItem = items[i];
    pItem->Select(true);
    CLog::Log(LOGDEBUG,"  -- %s",pItem->m_strPath.c_str());
  }

  if (!DoProcess(action, items, strDestFile, fileOperations, totalTime)) return false;

  if (action == ActionMove)
  {
    fileOperations.push_back(CFileOperation(ActionDeleteFolder, strPath, "", 1));
    totalTime += 1.0;
  }

  return true;
}
开发者ID:AaronDnz,项目名称:xbmc,代码行数:31,代码来源:FileOperationJob.cpp

示例3: DoWork

bool CFileOperationJob::DoWork()
{
  FileOperationList ops;
  double totalTime = 0.0;
  bool success = DoProcess(m_action, m_items, m_strDestFile, ops, totalTime);

  unsigned int size = ops.size();

  double opWeight = 100.0 / totalTime;
  double current = 0.0;

  for (unsigned int i = 0; i < size && success; i++)
    success &= ops[i].ExecuteOperation(this, current, opWeight);

  return success;
}
开发者ID:AaronDnz,项目名称:xbmc,代码行数:16,代码来源:FileOperationJob.cpp

示例4: DoProcessFolder

bool CFileOperationJob::DoProcessFolder(FileAction action, const std::string& strPath, const std::string& strDestFile, FileOperationList &fileOperations, double &totalTime)
{
  // check whether this folder is a filedirectory - if so, we don't process it's contents
  CFileItem item(strPath, false);
  IFileDirectory *file = CFileDirectoryFactory::Create(item.GetURL(), &item);
  if (file)
  {
    delete file;
    return true;
  }

  CFileItemList items;
  CDirectory::GetDirectory(strPath, items, "", DIR_FLAG_NO_FILE_DIRS | DIR_FLAG_GET_HIDDEN);
  for (int i = 0; i < items.Size(); i++)
  {
    CFileItemPtr pItem = items[i];
    pItem->Select(true);
  }

  if (!DoProcess(action, items, strDestFile, fileOperations, totalTime))
  {
    CLog::Log(LOGERROR,"FileManager: error while processing folder: %s", strPath.c_str());
    return false;
  }

  if (action == ActionMove)
  {
    fileOperations.push_back(CFileOperation(ActionDeleteFolder, strPath, "", 1));
    totalTime += 1.0;
  }

  return true;
}
开发者ID:FLyrfors,项目名称:xbmc,代码行数:33,代码来源:FileOperationJob.cpp

示例5: DoProcessFile

bool CFileOperationJob::DoProcessFile(FileAction action, const CStdString& strFileA, const CStdString& strFileB, FileOperationList &fileOperations, double &totalTime)
{
  int64_t time = 1;

  if (action == ActionCopy || action == ActionReplace || (action == ActionMove && !CanBeRenamed(strFileA, strFileB)))
  {
    struct __stat64 data;
    if(CFile::Stat(strFileA, &data) == 0)
      time += data.st_size;
  }

  fileOperations.push_back(CFileOperation(action, strFileA, strFileB, time));

  totalTime += time;

  return true;
}
开发者ID:AaronDnz,项目名称:xbmc,代码行数:17,代码来源:FileOperationJob.cpp


注:本文中的FileOperationList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。