コード例 #1
0
ファイル: IVACloud.cpp プロジェクト: Venvy-dev/OBS
void IVACloud::UpdateSettings()
{
//	if (g_pCloudData->m_bLogin == 0)
    //	return;

    if (g_pCloudData->m_bLogin == 0)
        m_nIndex = -1;
    else
        m_nIndex = data->GetInt(TEXT("SelIndex"));

    std::string strPath;
    std::wstring wstrPath;
    if (m_nIndex >= 0)
    {
        strPath = g_pCloudData->m_vIPicDesc[m_nIndex].strFileName;
        StringToWString(strPath, wstrPath);
    }
    else
        wstrPath = GetLoginJpgStr();

    bitmapImage.SetPath(wstrPath.c_str());
    bitmapImage.EnableFileMonitor(data->GetInt(TEXT("monitor"), 0) == 1);
    bitmapImage.Init();

    m_nStartTime = API->GetTotalStreamTime();

    AppWarning(TEXT("UpdateSettings %d"), API->GetTotalStreamTime());

}
コード例 #2
0
ファイル: XConfig.cpp プロジェクト: SeargeDP/OBS
XElement* XElement::GetElementByItem(CTSTR lpName, CTSTR lpItemName, CTSTR lpItemValue) const
{
    assert(lpItemName);
    assert(lpItemValue);

    if(lpName)
    {
        for(DWORD i=0; i<SubItems.Num(); i++)
        {
            if(!SubItems[i]->IsElement()) continue;

            XElement *element = static_cast<XElement*>(SubItems[i]);
            if(element->strName.CompareI(lpName))
            {
                if(scmpi(element->GetString(lpItemName), lpItemValue) == 0)
                    return element;
            }
        }
    }
    else
    {
        for(DWORD i=0; i<SubItems.Num(); i++)
        {
            if(!SubItems[i]->IsElement()) continue;

            XElement *element = static_cast<XElement*>(SubItems[i]);
            if(scmpi(element->GetString(lpItemName), lpItemValue) == 0)
                return element;
        }
    }

    return NULL;
}
コード例 #3
0
ファイル: psvplugin.cpp プロジェクト: Alucard014/OBS
void OnSceneSwitch(CTSTR scene)
{
    XElement *sceneElement;
    float desktopVolumeLevel, micVolumeLevel;
    int dMFV, mMFV;
    bool desktopMuted, micMuted;

    if(!bPSVEnabled)
        return;

    sceneElement = OBSGetSceneElement();

    if(sceneElement)
    {
        desktopVolumeLevel = sceneElement->GetFloat(TEXT("psvDesktopVolume"), 1.0f);
        micVolumeLevel = sceneElement->GetFloat(TEXT("psvMicVolume"), 1.0f);

        dMFV = sceneElement->GetInt(TEXT("psvDesktopMFV"));
        mMFV = sceneElement->GetInt(TEXT("psvMicMFV"));

        desktopMuted = (dMFV & PSV_VOL_MUTED) == PSV_VOL_MUTED;

        micMuted = (mMFV & PSV_VOL_MUTED) == PSV_VOL_MUTED;

        OBSSetDesktopVolume(desktopVolumeLevel, true);

        if(desktopMuted)
            OBSToggleDesktopMute();

        OBSSetMicVolume(micVolumeLevel, true);

        if(micMuted)
            OBSToggleMicMute();
    }
}
コード例 #4
0
ファイル: GlobalSource.cpp プロジェクト: AaronMike/OBS
ImageSource* OBS::AddGlobalSourceToScene(CTSTR lpName)
{
    XElement *globals = scenesConfig.GetElement(TEXT("global sources"));
    if(globals)
    {
        XElement *globalSourceElement = globals->GetElement(lpName);
        if(globalSourceElement)
        {
            CTSTR lpClass = globalSourceElement->GetString(TEXT("class"));
            if(lpClass)
            {
                ImageSource *newGlobalSource = CreateImageSource(lpClass, globalSourceElement->GetElement(TEXT("data")));
                if(newGlobalSource)
                {
                    App->EnterSceneMutex();

                    GlobalSourceInfo *info = globalSources.CreateNew();
                    info->strName = lpName;
                    info->element = globalSourceElement;
                    info->source = newGlobalSource;

                    info->source->BeginScene();

                    App->LeaveSceneMutex();

                    return newGlobalSource;
                }
            }
        }
    }

    AppWarning(TEXT("OBS::AddGlobalSourceToScene: Could not find global source '%s'"), lpName);
    return NULL;
}
コード例 #5
0
json_t* OBSAPIMessageHandler::HandleGetSceneList(OBSAPIMessageHandler* handler, json_t* message)
{
    OBSEnterSceneMutex();
    json_t* ret = GetOkResponse();
    XElement* xscenes = OBSGetSceneListElement();

    XElement* currentScene = OBSGetSceneElement();
    json_object_set_new(ret, "current-scene", json_string_wchar(currentScene->GetName()));

    json_t* scenes = json_array();
    if(scenes != NULL)
    {
        int numScenes = xscenes->NumElements();
        for(int i = 0; i < numScenes; i++)
        {
            XElement* scene = xscenes->GetElementByID(i);
            json_array_append_new(scenes, getSceneJson(scene));
        }
    }
    
    json_object_set_new(ret,"scenes", scenes);
    OBSLeaveSceneMutex();

    return ret;
}
コード例 #6
0
ファイル: GetCountRequest.cpp プロジェクト: marsprj/Auge.GIS
	GFilter* GetCountRequest::ParseXmlFilter(FeatureClass* pFeatureClass)
	{
		if(m_pxDoc==NULL)
		{
			return NULL;
		}

		XElement* pxRoot = m_pxDoc->GetRootNode();
		XElement* pxQuery = (XElement*)pxRoot->GetFirstChild("Query");
		if(pxQuery==NULL)
		{
			return NULL;
		}

		GFilter* pFilter = NULL;
		FilterFactory* pFilterFactory = augeGetFilterFactoryInstance();
		XElement* pxFilter = (XElement*)pxQuery->GetFirstChild("Filter");
		if(pxFilter!=NULL)
		{	
			FilterReader* reader = pFilterFactory->CreateFilerReader(pFeatureClass->GetFields());
			pFilter = reader->Read(pxFilter);
			reader->Release();
		}
		return pFilter;
	}
