Пример #1
0
void TESTEXPORT ImportConfiguration(const std::wstring& fileName)
{
	ConfigurationFile config(fileName);
	std::wstring guid = config.GetGuid().c_str();

	Workshare::OptionApi::SetString(L"DocumentProviders", config.Name.c_str(), L"ProgID", L"Workshare.FacadeDocumentProvider");
	Workshare::OptionApi::SetString(L"DocumentProviders", config.Name.c_str(), L"ServerID", config.Prefix.c_str());
	Workshare::OptionApi::SetBool(L"DocumentProviders", config.Name.c_str(), L"Enabled", true);
	Workshare::OptionApi::SetBool(L"DocumentProviders", config.Name.c_str(), L"DMS", true);
	Workshare::OptionApi::SetString(L"DocumentProviders", config.Name.c_str(), L"ConnectorType", config.Type.c_str());

	if(0 == config.Type.compare(L"com"))
	{
		Workshare::OptionApi::SetString(L"DocumentProviders", config.Name.c_str(), _T("ConnectorProgId"), config.GetProgId().c_str());
	}
	else if(0 == config.Type.compare(L"cpp"))
	{
		Workshare::OptionApi::SetString(L"DocumentProviders", config.Name.c_str(), _T("ConnectorModule"), config.GetModlue().c_str());
	}
	else if(0 == config.Type.compare(L"net"))
	{
		wchar_t workingFolder[MAX_PATH] = {0};
		::wcscpy_s(workingFolder, config.GetWorkingFolder().c_str());
		::PathAddBackslashW(workingFolder);
		_bstr_t connectorModule(workingFolder);
		connectorModule += L"WCConnectNetAdapters.dll";
		Workshare::OptionApi::SetString(L"DocumentProviders", config.Name.c_str(), _T("ConnectorModule"), connectorModule);

		_bstr_t assemblyName(workingFolder);
		assemblyName += config.GetAssembly().c_str();
		Workshare::OptionApi::SetString(L"DocumentProviders", config.Name.c_str(), _T("ConnectorAssembly"), assemblyName);
		Workshare::OptionApi::SetString(L"DocumentProviders", config.Name.c_str(), _T("ConnectorClassName"), config.GetClass().c_str());
	}
}
	wxString OptimizationController::GetIniPathFromAssemblyPath(const wxString& assemblyPath)
	{
		wxFileName assemblyName(assemblyPath);
		auto root = assemblyName.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
		return wxString::Format(L"%s%s.ini", root, assemblyName.GetName());
	}