Exemplo n.º 1
0
	ModeAction OnSet(User* source, Channel* channel, std::string& parameter) override
	{
		ChannelSettings settings;
		if (!ParseSettings(source, parameter, settings))
		{
			source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter,
				"Invalid repeat syntax. Syntax is: [~|*]<lines>:<sec>[:<difference>][:<backlog>]"));
			return MODEACTION_DENY;
		}

		if ((settings.Backlog > 0) && (settings.Lines > settings.Backlog))
		{
			source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter,
				"Invalid repeat syntax. You can't set lines higher than backlog."));
			return MODEACTION_DENY;
		}

		LocalUser* localsource = IS_LOCAL(source);
		if ((localsource) && (!ValidateSettings(localsource, channel, parameter, settings)))
			return MODEACTION_DENY;

		ext.set(channel, settings);

		return MODEACTION_ALLOW;
	}
Exemplo n.º 2
0
BOOL
LoadRdpSettingsFromFile(PRDPSETTINGS pRdpSettings,
                        LPWSTR lpFile)
{
    WCHAR pszPath[MAX_PATH];
    HANDLE hFile;
    BOOL bRet = FALSE;

    /* use default file */
    if (lpFile == NULL)
    {
        HRESULT hr;
        LPITEMIDLIST lpidl= NULL;

        hr = SHGetFolderLocation(NULL,
                                 CSIDL_PERSONAL,
                                 NULL,
                                 0,
                                 &lpidl);
        if (hr == S_OK)
        {
            if (SHGetPathFromIDListW(lpidl, pszPath))
            {
                wcscat(pszPath, L"\\Default.rdp");
                lpFile = pszPath;
                CoTaskMemFree(lpidl);
            }
        }
    }

    if (lpFile)
    {
        LPWSTR lpBuffer = NULL;

        hFile = OpenRdpFile(lpFile, FALSE);
        if (hFile)
        {
            lpBuffer = ReadRdpFile(hFile);
            if (lpBuffer)
            {
                ParseSettings(pRdpSettings, lpBuffer);

                HeapFree(GetProcessHeap(),
                         0,
                         lpBuffer);
                
                bRet = TRUE;
            }

            CloseRdpFile(hFile);
        }
    }

    return bRet;
}
Exemplo n.º 3
0
//
// TFolderBackup
//
TFolderBackup::TFolderBackup(const TStr& SettingsFNm, const bool& _ReportP)
{
    ReportP = _ReportP;
    if (!TFile::Exists(SettingsFNm)) {
        TNotify::StdNotify->OnStatusFmt("Unable to load settings file name for TBackupData. File %s is missing.", SettingsFNm.CStr());
        return;
    }
    TStr JsonData = TStr::LoadTxt(SettingsFNm);
    PJsonVal SettingsJson = TJsonVal::GetValFromStr(JsonData);
    ParseSettings(SettingsJson);
}
Exemplo n.º 4
0
void CConfigLog::ReadLogFile(const String & Filepath)
{
	CloseFile();

	bool writing = false;
	String sError;
	m_pCfgSettings = new CfgSettings;
	if (!ParseSettings(Filepath))
		return;
	DoFile(writing, sError);
}
Exemplo n.º 5
0
CoExtender::CoExtender(void)
{
	// COM
	m_refCount = 0;
	g_objCount++;

	m_pVCAConfig		= NULL;

	m_eVideoType		= VIDEO_NULL;
	m_pStreamer			= NULL;

	m_pMetaBuf = new unsigned char[METABUF_SIZE];
	m_pConfigBuf = new char[ CONFIGBUF_SIZE ];

	memset( m_pMetaBuf, 0, METABUF_SIZE );
	memset( m_pConfigBuf, 0, CONFIGBUF_SIZE );
	memset( m_sLicense, 0, MAX_LICENSE_LEN );

	m_bVideo = FALSE;
	m_bMeta = FALSE;

	m_uiConfigLen = 0;

	// Set up the DOM
	HRESULT hr;
	hr = m_pDOMDoc.CreateInstance(__uuidof(MSXML2::DOMDocument60));
	if(S_OK != hr)
	{
		MessageBox(NULL, _T("Can not Create XMLDOMDocument Install MSXML4.0"), _T("ERROR") ,MB_OK | MB_ICONERROR);
	}

	ParseSettings();

	LoadConfig();

	switch( m_eVideoType )
	{
		case VIDEO_DSHOW:	m_pStreamer = new DShowStreamer( m_sVideoData );	break;
		case VIDEO_VLC:		m_pStreamer = new VLCStreamer( );					break;
		case VIDEO_CAP5:	m_pStreamer = new CAP5Streamer( m_sVideoData );		break;
		default: ASSERT( FALSE );
	}

	if( VIDEO_CAP5 == m_eVideoType && !m_bVideo )
	{
		AfxMessageBox( _T("Since CAP5 cannot be accessed from Extender DLL and ConfigApp simultaneously, both video and metadata must be generated in Extender DLL.\nThis setting will be updated internally (both video and metadata will be generated inside Extender DLL and not in ConfigApp).") );
		m_bVideo = TRUE;
	}
}
Exemplo n.º 6
0
/*
================
idDeclAF::Parse
================
*/
bool idDeclAF::Parse( const char *text, const int textLength ) {
	int i, j;
	idLexer src;
	idToken token;

	src.LoadMemory( text, textLength, GetFileName(), GetLineNum() );
	src.SetFlags( DECL_LEXER_FLAGS );
	src.SkipUntilString( "{" );

	while( src.ReadToken( &token ) ) {

		if ( !token.Icmp( "settings" ) ) {
			if ( !ParseSettings( src ) ) {
				return false;
			}
		} else if ( !token.Icmp( "body" ) ) {
			if ( !ParseBody( src ) ) {
				return false;
			}
		} else if ( !token.Icmp( "fixed" ) ) {
			if ( !ParseFixed( src ) ) {
				return false;
			}
		} else if ( !token.Icmp( "ballAndSocketJoint" ) ) {
			if ( !ParseBallAndSocketJoint( src ) ) {
				return false;
			}
		} else if ( !token.Icmp( "universalJoint" ) ) {
			if ( !ParseUniversalJoint( src ) ) {
				return false;
			}
		} else if ( !token.Icmp( "hinge" ) ) {
			if ( !ParseHinge( src ) ) {
				return false;
			}
		} else if ( !token.Icmp( "slider" ) ) {
			if ( !ParseSlider( src ) ) {
				return false;
			}
		} else if ( !token.Icmp( "spring" ) ) {
			if ( !ParseSpring( src ) ) {
				return false;
			}
		} else if ( token == "}" ) {
			break;
		} else {
			src.Error( "unknown keyword %s", token.c_str() );
			return false;
		}
	}

	for ( i = 0; i < bodies.Num(); i++ ) {
		// check for multiple bodies with the same name
		for ( j = i+1; j < bodies.Num(); j++ ) {
			if ( bodies[i]->name == bodies[j]->name ) {
				src.Error( "two bodies with the same name \"%s\"", bodies[i]->name.c_str() );
			}
		}
	}

	for ( i = 0; i < constraints.Num(); i++ ) {
		// check for multiple constraints with the same name
		for ( j = i+1; j < constraints.Num(); j++ ) {
			if ( constraints[i]->name == constraints[j]->name ) {
				src.Error( "two constraints with the same name \"%s\"", constraints[i]->name.c_str() );
			}
		}
		// check if there are two valid bodies set
		if ( constraints[i]->body1 == "" ) {
			src.Error( "no valid body1 specified for constraint '%s'", constraints[i]->name.c_str() );
		}
		if ( constraints[i]->body2 == "" ) {
			src.Error( "no valid body2 specified for constraint '%s'", constraints[i]->name.c_str() );
		}
	}

	// make sure the body which modifies the origin comes first
	for ( i = 0; i < bodies.Num(); i++ ) {
		if ( bodies[i]->jointName == "origin" ) {
			if ( i != 0 ) {
				idDeclAF_Body *b = bodies[0];
				bodies[0] = bodies[i];
				bodies[i] = b;
			}
			break;
		}
	}

	return true;
}
Exemplo n.º 7
0
TFolderBackup::TFolderBackup(const PJsonVal& SettingsJson, const bool& _ReportP)
{
    ReportP = _ReportP;
    ParseSettings(SettingsJson);
}
Exemplo n.º 8
0
bool MesenMovie::Play(VirtualFile &file)
{
	_movieFile = file;

	std::stringstream ss;
	file.ReadFile(ss);

	_reader.reset(new ZipReader());
	_reader->LoadArchive(ss);

	stringstream settingsData, inputData;
	if(!_reader->GetStream("GameSettings.txt", settingsData)) {
		MessageManager::Log("[Movie] File not found: GameSettings.txt");
		return false;
	}
	if(!_reader->GetStream("Input.txt", inputData)) {
		MessageManager::Log("[Movie] File not found: Input.txt");
		return false;
	}

	while(inputData) {
		string line;
		std::getline(inputData, line);
		if(line.substr(0, 1) == "|") {
			_inputData.push_back(StringUtilities::Split(line.substr(1), '|'));
		}
	}

	_deviceIndex = 0;

	ParseSettings(settingsData);
	
	Console::Pause();
		
	BatteryManager::SetBatteryProvider(shared_from_this());
	ControlManager::RegisterInputProvider(this);
	ApplySettings();

	//Disable auto-configure input option (otherwise the movie file's input types are ignored)
	bool autoConfigureInput = EmulationSettings::CheckFlag(EmulationFlags::AutoConfigureInput);
	EmulationSettings::ClearFlags(EmulationFlags::AutoConfigureInput);
	ControlManager::ResetPollCounter();
	bool gameLoaded = LoadGame();
	EmulationSettings::SetFlagState(EmulationFlags::AutoConfigureInput, autoConfigureInput);

	if(!gameLoaded) {
		Console::Resume();
		return false;
	}

	stringstream saveStateData;
	if(_reader->GetStream("SaveState.mst", saveStateData)) {
		if(!SaveStateManager::LoadState(saveStateData, true)) {
			Console::Resume();
			return false;
		} else {
			ControlManager::ResetPollCounter();
		}
	}

	_playing = true;

	Console::Resume();

	return true;
}
Exemplo n.º 9
0
void CSm3ReadMap::Initialize (const char *mapname)
{
	try {
		string lmsg = "Loading " + string(mapname);
		PrintLoadMsg(lmsg.c_str());
		int tu;
		glGetIntegerv(GL_MAX_TEXTURE_UNITS, &tu);

		renderer = new terrain::Terrain;
		
		renderer->config.cacheTextures=false;

		renderer->config.forceFallbackTexturing = !!configHandler.GetInt("SM3ForceFallbackTex", 0);

		if (!renderer->config.forceFallbackTexturing && GLEW_ARB_fragment_shader && GLEW_ARB_shading_language_100) {
			renderer->config.useBumpMaps = true;
			renderer->config.anisotropicFiltering = 0.0f;
		} else
			renderer->config.useStaticShadow = true;

		renderer->config.terrainNormalMaps = false;
		renderer->config.normalMapLevel = 3;

		if (shadowHandler->drawShadows)
			renderer->config.useShadowMaps = true;

		// Load map info from TDF
		std::string fn = std::string("maps/") + mapname;
		mapDefParser.LoadFile (fn);
		TdfParser resources("gamedata/resources.tdf");
		ParseSettings(resources);

		string minimap = mapDefParser.SGetValueDef(string(),"map\\minimap");
		if (!minimap.empty()) {
			CBitmap bmp;
			if(bmp.Load(minimap)) 
				minimapTexture=bmp.CreateTexture(true);
		}

		int numStages=atoi(mapDefParser.SGetValueDef("0", "map\\terrain\\numtexturestages").c_str());
		int maxStages=configHandler.GetInt("SM3MaxTextureStages", 10);
		if (numStages > maxStages) {
			renderer->config.cacheTextures = true; 
			renderer->config.cacheTextureSize = 256;
		}
		
		Sm3LoadCB loadcb;
		terrain::LightingInfo lightInfo;
		lightInfo.ambient = ambientColor;
		terrain::StaticLight light;
		light.color = sunColor;
		light.directional = false;
		light.position = gs->sunVector *1000000;
		lightInfo.staticLights.push_back (light);
		renderer->Load (mapDefParser, &lightInfo, &loadcb);

		height = width = renderer->GetHeightmapWidth ()-1;

		// Set global map info
		gs->mapx=width;
		gs->mapy=height;
		gs->mapSquares = width*height;
		gs->hmapx=width/2;
		gs->hmapy=height/2;
		gs->pwr2mapx=next_power_of_2(width);
		gs->pwr2mapy=next_power_of_2(height);

		float3::maxxpos=width*SQUARE_SIZE-1;
		float3::maxzpos=height*SQUARE_SIZE-1;

		CalcHeightfieldData();

		if (mapDefParser.SectionExist("map\\featuretypes")) {
			int numTypes = atoi(mapDefParser.SGetValueDef("0", "map\\featuretypes\\numtypes").c_str());
			for (int a=0;a<numTypes;a++) {
				char loc[40];
				SNPRINTF(loc, 16, "map\\featuretypes\\type%d", a);
				featureTypes.push_back (new std::string(mapDefParser.SGetValueDef("TreeType0", loc)));
			}
		}
		LoadFeatureData();

		groundDrawer = new CSm3GroundDrawer (this);
	}
	catch(content_error& e)
	{
		ErrorMessageBox(e.what(), "Error:", MBF_OK);
	}
}