コード例 #1
0
ファイル: LoggerImpl.cpp プロジェクト: scottp/xcsoar
void
LoggerImpl::LoggerDeviceDeclare() {
  bool found_logger = false;
  Declaration_t Decl;
  int i;

  GetRegistryString(szRegistryPilotName, Decl.PilotName, 64);
  GetRegistryString(szRegistryAircraftType, Decl.AircraftType, 32);
  GetRegistryString(szRegistryAircraftRego, Decl.AircraftRego, 32);

  for (i = 0; task.ValidTaskPoint(i); i++) {
    Decl.waypoint[i] = &task.getWaypoint(i);
  }
  Decl.num_waypoints = i;

  DeclaredToDevice = false;

  if (LoggerDeclare(devA(), &Decl))
    found_logger = true;

  if (LoggerDeclare(devB(), &Decl))
    found_logger = true;

  if (!found_logger) {
    MessageBoxX(gettext(TEXT("No logger connected")),
		devB()->Name, MB_OK| MB_ICONINFORMATION);
    DeclaredToDevice = true; // testing only
  }

}
コード例 #2
0
ファイル: Thesaurus.cpp プロジェクト: deNULL/seman
bool CThesaurus::SetDatabase(string DatabaseName)
{
	m_bDontLoad = false;
	m_Name = DatabaseName;
	string KeyName = "Software\\Dialing\\"+m_Name+"\\DictPath";
	try {
	  m_Directory = GetRegistryString(KeyName);
	}
	catch (...)
	{
		ErrorMessage ("Cannot open" + m_Name);
        return false;
	};

	try {
	  string KeyName = "Software\\Dialing\\Thesauri\\IgnoreThesauri";
	  if (CanGetRegistryString(KeyName))
	  {
		  string Value =  GetRegistryString(KeyName);
		  m_bDontLoad =   (Value == "yes");
	  }
	}
	catch (...)
	{
	};
	
	return true;
}
コード例 #3
0
ファイル: RasterTerrain.cpp プロジェクト: bugburner/xcsoar
void RasterTerrain::OpenTerrain(void)
{
  TCHAR  szFile[MAX_PATH] = TEXT("\0");

  GetRegistryString(szRegistryTerrainFile, szFile, MAX_PATH);

  char zfilename[MAX_PATH];

  ExpandLocalPath(szFile);

  unicode2ascii(szFile, zfilename, MAX_PATH);

  if (strlen(zfilename)==0) {
    static TCHAR  szMapFile[MAX_PATH] = TEXT("\0");
    GetRegistryString(szRegistryMapFile, szMapFile, MAX_PATH);
    ExpandLocalPath(szMapFile);
    _tcscpy(szFile,szMapFile);
    _tcscat(szFile,TEXT("/terrain.jp2"));
    unicode2ascii(szFile, zfilename, MAX_PATH);
  }

  // TODO code: Check locking, especially when reloading a file.
  // TODO bug: Fix cache method

  CreateTerrainMap(zfilename);
}
コード例 #4
0
void
ReadWayPoints(WayPointList &way_points, RasterTerrain &terrain)
{
  StartupStore(TEXT("ReadWayPoints\n"));

  TCHAR szFile1[MAX_PATH] = TEXT("\0");
  TCHAR szFile2[MAX_PATH] = TEXT("\0");
  bool file_embedded = false;

  // JMW TODO protect with mutex (whole waypoint list class)

  CloseWayPoints(way_points);

  GetRegistryString(szRegistryWayPointFile, szFile1, MAX_PATH);
  SetRegistryString(szRegistryWayPointFile, TEXT("\0"));

  if (_tcslen(szFile1)>0) {
    ExpandLocalPath(szFile1);
  } else {
    file_embedded = true;
    GetRegistryString(szRegistryMapFile, szFile1, MAX_PATH);
    ExpandLocalPath(szFile1);
    _tcscat(szFile1, TEXT("/"));
    _tcscat(szFile1, TEXT("waypoints.xcw"));
  }

  globalFileNum = 0;
  if (ReadWayPointFile(szFile1, way_points, terrain)) {
    // read OK, so set the registry to the actual file name
    if (!file_embedded) {
      printf("save\n");
      ContractLocalPath(szFile1);
      SetRegistryString(szRegistryWayPointFile, szFile1);
    }
  } else {
    StartupStore(TEXT("No waypoint file 1\n"));
  }

  // read additional waypoint file

  GetRegistryString(szRegistryAdditionalWayPointFile, szFile2, MAX_PATH);

  SetRegistryString(szRegistryAdditionalWayPointFile, TEXT("\0"));

  if (_tcslen(szFile2)>0){
    ExpandLocalPath(szFile2);

    globalFileNum = 1;
    if (ReadWayPointFile(szFile2, way_points, terrain)) {
      // read OK, so set the registry to the actual file name
      ContractLocalPath(szFile2);
      SetRegistryString(szRegistryAdditionalWayPointFile, szFile2);
    } else {
      StartupStore(TEXT("No waypoint file 2\n"));
    }
  }
}
コード例 #5
0
ファイル: AirspaceGlue.cpp プロジェクト: bugburner/xcsoar
void
ReadAirspace(AirspaceDatabase &airspace_database, RasterTerrain *terrain)
{
  TCHAR tpath[MAX_PATH];

  // TODO bug: add exception handler to protect parser code against chrashes
  // TODO bug: second file should be opened even if first was not okay

  // Read the airspace filenames from the registry
  GetRegistryString(szRegistryAirspaceFile, tpath, MAX_PATH);
  if (tpath[0] != 0) {
    ExpandLocalPath(tpath);

    char path[MAX_PATH];
    unicode2ascii(tpath, path, sizeof(path));

    if (!ReadAirspace(airspace_database, path))
      StartupStore(TEXT("No airspace file 1\n"));
  } else {
    // TODO feature: airspace in xcm files should be a feature
    /*
    static TCHAR  szMapFile[MAX_PATH] = TEXT("\0");
    GetRegistryString(szRegistryMapFile, szMapFile, MAX_PATH);
    ExpandLocalPath(szMapFile);
    wcscat(szMapFile,TEXT("/"));
    wcscat(szMapFile,TEXT("airspace.txt"));
    unicode2ascii(szMapFile, zfilename, MAX_PATH);
    fp  = zzip_fopen(zfilename, "rt");
    */
  }

  GetRegistryString(szRegistryAdditionalAirspaceFile, tpath, MAX_PATH);
  if (tpath[0] != 0) {
    ExpandLocalPath(tpath);

    char path[MAX_PATH];
    unicode2ascii(tpath, path, sizeof(path));

    if (!ReadAirspace(airspace_database, path))
      StartupStore(TEXT("No airspace file 2\n"));
  }

  // Calculate the airspace boundaries
  FindAirspaceAreaBounds(airspace_database);
  FindAirspaceCircleBounds(airspace_database);

  if (terrain != NULL) {
    terrain->Lock();
    airspace_database.UpdateAGL(*terrain);
    terrain->Unlock();
  }
}
コード例 #6
0
void
WaypointWriteFiles(WayPointList &way_points,
                   const SETTINGS_COMPUTER &settings_computer)
{
  // JMW TODO protect with mutex (whole waypoint list class)

  TCHAR szFile1[MAX_PATH] = TEXT("\0");
  TCHAR szFile2[MAX_PATH] = TEXT("\0");

  FILE *fp=NULL;

  GetRegistryString(szRegistryWayPointFile, szFile1, MAX_PATH);
  ExpandLocalPath(szFile1);

  if (_tcslen(szFile1)>0) {
    fp = _tfopen(szFile1, TEXT("wb"));
  } else {
    LocalPath(szFile1);
    _tcscat(szFile1,TEXT("\\waypoints1.dat"));
    fp = _tfopen(szFile1, TEXT("wb"));
  }

  if(fp != NULL) {
    globalFileNum = 0;
    WriteWayPointFile(way_points, fp, settings_computer);
    fprintf(fp,"\r\n");
    fclose(fp);
    fp = NULL;
  }

  GetRegistryString(szRegistryAdditionalWayPointFile, szFile2, MAX_PATH);
  ExpandLocalPath(szFile2);

  if (_tcslen(szFile2)>0) {
    fp = _tfopen(szFile2, TEXT("wb"));
  } else {
    LocalPath(szFile2);
    _tcscat(szFile2,TEXT("\\waypoints2.dat"));
    fp = _tfopen(szFile2, TEXT("wb"));
  }

  if(fp != NULL) {
    globalFileNum = 1;
    WriteWayPointFile(way_points, fp, settings_computer);
    fprintf(fp,"\r\n");
    fclose(fp);
    fp = NULL;
  }

}
コード例 #7
0
ファイル: d_iwad.c プロジェクト: fielder/chocolate-doom
static void CheckCollectorsEdition(void)
{
    char *install_path;
    char *subpath;
    unsigned int i;

    install_path = GetRegistryString(&collectors_edition_value);

    if (install_path == NULL)
    {
        return;
    }

    for (i=0; i<arrlen(collectors_edition_subdirs); ++i)
    {
        subpath = malloc(strlen(install_path)
                         + strlen(collectors_edition_subdirs[i])
                         + 5);

        sprintf(subpath, "%s\\%s", install_path, collectors_edition_subdirs[i]);

        AddIWADDir(subpath);
    }

    free(install_path);
}
コード例 #8
0
ファイル: d_iwad.c プロジェクト: emileb/chocolate-doom
static void CheckUninstallStrings(void)
{
    unsigned int i;

    for (i=0; i<arrlen(uninstall_values); ++i)
    {
        char *val;
        char *path;
        char *unstr;

        val = GetRegistryString(&uninstall_values[i]);

        if (val == NULL)
        {
            continue;
        }

        unstr = strstr(val, UNINSTALLER_STRING);

        if (unstr == NULL)
        {
            free(val);
        }
        else
        {
            path = unstr + strlen(UNINSTALLER_STRING);

            AddIWADDir(path);
        }
    }
}
コード例 #9
0
ファイル: d_iwad.c プロジェクト: emileb/chocolate-doom
static void CheckInstallRootPaths(void)
{
    unsigned int i;

    for (i=0; i<arrlen(root_path_keys); ++i)
    {
        char *install_path;
        char *subpath;
        unsigned int j;

        install_path = GetRegistryString(&root_path_keys[i]);

        if (install_path == NULL)
        {
            continue;
        }

        for (j=0; j<arrlen(root_path_subdirs); ++j)
        {
            subpath = M_StringJoin(install_path, DIR_SEPARATOR_S,
                                   root_path_subdirs[j], NULL);
            AddIWADDir(subpath);
        }

        free(install_path);
    }
}
コード例 #10
0
/**
 * expand registry macro.
 *
 * @param           [in] crstrRegExpr: something like:
 *                          "HKEY_LOKAL_MACHINE\Software\Softing, InstallPath"
 *                           ^^^^^^^^^^^^^^ reg path ^^^^^^^^^^^,^^reg name^^
 * @return          string value of this key
*/
CString CFileHelper::ExpandRegistryMacro(const CString& crstrRegExpr)
{
    CString strValue;
    CString strRegBase;
    CString strRegPath;
    CString strRegName;

    int iFound;
    iFound = crstrRegExpr.Find(_T(','));
    if(iFound >= 0)
    {
        strRegPath = crstrRegExpr.Left(iFound);
        strRegName = crstrRegExpr.Mid(iFound + 1);
    }
    else
    {
        strRegPath = crstrRegExpr;
    }
    strRegPath.TrimLeft();
    strRegPath.TrimRight();
    strRegName.TrimLeft();
    strRegName.TrimRight();
    if(!strRegPath.IsEmpty())
    {
        iFound = strRegPath.Find(_T('\\'));
        if(iFound >= 0)
        {
            strRegBase = strRegPath.Left(iFound);
            strRegPath = strRegPath.Mid(iFound + 1);
            strValue = GetRegistryString(strRegBase, strRegPath, strRegName);
        }
    }
    return strValue;
}
コード例 #11
0
ファイル: d_iwad.c プロジェクト: fielder/chocolate-doom
static void CheckSteamEdition(void)
{
    char *install_path;
    char *subpath;
    size_t i;

    install_path = GetRegistryString(&steam_install_location);

    if (install_path == NULL)
    {
        return;
    }

    for (i=0; i<arrlen(steam_install_subdirs); ++i)
    {
        subpath = malloc(strlen(install_path) 
                         + strlen(steam_install_subdirs[i]) + 5);

        sprintf(subpath, "%s\\%s", install_path, steam_install_subdirs[i]);

        AddIWADDir(subpath);
    }

    free(install_path);
}
コード例 #12
0
BOOL GetRegistryString(HKEY root, const CString & path, const CString & var, CString & val)
   {
    CString s;
    s = path;
    s += _T("\\");
    s += var;
    return GetRegistryString(root, s, val);
   } // GetRegistryString