コード例 #7
0
ファイル: BitmapImageSource.cpp プロジェクト: asgeirom/OBS
bool STDCALL ConfigureBitmapSource(XElement *element, bool bCreating)
{
    if(!element)
    {
        AppWarning(TEXT("ConfigureBitmapSource: NULL element"));
        return false;
    }

    XElement *data = element->GetElement(TEXT("data"));
    if(!data)
        data = element->CreateElement(TEXT("data"));

    ConfigBitmapInfo configInfo;
    configInfo.data = data;

    if(DialogBoxParam(hinstMain, MAKEINTRESOURCE(IDD_CONFIGUREBITMAPSOURCE), hwndMain, ConfigureBitmapProc, (LPARAM)&configInfo) == IDOK)
    {
        CTSTR lpBitmap = data->GetString(TEXT("path"));

        D3DX10_IMAGE_INFO ii;
        if(SUCCEEDED(D3DX10GetImageInfoFromFile(lpBitmap, NULL, &ii, NULL)))
        {
            element->SetInt(TEXT("cx"), ii.Width);
            element->SetInt(TEXT("cy"), ii.Height);
        }
        else
            AppWarning(TEXT("ConfigureBitmapSource: could not get image info for bitmap '%s'"), lpBitmap);

        return true;
    }

    return false;
}
コード例 #8
0
ファイル: GlobalSource.cpp プロジェクト: AaronMike/OBS
XElement* OBS::GetGlobalSourceElement(CTSTR lpName)
{
    XElement *globals = scenesConfig.GetElement(TEXT("global sources"));
    if(globals)
        return globals->GetElement(lpName);

    return NULL;
}
コード例 #9
0
ファイル: DWConfig.cpp プロジェクト: mydw/mydw
std::vector<std::string> DWConfig::getValueVect(std::string name)
{
	std::vector<std::string> result;
	if(name == "" || this->xelement_ == NULL)
	{
		return result;
	}

	std::string tempstr = name;
	XElement * tmpel = xelement_;
	XElementList* li1 = NULL;  
	if(tempstr.find_first_of(".")>=0)
	{
		tempstr= tempstr.substr(tempstr.find_first_of(".")+1,tempstr.length());
		while(tempstr.length()>0)
		{   
			li1 = tmpel->getChildNodes();
			if(li1 == NULL)
			{
				break;
			}		
			tmpel =  li1->getElement(tempstr.substr(0,tempstr.find_first_of(".")));			
			if(tmpel == NULL)
			{
				break;		
			}
			int idx = tempstr.find_first_of(".");
			if(idx >= 0)
			{
				tempstr = tempstr.substr(idx+1,tempstr.length());
			}
			else
			{
				tempstr ="";
			}		
		}
	}
	

	if(tmpel!=NULL)
	{
		XElementList* li = tmpel->getChildNodes();
		if(tmpel->hasChildNodes())
		{
			for(int i=1;i<=li->getLength();i++)
			{
				result.push_back(li->item(i)->getNodeName());
			}
		}
		else
		{
			result.push_back(tmpel->getNodeValue());
		}
	}

	return result;
}
コード例 #10
0
ファイル: XConfig.cpp プロジェクト: CasperGemini/OBS
XElement* XElement::CopyElement(XElement* element, CTSTR lpNewName)
{
   assert(lpNewName);
   assert(element);

   XElement *newElement = new XElement(file, this, lpNewName);

   newElement->NewElementCopy(element, true);

   SubItems << newElement;

   return newElement;
}
コード例 #11
0
ファイル: OBS.cpp プロジェクト: SeargeDP/OBS
void OBS::CheckSources()
{
    XElement *curSceneElement = App->sceneElement;
    XElement *sources = curSceneElement->GetElement(TEXT("sources"));

    if(!sources)
        return;

    HWND hwndSources = GetDlgItem(hwndMain, ID_SOURCES);

    UINT numSources = ListView_GetItemCount(hwndSources);
    for(UINT i = 0; i < numSources; i++)
    {
        bool checked = ListView_GetCheckState(hwndSources, i) > 0;
        XElement *source =sources->GetElementByID(i);
        bool curRender = source->GetInt(TEXT("render"), 0) > 0;
        if(curRender != checked)
        {
            source->SetInt(TEXT("render"), (checked)?1:0);
            if(scene && i < scene->NumSceneItems())
            {
                SceneItem *sceneItem = scene->GetSceneItem(i);
                sceneItem->bRender = checked;
                sceneItem->SetRender(checked);
            }
            ReportSourceChanged(source->GetName(), source);
        }
    }
}
コード例 #12
0
	void GetSymbolResponse::WriteSymbol(XDocument* pxDoc)
	{
		XElement  *pxNode = NULL;
		XElement  *pxRoot = NULL;
		char str[AUGE_MSG_MAX];

		pxRoot = pxDoc->CreateRootNode("Symbols", NULL, NULL);
		//pxRoot->SetNamespaceDeclaration("http://www.opengis.net/wms",NULL);
		pxRoot->SetNamespaceDeclaration("http://www.w3.org/1999/xlink","xlink");
		//pxRoot->SetNamespaceDeclaration("http://www.w3.org/2001/XMLSchema-instance","xsi");
		//pxRoot->SetAttribute("version", "1.0.0", NULL);

		Symbol* pSymbol = m_pSymbol;
		AddSymbolNode(pxRoot, pSymbol);
	}
