Esempio n. 1
0
void LoadLocaleMPQFiles(int const locale)
{
    char filename[512];

    // first base old version of dbc files
    sprintf(filename, "%s/Data/%s/locale-%s.MPQ", input_path, langs[locale], langs[locale]);

    HANDLE localeMpqHandle;

    if (!OpenArchive(filename, &localeMpqHandle))
    {
        printf("Error open archive: %s\n\n", filename);
        return;
    }

    // prepare sorted list patches in locale dir and Data root
    Updates updates;
    // now update to newer view, locale
    AppendPatchMPQFilesToList(langs[locale], langs[locale], NULL, updates);
    // now update to newer view, root
    AppendPatchMPQFilesToList(NULL, NULL, langs[locale], updates);

    for (Updates::const_iterator itr = updates.begin(); itr != updates.end(); ++itr)
    {
        if (!itr->second.second)
            sprintf(filename, "%s/Data/%s/%s", input_path, langs[locale], itr->second.first.c_str());
        else
            sprintf(filename, "%s/Data/%s", input_path, itr->second.first.c_str());

        //if (!OpenArchive(filename))
        if (!SFileOpenPatchArchive(localeMpqHandle, filename, itr->second.second ? itr->second.second : "", 0))
            printf("Error open patch archive: %s\n\n", filename);
    }
}
Esempio n. 2
0
		void pushUpdate(const DataPackage& p) {
			NodeMap::iterator f = nodeMap.find(p.node.get());
			if(f != nodeMap.end()) {
				*f->second = p;
			}
			else {
				updates.push_back(p);
				Updates::iterator& last = nodeMap[p.node.get()] = updates.end(); --last;
			}
		}
Esempio n. 3
0
  Updates
  Defaults::getLambda(std::string prefix)
  {
   Updates us; 
    if (dfs.size() > 0)  
      { 
	for (std::list<Default>::iterator i = dfs.begin(); i != dfs.end(); ++i)
	  { 
	    us.insert(i->getUpdates(prefix));
	  } 
      } 
    return us; 
  }
Esempio n. 4
0
void LoadBaseMPQFiles()
{
    char filename[512];
    HANDLE worldMpqHandle;

    printf("Loaded MPQ files for map extraction:\n");
    for (int i = 1; i <= WORLD_COUNT; i++)
    {
        sprintf(filename, "%s/Data/World%s.MPQ", input_path, (i == 2 ? "2" : ""));
        printf("%s\n", filename);

        if (!OpenArchive(filename, &worldMpqHandle))
        {
            printf("Error open archive: %s\n\n", filename);
            return;
        }
    }

    for (int i = 1; i <= EXPANSION_COUNT; i++)
    {
        sprintf(filename, "%s/Data/Expansion%i.MPQ", input_path, i);
        printf("%s\n", filename);

        if (!OpenArchive(filename, &worldMpqHandle))
        {
            printf("Error open archive: %s\n\n", filename);
            return;
        }
    }

    // prepare sorted list patches in Data root
    Updates updates;
    // now update to newer view, root -base
    AppendPatchMPQFilesToList(NULL, NULL, "base", updates);
    // now update to newer view, root -base
    AppendPatchMPQFilesToList(NULL, "base", NULL, updates);

    for (Updates::const_iterator itr = updates.begin(); itr != updates.end(); ++itr)
    {
        sprintf(filename, "%s/Data/%s", input_path, itr->second.first.c_str());

        printf("%s\n", filename);

        if (!OpenArchive(filename, &worldMpqHandle))
        {
            printf("Error open patch archive: %s\n\n", filename);
            return;
        }
    }
}
Esempio n. 5
0
void Persistent::update(Updates& updates) {
    for (Updates::iterator i = updates.begin(); i != updates.end(); i++) {
        UpdateQuery uq(i->first);
        uq.where(RawExpr(LITESQL_L("id_ = '") + toString(oldKey) +  LITESQL_L("'")));
        bool notEmpty = false;
        for (std::vector<std::pair<FieldType, LITESQL_String> >::iterator i2 =
                i->second.begin(); i2 != i->second.end();
             i2++) {
            uq.set(i2->first, i2->second);
            notEmpty = true;
        }
        if (notEmpty)
            db->query(uq);
    }
}
Esempio n. 6
0
		void remove(NetNodeIntern* node) {
			NodeMap::iterator f = nodeMap.find(node);
			if(f != nodeMap.end()) {
				updates.erase(f->second);
				nodeMap.erase(f);
			}
		}