コード例 #13
0
ファイル: C4RankSystem.cpp プロジェクト: lluchs/clonk-rage
int C4RankSystem::Init(const char *szRegister, 
											 const char *szDefRanks,
											 int iRankBase)
  {
	
	// Init
	SCopy(szRegister,Register,256);
	RankBase=iRankBase;

	// Check registry for present rank names and set defaults
#ifdef _WIN32
	int crank=0;
	char rankname[C4MaxName+1],keyname[30];
	BOOL Checking=TRUE;
	while (Checking)
		{
		sprintf(keyname,"Rank%03d",crank+1);
		if (GetRegistryString(Register,keyname,rankname,C4MaxName+1))
			{
			// Rank present
			crank++;
			}
		else
			{
			// Rank not defined, check for default
			if (SCopySegment(szDefRanks,crank,rankname,'|',C4MaxName)
			 && SetRegistryString(Register,keyname,rankname))
				crank++;
			else
				Checking=FALSE;
			}
		}
	return crank;
#else
	// clear any loaded rank names
	Clear();
	if (!szDefRanks) return 0;
	// make a copy
	szRankNames = new char[strlen(szDefRanks) + 1];
	strcpy (szRankNames, szDefRanks);
	// split into substrings by replacing the | with zeros
	for (char * p = szRankNames; *p; ++p) if (*p == '|')
		{
		*p = 0;
		++iRankNum;
		}
	++ iRankNum; // The last rank is already terminated by zero
	// build a list of substrings
	pszRankNames = new char *[iRankNum];
	char * p = szRankNames;
	for (int i = 0; i < iRankNum; ++i)
		{
		pszRankNames[i] = p;
		p += strlen(p) + 1;
		}
	return iRankNum;
#endif
  }