コード例 #13
0
ファイル: GlobalSource.cpp プロジェクト: AaronMike/OBS
void OBS::GetGlobalSourceNames(List<CTSTR> &globalSourceNames)
{
    globalSourceNames.Clear();

    XElement *globals = scenesConfig.GetElement(TEXT("global sources"));
    if(globals)
    {
        UINT numSources = globals->NumElements();
        for(UINT i=0; i<numSources; i++)
        {
            XElement *sourceElement = globals->GetElementByID(i);
            globalSourceNames << sourceElement->GetName();
        }
    }
}
コード例 #14
0
	void GetSymbolResponse::WriteSymbols(XDocument* pxDoc)
	{
		GLogger* pLogger = augeGetLoggerInstance();

		XElement	*pxNode = NULL;
		XElement	*pxRoot = pxDoc->CreateRootNode("Symbols", NULL, NULL);
		pxRoot->SetNamespaceDeclaration("http://www.w3.org/1999/xlink","xlink");

		Symbol		*pSymbol = NULL;
		m_pSymbols->Reset();
		while((pSymbol=m_pSymbols->Next())!=NULL)
		{
			AddSymbolNode(pxRoot, pSymbol);
		}
	}
コード例 #15
0
ファイル: psvplugin.cpp プロジェクト: Alucard014/OBS
void OnDesktopVolumeChanged(float level, bool muted, bool finalValue)
{
    XElement *sceneElement;

    if(!bPSVEnabled)
        return;

    sceneElement = OBSGetSceneElement();

    if(sceneElement)
    {
        if(!muted)
            sceneElement->SetFloat(TEXT("psvDesktopVolume"), level);

        sceneElement->SetInt(TEXT("psvDesktopMFV"), muted ? PSV_VOL_MUTED : 0);
    }
}
コード例 #16
0
ファイル: WProcessEngine.cpp プロジェクト: marsprj/Auge.GIS
	WebRequest*	WProcessEngine::ParseRequest(XDocument* pxDoc, const char* mapName)
	{
		XElement	*pxRoot = pxDoc->GetRootNode();
		const char* request = pxRoot->GetName();

		WebHandler* handler = GetHandler(request);
		if(handler == NULL)
		{
			char msg[AUGE_MSG_MAX];
			g_sprintf(msg, "%s doesn't support request [%s]", GetType(), request);
			GLogger* pLogger = augeGetLoggerInstance();
			pLogger->Error(msg, __FILE__, __LINE__);
			GError* pError = augeGetErrorInstance();
			pError->SetError(msg);

			return NULL;
		}
		return handler->ParseRequest(pxDoc, mapName);
	}
