tAppInfoList GetAllAppInfo() { std::mutex &m = GetGlobalMutex(); m.lock(); tAppInfoList copy = GetGlobalInfo(); m.unlock(); return copy; }
int LoadAsn (AsnInfo *asn) { /* Arguments: ** input i: Name of input file or image ** asn io: Association info structure */ extern int status; void printInfo (AsnInfo *); int SetInput (AsnInfo *); int SetAsnSingle (AsnInfo *); int GetAsnTable (AsnInfo *); int GetGlobalInfo (AsnInfo *); /* Determine whether input is a single file, an association table, ** or an entry from an association table. */ if (SetInput (asn)) return (status); if (asn->process == FULL) { sprintf (MsgText,"LoadAsn: Processing FULL Association"); } else if (asn->process == PARTIAL) { sprintf (MsgText,"LoadAsn: Processing PART of Association"); } else { sprintf (MsgText,"LoadAsn: Processing SINGLE exposure"); } trlmessage (MsgText); /* Read in global info from ASN table's primary header */ if (GetGlobalInfo (asn)) { trlerror (" Problem getting primary header information."); return (status); } /* Read in ASN table, and load appropriate members info into memory */ if (asn->process == SINGLE) { /* Set ASN structure values to process a single exposure */ if (SetAsnSingle (asn)) return (status); } else { if (GetAsnTable (asn)) return (status); } if (asn->debug) { sprintf (MsgText,"LoadAsn: Read in ASN table %s ", asn->asn_table); trlmessage (MsgText); } /* Print a summary of information about the association */ if (asn->verbose) printInfo (asn); return (status); }
void AppInfo::init(const char *pName, const char *pValue) { ASSERT(core::util::identifierSafe(pName) == pName); std::mutex &m = GetGlobalMutex(); LOCK_MUTEX(m); tAppInfoList &info = GetGlobalInfo(); tAppInfoList::iterator itr = std::find_if(info.begin(), info.end(), InfoFinder(pName)); if (itr == info.end()) { itr = std::find_if(info.begin(), info.end(), InfoFinder(nullptr)); ASSERT(itr != info.end()); itr->first = pName; } m_pInfoStr = &itr->second; if (pValue != nullptr) { m_pInfoStr->assign(pValue); } }
bool Plugin::LoadData() { if (WorkFlags.Check(PIWF_DONTLOADAGAIN)) return false; if (WorkFlags.Check(PIWF_DATALOADED)) return true; if (m_Instance) return true; if (!m_Instance) { string strCurPlugDiskPath; wchar_t Drive[]={0,L' ',L':',0}; //ставим 0, как признак того, что вертать обратно ненадо! const auto strCurPath = os::GetCurrentDirectory(); if (ParsePath(m_strModuleName) == PATH_DRIVELETTER) // если указан локальный путь, то... { Drive[0] = L'='; Drive[1] = m_strModuleName.front(); os::env::get_variable(Drive, strCurPlugDiskPath); } PrepareModulePath(m_strModuleName); m_Instance = m_model->Create(m_strModuleName); FarChDir(strCurPath); if (Drive[0]) // вернем ее (переменную окружения) обратно os::env::set_variable(Drive, strCurPlugDiskPath); } if (!m_Instance) { //чтоб не пытаться загрузить опять а то ошибка будет постоянно показываться. WorkFlags.Set(PIWF_DONTLOADAGAIN); if (!Global->Opt->LoadPlug.SilentLoadPlugin) //убрать в PluginSet { Message(MSG_WARNING|MSG_ERRORTYPE|MSG_NOPLUGINS, MSG(MError), make_vector<string>(MSG(MPlgLoadPluginError), m_strModuleName), make_vector<string>(MSG(MOk)), L"ErrLoadPlugin"); } return false; } WorkFlags.Clear(PIWF_CACHED); if(bPendingRemove) { bPendingRemove = false; m_model->GetOwner()->UndoRemove(this); } InitExports(); GlobalInfo Info={sizeof(Info)}; if(GetGlobalInfo(&Info) && Info.StructSize && Info.Title && *Info.Title && Info.Description && *Info.Description && Info.Author && *Info.Author) { MinFarVersion = Info.MinFarVersion; PluginVersion = Info.Version; VersionString = VersionToString(PluginVersion); strTitle = Info.Title; strDescription = Info.Description; strAuthor = Info.Author; bool ok=true; if(m_Guid != FarGuid && m_Guid != Info.Guid) { ok = m_model->GetOwner()->UpdateId(this, Info.Guid); } else { SetGuid(Info.Guid); } if (ok) { WorkFlags.Set(PIWF_DATALOADED); return true; } } Unload(); //чтоб не пытаться загрузить опять а то ошибка будет постоянно показываться. WorkFlags.Set(PIWF_DONTLOADAGAIN); return false; }