コード例 #14
0
ファイル: DwdsThesaurus.cpp プロジェクト: alesapin/lspl
string GetThesaurusPath ()
{
	if (!CanGetRegistryString("Software\\Dialing\\Concordance\\DwdsThesaurus")) 
	{
		fprintf (stderr,"Cannot load dwds thesaurus.\n");
		return "";
	};
	return  GetRegistryString("Software\\Dialing\\Concordance\\DwdsThesaurus");
};
コード例 #15
0
BOOL GetRegistryString(HKEY root, const CString & path, UINT var, CString & val)
   {
    CString s;
    s = path;
    s += _T("\\");
    CString t;
    t.LoadString(var);
    s += t;
    return GetRegistryString(root, s, val);
   } // GetRegistryString
コード例 #16
0
ファイル: agramtab_.cpp プロジェクト: deNULL/seman
bool CAgramtab::LoadFromRegistryAndCheck ()
{
	try
	{
		return ReadAndCheck(::GetRegistryString(GetRegistryString()).c_str());
	}
	catch (...)
	{
		return false;
	};
};
コード例 #17
0
ファイル: Language.cpp プロジェクト: bugburner/xcsoar
/**
 * Reads the selected LanguageFile into the cache
 */
void ReadLanguageFile() {
  StartupStore(TEXT("Loading language file\n"));

  TCHAR szFile1[MAX_PATH] = TEXT("\0");
  FILE *fp=NULL;

  // Read the language filename from the registry
  GetRegistryString(szRegistryLanguageFile, szFile1, MAX_PATH);
  ExpandLocalPath(szFile1);

  // Reset filename in registry in case language
  // loading crashes the application
  SetRegistryString(szRegistryLanguageFile, TEXT("\0"));

  // If the language file is not set use the default one
  if (_tcslen(szFile1)==0) {
    _tcscpy(szFile1,TEXT("default.xcl"));
  }

  // Open the language file
  fp  = _tfopen(szFile1, TEXT("rt"));

  // Return if file error
  if (fp == NULL)
    return;

  // TODO code: Safer sizes, strings etc - use C++ (can scanf restrict length?)
  TCHAR buffer[2049]; // key from scanf
  TCHAR key[2049];    // key from scanf
  TCHAR value[2049];  // value from scanf
  int found;          // Entries found from scanf

  // Read from the file
  while ((GetTextData_Size < MAXSTATUSMESSAGECACHE)
      && _fgetts(buffer, 2048, fp)
      && ((found = _stscanf(buffer, TEXT("%[^#=]=%[^\r\n][\r\n]"), key, value)) != EOF)) {

    // Check valid line?
    if ((found != 2) || key[0] == 0 || value[0] == 0) continue;

    // Save parsed translation to the cache
    GetTextData[GetTextData_Size].key = StringMallocParse(key);
    GetTextData[GetTextData_Size].text = StringMallocParse(value);

    // Global counter
    GetTextData_Size++;
  }

  // file was OK, so save filename to registry again
  ContractLocalPath(szFile1);
  SetRegistryString(szRegistryLanguageFile, szFile1);

  fclose(fp);
}
コード例 #18
0
ファイル: LoggerImpl.cpp プロジェクト: scottp/xcsoar
void
LoggerImpl::LoggerHeader(const NMEA_INFO &gps_info)
{
  char datum[]= "HFDTM100Datum: WGS-84\r\n";
  char temp[100];
  TCHAR PilotName[100];
  TCHAR AircraftType[100];
  TCHAR AircraftRego[100];

  // Flight recorder ID number MUST go first..
  sprintf(temp,
	  "AXCS%C%C%C\r\n",
	  strAssetNumber[0],
	  strAssetNumber[1],
	  strAssetNumber[2]);
  IGCWriteRecord(temp, szLoggerFileName);

  sprintf(temp,"HFDTE%02d%02d%02d\r\n",
	  gps_info.Day,
	  gps_info.Month,
	  gps_info.Year % 100);
  IGCWriteRecord(temp, szLoggerFileName);

  GetRegistryString(szRegistryPilotName, PilotName, 100);
  sprintf(temp,"HFPLTPILOT:%S\r\n", PilotName);
  IGCWriteRecord(temp, szLoggerFileName);

  GetRegistryString(szRegistryAircraftType, AircraftType, 100);
  sprintf(temp,"HFGTYGLIDERTYPE:%S\r\n", AircraftType);
  IGCWriteRecord(temp, szLoggerFileName);

  GetRegistryString(szRegistryAircraftRego, AircraftRego, 100);
  sprintf(temp,"HFGIDGLIDERID:%S\r\n", AircraftRego);
  IGCWriteRecord(temp, szLoggerFileName);

  sprintf(temp,"HFFTYFR TYPE:XCSOAR,XCSOAR %S\r\n", XCSoar_Version);
  IGCWriteRecord(temp, szLoggerFileName);

  IGCWriteRecord(datum, szLoggerFileName);

}
コード例 #19
0
string CLemmatizer::GetPath()  const
{
	string RegStr = GetRegistryString();
	string load_path = ::GetRegistryString( RegStr );
	if (	(load_path.length() > 0)	
		&&	(load_path[load_path.length() - 1] != '\\')
		&&	(load_path[load_path.length() - 1] != '/')
		)
		load_path += "/";

	return load_path;
};;
コード例 #20
0
ファイル: agramtab_.cpp プロジェクト: deNULL/seman
bool CAgramtab::LoadFromRegistry ()
{
	try
	{
		Read(::GetRegistryString(GetRegistryString()).c_str());
		return true;
	}
	catch (...)
	{
		return false;
	};
};
コード例 #21
0
ファイル: C4RankSystem.cpp プロジェクト: lluchs/clonk-rage
BOOL C4RankSystem::Check(int iRank, const char  *szDefRankName)
	{
#ifdef _WIN32
	char rankname[C4MaxName+1],keyname[30];
	sprintf(keyname,"Rank%03d",iRank);
	if (GetRegistryString(Register,keyname,rankname,C4MaxName+1))
		return FALSE;
	if (!szDefRankName || (SLen(szDefRankName)>C4MaxName))
		return FALSE;
	return SetRegistryString(Register,keyname,szDefRankName);
#else
	return TRUE;
#endif
	}