コード例 #17
0
ファイル: Service.cpp プロジェクト: 373137461/OBS
std::pair<std::unique_ptr<XConfig>, XElement*> LoadService(const ServiceIdentifier& sid, String *failReason)
{
    auto fail = [&](CTSTR reason)
    {
        if (failReason)
            *failReason = reason;
        return make_pair(std::unique_ptr<XConfig>(), nullptr);
    };

    auto serverData = make_unique<XConfig>();

    if (sid.file.IsEmpty())
    {
        if (!serverData->Open(FormattedString(L"%s\\services.xconfig", API->GetAppPath())))
            return fail(L"Could not open services.xconfig");

        XElement *services = serverData->GetElement(TEXT("services"));
        if (!services)
            return fail(L"Could not find any services in services.xconfig");

        XElement *service = NULL;
        auto numServices = services->NumElements();
        for (decltype(numServices) i = 0; i < numServices; i++)
        {
            XElement *curService = services->GetElementByID(i);
            if (!curService)
                continue;

            if (curService->GetInt(L"id") == sid.id)
                return { move(serverData), curService };
        }
    }
    else
    {
        if (serverData->Open(FormattedString(L"%s/services/%s", API->GetAppDataPath(), sid.file.Array())))
            return { move(serverData), serverData->GetElementByID(sid.id) };
        else
            return fail(FormattedString(L"Could not open service file '%s'", sid.file.Array()));
    }

    return make_pair(std::unique_ptr<XConfig>(), nullptr);
}
コード例 #18
0
void WebSocketOBSTriggerHandler::SourceOrderChanged()
{
    json_t* update = json_object();
    json_object_set_new(update, "update-type", json_string("SourceOrderChanged"));

    XElement* xsources = OBSGetSceneElement()->GetElement(TEXT("sources"));
    
    json_t* sources = json_array();
    for(UINT i = 0; i < xsources->NumElements(); i++)
    {
        XElement* source = xsources->GetElementByID(i);

        json_array_append_new(sources, json_string_wchar(source->GetName()));
    }

    json_object_set_new(update, "sources", sources);

    OSEnterMutex(this->updateQueueMutex);
    this->updates.Add(update);
    OSLeaveMutex(this->updateQueueMutex);
}
コード例 #19
0
void WebSocketOBSTriggerHandler::SourcesAddedOrRemoved()
{
    json_t* update = json_object();
    json_object_set_new(update, "update-type", json_string("RepopulateSources"));

    XElement* xsources = OBSGetSceneElement()->GetElement(TEXT("sources"));
    
    json_t* sources = json_array();
    for(UINT i = 0; i < xsources->NumElements(); i++)
    {
        XElement* source = xsources->GetElementByID(i);

        json_array_append_new(sources, getSourceJson(source));
    }

    json_object_set_new(update, "sources", sources);

    OSEnterMutex(this->updateQueueMutex);
    this->updates.Add(update);
    OSLeaveMutex(this->updateQueueMutex);
}
コード例 #20
0
ファイル: Service.cpp プロジェクト: 373137461/OBS
static inline void LoadBuiltinServices(vector<ServiceIdentifier> &services_)
{
    XConfig serverData;
    if (serverData.Open(FormattedString(L"%s\\services.xconfig", API->GetAppPath())))
    {
        XElement *services = serverData.GetElement(TEXT("services"));
        if (services)
        {
            auto numServices = services->NumElements();

            for (decltype(numServices) i = 0; i < numServices; i++)
            {
                auto service = services->GetElementByID(i);
                if (!service)
                    continue;

                services_.emplace_back(service->GetInt(L"id"), String());
            }
        }
    }
}
コード例 #21
0
json_t* getSceneJson(XElement* scene)
{
    XElement* sources = scene->GetElement(TEXT("sources"));
    json_t* ret = json_object();
    json_t* scene_items = json_array();
    json_object_set_new(ret, "name", json_string_wchar(scene->GetName()));

    if(sources != NULL)
    {
        for(UINT i = 0; i < sources->NumElements(); i++)
        {
            XElement* source = sources->GetElementByID(i);
            
            json_array_append(scene_items, getSourceJson(source));
        }
    }

    json_object_set_new(ret, "sources", scene_items);

    return ret;
}
コード例 #22
0
	void GetDataSourceResponse::AddDataSourceNode(XElement* pxRoot, Workspace* pWorkspace)
	{
		XElement	*pxNode = NULL;
		XElement	*pxDataSource  = NULL;

		pxDataSource = pxRoot->AddChild("DataSource", NULL);

		pxNode = pxDataSource->AddChild("Name");
		pxNode->AddChildText(pWorkspace->GetName());
		pxNode = pxDataSource->AddChild("Engine");
		pxNode->AddChildText(pWorkspace->GetEngine()->GetID());
		pxNode = pxDataSource->AddChild("ConnectionString");
		pxNode->AddChildText(pWorkspace->GetConnectionString());
	}