nsresult
sbPlayQueueExternalLibraryListener::GenerateUpdates(
        sbIMediaItem* aMediaItem,
        sbIPropertyArray* aProperties,
        Updates& updates)
{
  TRACE(("%s[%p]", __FUNCTION__, this));
  nsresult rv;

  nsCOMPtr<sbILibrary> lib;
  rv = aMediaItem->GetLibrary(getter_AddRefs(lib));
  NS_ENSURE_SUCCESS(rv, rv);

  // This ensures that we have an item that is either in our master library or 
  // is duplicated in the master library.
  nsCOMPtr<sbIMediaItem> internalMediaItem;
  if (lib == mMasterLibrary) {
    internalMediaItem = aMediaItem;
  } else {
    rv = mMasterLibrary->GetDuplicate(aMediaItem,
                                        getter_AddRefs(internalMediaItem));
    NS_ENSURE_SUCCESS(rv, rv);
    if (internalMediaItem) {
      sbPropertyUpdate internalUpdate(internalMediaItem, aProperties);
      updates.push_back(internalUpdate);
    } else {
      // If we can't find a duplicate in our master library, just return.
      return NS_OK;
    }
  }

  // We found an item in our master library - go find duplicates in our external
  // libraries to update.
  for (PRInt32 i = 0; i < mExternalLibraries.Count(); i++)
  {
    if (mExternalLibraries[i] != lib) {
      nsCOMPtr<sbIMediaItem> externalMediaItem;
      rv = mExternalLibraries[i]->GetDuplicate(internalMediaItem,
                                               getter_AddRefs(externalMediaItem));
      if (NS_SUCCEEDED(rv) && externalMediaItem) {
        sbPropertyUpdate externalUpdate(externalMediaItem, aProperties);
        updates.push_back(externalUpdate);
      }
    }
  }
  return NS_OK;
}
NS_IMETHODIMP
sbPlayQueueExternalLibraryListener::OnItemUpdated(sbIMediaList* aMediaList,
                                                  sbIMediaItem* aMediaItem,
                                                  sbIPropertyArray* aProperties,
                                                  PRBool* aNoMoreForBatch)
{
  TRACE(("%s[%p]", __FUNCTION__, this));

  nsresult rv;

  Updates updates;
  sbPropertyUpdate update(aMediaItem, aProperties);
  {
    nsAutoLock lock(mUpdateLock);

    UpdateIter it;
    it = std::find(mUpdates.begin(), mUpdates.end(), update);
    if (it != mUpdates.end()) {
      // This update is already being handled.
      return NS_OK;
    }

    rv = GenerateUpdates(aMediaItem, aProperties, updates);
    NS_ENSURE_SUCCESS(rv, rv);
    if (updates.size() == 0) {
      // No duplicates to update.
      return NS_OK;
    }

    for (it = updates.begin(); it != updates.end(); it++) {
      mUpdates.push_back(*it);
    }
  }

  // Get the updated properties from the item and apply them to the items we
  // need to update.
  nsCOMPtr<sbIPropertyArray> props;
  rv = aMediaItem->GetProperties(aProperties, getter_AddRefs(props));
  NS_ENSURE_SUCCESS(rv, rv);

  for (UpdateIter it = updates.begin(); it != updates.end(); it++) {
    rv = it->mItem->SetProperties(props);
    NS_ENSURE_SUCCESS(rv, rv);
  }

  {
    nsAutoLock lock(mUpdateLock);

    for (UpdateIter it = updates.begin(); it != updates.end(); it++) {
      mUpdates.remove(*it);
    }
  }

  return NS_OK;
}
Esempio n. 9
0
/// Push all pending updates to the conditions store
void ConditionsManagerObject::pushUpdates()   {
  Updates entries;  {
    dd4hep_lock_t lock(m_updateLock);
    m_updatePool->popEntries(entries);
  }
  // Lock global pool so that no other updates happen in the meanwhile
  // which could kill the pool's containers
  dd4hep_lock_t lock(m_poolLock);
  for(Updates::const_iterator iov_iter=entries.begin(); iov_iter!=entries.end(); ++iov_iter)  {
    typedef UpdatePool::ConditionEntries _E;
    const _E& ents = (*iov_iter).second;
    if ( !ents.empty() )  {
      for(_E::const_iterator j=ents.begin(); j != ents.end(); ++j) {
        (*j)->pool->insert(*j);
      }
    }
  }
}
Esempio n. 10
0
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
  Updates updates;

  try
    {
      updates.init (argc,
                    argv);

      updates.run_test ();
    }
  catch (const CORBA::SystemException& se)
    {
      se._tao_print_exception ("Error: ");
      return 1;
    }

  return 0;
}
Esempio n. 11
0
void Persistent::prepareUpdate(Updates& updates, LITESQL_String table) {
    if (updates.find(table) == updates.end()) {
        updates[table] = std::vector<std::pair<FieldType, LITESQL_String> >();
    }
}
Esempio n. 12
0
void Persistent::prepareUpdate(Updates& updates, const string& table) {
    if (updates.find(table) == updates.end()) {
        updates[table] = vector<pair<FieldType, string> >();
    }
}
Esempio n. 13
0
void MysqLoader::versionLookUp()
{
	Updates *updates = new Updates;
	updates->exec();
}
Esempio n. 14
0
		void clear() {
			updates.clear();
			nodeMap.clear();
		}