コード例 #22
0
bool C4RankSystem::Check(int iRank, const char  *szDefRankName)
{
#ifdef _WIN32
	char keyname[30];
	sprintf(keyname,"Rank%03d",iRank);
	if (!GetRegistryString(Register,keyname).isNull())
		return false;
	if (!szDefRankName || (SLen(szDefRankName)>C4MaxName))
		return false;
	return SetRegistryString(Register,keyname,szDefRankName);
#else
	return true;
#endif
}
コード例 #23
0
ファイル: SemanticStrView.cpp プロジェクト: deNULL/seman
static void log(string  s)
{
	string FileName = "rossdev.log";

	try {
		string log_path  = GetRegistryString( "Software\\Dialing\\Logs\\Main" );
		FileName = log_path + FileName;
	}
	catch (...) {
	};

    FILE* fp  = fopen (FileName.c_str(), "a");
	fprintf (fp, "%s\n", s.c_str());
	fclose(fp);
}
コード例 #24
0
CString RegistryVar::getString(UINT id, LPCTSTR def, HKEY root)
    {
     CString pathname;
     CString value;

     pathname.LoadString(id);

     if(!GetRegistryString(root, pathname, value))
        { /* failed */
	 if(def != NULL)
	    value = def;
         else
	    value = _T("");
	} /* failed */
     return value;
    }