コード例 #23
0
ファイル: IVACloud.cpp プロジェクト: Venvy-dev/OBS
bool STDCALL ConfigureCloudSource(XElement *element, bool bCreating)
{
    if (!element)
    {
        AppWarning(TEXT("ConfigureIVASource: NULL element"));
        return false;
    }

    XElement *data = element->GetElement(TEXT("data"));
    if (!data)
        data = element->CreateElement(TEXT("data"));

    ConfigIVAInfo configInfo;
    configInfo.data = data;

    if (OBSDialogBox(hinstMain, MAKEINTRESOURCE(IDD_IVACLOUD), API->GetMainWindow(), IVACloudProc, (LPARAM)&configInfo) == IDOK)
    {
        int nIndex = data->GetInt(TEXT("SelIndex"));

        std::string strPath = g_pCloudData->m_vIPicDesc[nIndex].strFileName;
        std::wstring wstrPath;
        StringToWString(strPath, wstrPath);

        CTSTR lpBitmap = wstrPath.c_str();

        D3DX10_IMAGE_INFO ii;
        if (SUCCEEDED(D3DX10GetImageInfoFromFile(lpBitmap, NULL, &ii, NULL)))
        {
            element->SetInt(TEXT("cx"), ii.Width);
            element->SetInt(TEXT("cy"), ii.Height);
        }
        else
            AppWarning(TEXT("ConfigureBitmapSource: could not get image info for bitmap '%s'"), lpBitmap);

        return true;
    }

    return false;
}
コード例 #24
0
ファイル: XConfig.cpp プロジェクト: CasperGemini/OBS
XElement* XElement::NewElementCopy(XElement* element, bool bSelfAsRoot)
{
   XElement *newElement = NULL;
   
   if (bSelfAsRoot) {
        newElement = this;
   } else {
        newElement = new XElement(this->file, this, element->strName);
   }

   for(DWORD i=0; i < element->SubItems.Num(); i++)
   {
        XBaseItem *sub = element->SubItems[i];
        if (sub->GetType() == XConfig_Data) {
           XDataItem *subdata = static_cast<XDataItem *>(sub);
           newElement->SubItems << new XDataItem(subdata->strName, subdata->strData);
        } else {
           newElement->SubItems << newElement->NewElementCopy( static_cast<XElement *>(sub), false );
        }
   }

   return newElement;
}
コード例 #25
0
ファイル: Service.cpp プロジェクト: 373137461/OBS
static inline bool EnumerateBuiltinServices(function<bool(ServiceIdentifier, XElement*)> &func)
{

    XConfig serverData;
    if (serverData.Open(FormattedString(L"%s\\services.xconfig", API->GetAppPath())))
    {
        XElement *services = serverData.GetElement(TEXT("services"));
        if (services)
        {
            auto numServices = services->NumElements();

            for (decltype(numServices) i = 0; i < numServices; i++)
            {
                auto service = services->GetElementByID(i);
                if (!service)
                    continue;

                if (!func({ service->GetInt(L"id"), String() }, service))
                    return false;
            }
        }
    }
    return true;
}
コード例 #26
0
	void GetSymbolResponse::AddSymbolNode(XElement* pxParent, Symbol* pSymbol)
	{
		XElement *pxSymbol  = pxParent->AddChild("Symbol", NULL);
		XElement *pxName = pxSymbol->AddChild("Name");
		pxName->AddChildText(pSymbol->GetName(), true);
		
		const char* icon_name = pSymbol->GetIcon();
		//icon_name = pSymbol->GetIcon();
		char icon_xlink[AUGE_PATH_MAX];
		memset(icon_xlink, 0, AUGE_PATH_MAX);
		g_sprintf(icon_xlink,"http://%s:%s/%s/symbol/%s", m_pWebContext->GetServer(), m_pWebContext->GetPort(), AUGE_VIRTUAL_NAME, icon_name);
		XElement *pxIcon = pxSymbol->AddChild("Icon", NULL);
		pxIcon->SetAttribute("xlink:href",icon_xlink, NULL);
	}
