//---------------------------------------------------------------------------------------
const RegistryEntry& Show::RegAddKey (const RegistryEntry& Key)  {   
	Editbox::SetName();
	if (!Editbox::GetName().size()) Editbox::ChangeName("MOVIE NAME MISSING");

	RegistryEntry test = RegistryEntry (Key, WndName); //test schedule

	if (!test.Existed())  { //if key does not already exists
		Editbox::RegAddKey (Key);//create it
		RegEntry.OpenKey (Key, WndName);
	 }

	else  { 
		int suffix = RandNumber.Generate();
		RegEntry = RegistryEntry (Key, WndName + std::string(itos(suffix))); 
		RegEntry.OpenKey (Key, WndName + std::string(itos(suffix)));    
		//else mangle the name with random number and save
	 }

	for (std::vector<Entry*>::iterator i = Entries.begin();i != Entries.end(); ++i)  {
		(*i)->SetName();
		(*i)->RegAddKey (RegEntry);
		(*i)->RegOpenKey (RegEntry,(*i)->GetName());
	 }

	return RegEntry;
 }
Пример #2
0
std::string findCygwinBin() {
    std::ostringstream os;
    os << "We failed to find Cygwin, the errors were:\n";
    typedef std::deque<RegistryEntry> RegistryEntries;
    RegistryEntries registryEntries;
    // Prefer Cygwin 1.7 over Cygwin 1.5.
    registryEntries.push_back(RegistryEntry("Software\\Cygwin\\Setup", "rootdir"));
    registryEntries.push_back(RegistryEntry("Software\\Cygnus Solutions\\Cygwin\\mounts v2\\/", "native"));
    for (RegistryEntries::const_iterator it = registryEntries.begin(), en = registryEntries.end(); it != en; ++ it) {
        RegistryEntry registryEntry = *it;
        try {
            return findCygwinBin(registryEntry);
        } catch (const std::exception& ex) {
            os << ex.what();
            os << std::endl;
        }
    }
    throw std::runtime_error(os.str());
}