コード例 #25
0
ファイル: RegVars.cpp プロジェクト: AnkurSheel/Engine
BOOL RegistryVar::getString(UINT id, CString & value, LPCTSTR def, HKEY root)
    {
     CString pathname;

     pathname.LoadString(id);

     if(!GetRegistryString(root, pathname, value))
        { /* failed */
         if(def != NULL)
            value = def;
         else
            value = _T("");
         return ::GetLastError() == ERROR_FILE_NOT_FOUND;
        } /* failed */
     return TRUE;
    }
コード例 #26
0
StdStrBuf C4RankSystem::GetRankName(int iRank, bool fReturnLastIfOver)
{
	if (iRank<0) return StdStrBuf();
	// if a new-style ranklist is loaded, seek there
	if (pszRankNames)
	{
		if (iRankNum<=0) return StdStrBuf();
		// overflow check
		if (iRank>=iRankNum*(iRankExtNum+1))
		{
			// rank undefined: Fallback to last rank
			if (!fReturnLastIfOver) return StdStrBuf();
			iRank = iRankNum*(iRankExtNum+1)-1;
		}
		StdStrBuf sResult;
		if (iRank >= iRankNum)
		{
			// extended rank composed of two parts
			int iExtension = iRank / iRankNum - 1;
			iRank = iRank % iRankNum;
			sResult.Format(pszRankExtensions[iExtension], pszRankNames[iRank]);
		}
		else
		{
			// simple rank
			sResult.Ref(pszRankNames[iRank]);
		}
		return sResult;
	}
#ifdef _WIN32
	// old-style registry fallback
	while (iRank>=0)
	{
		char keyname[30];
		StdCopyStrBuf rankname;
		sprintf(keyname,"Rank%03d",iRank+1);
		rankname = GetRegistryString(Register,keyname);
		if (!rankname.isNull())
			return rankname;
		if (!fReturnLastIfOver) return StdStrBuf();
		--iRank;
	}
#endif
	return StdStrBuf();
}
コード例 #27
0
ファイル: MAPostInit.cpp プロジェクト: deNULL/seman
bool CMAPost::ReadCollocs()
{
	try
		{
		
			string FileName =  GetRegistryString("Software\\Dialing\\Mapost\\Collocs");
			FILE* fp = fopen(FileName.c_str(), "rb");
			if (!fp)
			{
				ErrorMessage ("Cannot Load Collocations in Mapost");
				return false;
			};
			char s[1000];
			while(fgets(s, 1000, fp))
			{
				string		   LemmaStr;;
				int			   MainWordNo;
				string		   InterfaceString;
				StringTokenizer tok(s,"#");
				int i =0;
				while (tok())
				{
					string q = tok.val();
					Trim(q);
					if ( i ==0)
						LemmaStr = q;
					else
						if (i ==1)
							MainWordNo = atoi(q.c_str());
						else
							if (i==2)
								InterfaceString = q;
					i++;
				};

			   m_FixedCollocs.push_back(CFixedColloc(LemmaStr, MainWordNo, InterfaceString, m_pRusGramTab));
			};
			fclose(fp);
		}
		catch(...)
		{
			return false;
		}
   return true;
};
コード例 #28
0
ファイル: d_iwad.c プロジェクト: AlexMax/doomretro
// Check for Doom downloaded via Steam
static void CheckSteamEdition(void)
{
    char        *install_path = GetRegistryString(&steam_install_location);
    char        *subpath;
    size_t      i;

    if (install_path == NULL)
        return;

    for (i = 0; i < arrlen(steam_install_subdirs); ++i)
    {
        subpath = M_StringJoin(install_path, DIR_SEPARATOR_S,
                               steam_install_subdirs[i], NULL);

        AddIWADDir(subpath);
    }

    free(install_path);
}
コード例 #29
0
ファイル: translate.cpp プロジェクト: deNULL/seman
void seman_daemon_log(const string&  t)
{
	string FileName = "tr_srv.log";
	try {
		string log_path  = GetRegistryString( "Software\\Dialing\\Logs\\Main" );
		FileName = log_path + FileName;

		FILE * fp = fopen (FileName.c_str(), "a");
		struct tm today = RmlGetCurrentTime();
		char tmpbuf[255];
		strftime( tmpbuf, 255,"%H:%M, %d %B %Y > ", &today );
		fprintf (fp, "%s", tmpbuf); 
		fprintf (fp, "%s\n", t.c_str()); 
		fclose(fp);

	}
	catch (...) {
	};
}
コード例 #30
0
ファイル: MAPostInit.cpp プロジェクト: deNULL/seman
bool	CMAPost::Init(const CLemmatizer* RusLemmatizer, const CAgramtab* RusGramTab)
{
	try {
		m_pRusGramTab = RusGramTab;
		m_pRusLemmatizer = RusLemmatizer;
		if (!ReadCollocs())
		{
			return false;			
		};

	
		//получаем из морфологии код Ќ≈”Ѕ»¬ј…ћ≈Ќя (неизмен¤еммое существительное всех родов)
		BYTE POS;
		QWORD Grammems;
		if (    !m_pRusGramTab->ProcessPOSAndGrammemsIfCan(" — мр,жр,ср,мн,ед,им,рд,дт,вн,тв,пр",&POS, &Grammems) 
			 || !m_pRusGramTab->GetGramCodeByGrammemsAndPartofSpeechIfCan (POS, Grammems, m_DURNOVOGramCode)
		   )
		{
			ErrorMessage ("MAPOST", "Cannot parse string for Ќ≈”Ѕ»¬ј…ћ≈Ќя");
			return false;
		};
	    
        string TrigramConfig = GetRegistryString("TrigramConfig");
        if (!TrigramConfig.empty())
        {
            m_bUseTrigrams = true;    
            m_TrigramModel.InitModelFromConfigAndBuildTagset(BuildRMLPath(TrigramConfig.c_str()), m_pRusLemmatizer, m_pRusGramTab, true);
            m_TrigramModel.ReadBinary();
        }
	}
	catch(CExpc c)
	{
        ErrorMessage ("MAPOST", Format("%s",c.m_strCause.c_str()).c_str());
		return false;		
	}
	catch(...)
	{
		return false;		
	}
	return true;
}