コード例 #27
0
ファイル: BitmapImageSource.cpp プロジェクト: asgeirom/OBS
    void UpdateSettings()
    {
        bitmapImage.SetPath(data->GetString(TEXT("path")));
        bitmapImage.EnableFileMonitor(data->GetInt(TEXT("monitor"), 0) == 1);
        bitmapImage.Init();

        //------------------------------------

        opacity = data->GetInt(TEXT("opacity"), 100);
        color = data->GetInt(TEXT("color"), 0xFFFFFFFF);
        if(opacity > 100)
            opacity = 100;

        bool bNewUseColorKey = data->GetInt(TEXT("useColorKey"), 0) != 0;
        keyColor        = data->GetInt(TEXT("keyColor"), 0xFFFFFFFF);
        keySimilarity   = data->GetInt(TEXT("keySimilarity"), 10);
        keyBlend        = data->GetInt(TEXT("keyBlend"), 0);

        bUseColorKey = bNewUseColorKey;
    }
コード例 #28
0
ファイル: GetCountRequest.cpp プロジェクト: marsprj/Auge.GIS
	bool GetCountRequest::Create(XDocument* pxDoc)
	{
		XElement	*pxRoot = NULL;
		XAttribute	*pxAttr = NULL;

		m_pxDoc = pxDoc;

		pxRoot = pxDoc->GetRootNode();
		pxAttr = pxRoot->GetAttribute("version");
		if(pxAttr!=NULL)
		{
			SetVersion(pxAttr->GetValue());
		}

		pxAttr = pxRoot->GetAttribute("mapName");
		if(pxAttr!=NULL)
		{
			SetMapName(pxAttr->GetValue(),false);
		}

		pxAttr = pxRoot->GetAttribute("sourceName");
		if(pxAttr!=NULL)
		{
			SetSourceName(pxAttr->GetValue());
		}
		
		XElement* pxQuery = (XElement*)pxRoot->GetFirstChild("Query");
		if(pxQuery==NULL)
		{
			return NULL;
		}

		pxAttr = pxQuery->GetAttribute("typeName");
		if(pxAttr==NULL)
		{
			return false;
		}
		SetTypeName(pxAttr->GetValue(),false);
		if(m_type_name.empty())
		{
			return false;
		}

		return true;
	}
コード例 #29
0
ServerPingSettings::ServerPingSettings() : SettingsPane()
{
	// class privates
	pingers = new List<Pinger *>();
	InitializeCriticalSection(&pingerMutex);

	// service
	
	UINT serviceCount;
	XConfig serverData;
	
	if(serverData.Open(TEXT("services.xconfig")))
    {
        XElement *services = serverData.GetElement(TEXT("services"));
        if(services) {
            serviceCount = services->NumElements();

            for(UINT i = 0; i < serviceCount; i++) {
                XElement *service = services->GetElementByID(i);
				if (service) {
					XElement *servers = service->GetElement(TEXT("servers"));
					if(servers) {
						UINT numServers = servers->NumDataItems();
						for(UINT i=0; i<numServers; i++) {
							XDataItem *server = servers->GetDataItemByID(i);
							if (server) {
								pingers->Add(new Pinger(service, server));
							}
						}
					}
				}
            }
        }
    }
	serverData.Close();

    hThread = 0;
}
コード例 #30
0
ファイル: GlobalSource.cpp プロジェクト: AaronMike/OBS
bool STDCALL OBS::ConfigGlobalSource(XElement *element, bool bCreating)
{
    XElement *data = element->GetElement(TEXT("data"));
    CTSTR lpGlobalSourceName = data->GetString(TEXT("name"));

    XElement *globalSources = App->scenesConfig.GetElement(TEXT("global sources"));
    if(!globalSources) //shouldn't happen
        return false;

    XElement *globalSourceElement = globalSources->GetElement(lpGlobalSourceName);
    if(!globalSourceElement) //shouldn't happen
        return false;

    CTSTR lpClass = globalSourceElement->GetString(TEXT("class"));

    ClassInfo *classInfo = App->GetImageSourceClass(lpClass);
    if(!classInfo) //shouldn't happen
        return false;

    if(classInfo->configProc)
    {
        if(!classInfo->configProc(globalSourceElement, bCreating))
            return false;

        element->SetInt(TEXT("cx"), globalSourceElement->GetInt(TEXT("cx")));
        element->SetInt(TEXT("cy"), globalSourceElement->GetInt(TEXT("cy")));

        if(App->bRunning)
        {
            for(UINT i=0; i<App->globalSources.Num(); i++)
            {
                GlobalSourceInfo &info = App->globalSources[i];
                if(info.strName.CompareI(lpGlobalSourceName) && info.source)
                {
                    info.source->UpdateSettings();
                    break;
                }
            }
        }
    }

    return true;
}