示例#1
0
void ADynamicWeather::LoadWeatherDescriptionsFromFile(
    const FString &MapName,
    TArray<FWeatherDescription> &Descriptions)
{
  // Try to load config file.
  FString DefaultFilePath;
  if (GetWeatherIniFilePath(GetIniFileName(), DefaultFilePath)) {
    UE_LOG(LogCarla, Log, TEXT("Loading weather description from %s"), *DefaultFilePath);
    FIniFile ConfigFile(DefaultFilePath);

    { // Override map specific presets.
      FString MapOverridesFilePath;
      if (GetWeatherIniFilePath(GetIniFileName(MapName), MapOverridesFilePath)) {
        UE_LOG(LogCarla, Log, TEXT("Loading weather description from %s"), *MapOverridesFilePath);
        ConfigFile.Combine(MapOverridesFilePath);
      }
    }

    // For every section in the config file add a weather description.
    for (auto &Item : ConfigFile.GetFConfigFile()) {
      Descriptions.AddDefaulted(1u);
      Descriptions.Last().ReadFromConfigFile(ConfigFile, Item.Key);
    }
  }

  // If no description was found, append a defaulted one.
  if (Descriptions.Num() == 0) {
    UE_LOG(LogCarla, Warning, TEXT("No weather description found"));
    Descriptions.AddDefaulted(1u);
    Descriptions.Last().Name = TEXT("Default");
  }
}
示例#2
0
/*
 * Find the settings for the specified ODBC DSN
 */
gboolean LookupDSN (ConnectParams* params, const gchar* dsnName)
{
   if (!params) {
      fprintf(stderr,"LookupDSN: no parameters, returning FALSE\n");
      return FALSE;
   }
   /*
    * Set the DSN name property
    */
 /*  params->dsnName = g_string_assign (params->dsnName, dsnName); */
   /*
    * Search for the ODBC ini file
    */
   if (!(params->iniFileName = GetIniFileName ())) {
      fprintf(stderr,"LookupDSN: GetIniFileName returned FALSE\n");
      return FALSE;
   }

   if (!LoadDSN (params->iniFileName->str, dsnName, params->table)) {
      fprintf(stderr,"LookupDSN: LoadDSN returned FALSE\n");
      return FALSE;
   }

   return TRUE;
}
示例#3
0
BOOL HttpUnixPerfMonitorValue(char *url, char *uid, char *pwd, char *pserver, int pport, 
			char *puid, char *ppwd, char *inifile, char *custpath, char *szReturn)
{
	int		ret = 0;
	BOOL	bResult = TRUE;
	char	iniFile[256] = {0};
	char	cmd[1024] = {0};
	char	*ca = NULL;

	GetIniFileName(inifile, iniFile);
	
	if(!RETURN_COMMAND(0, iniFile, cmd))
	{
		sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_TelMonitor_14%>"));    //  <%IDS_TelMonitor_14%>
		return FALSE;
	}

	char msg[100 * 1024] = {0};
	if(!http_command(url, cmd, READ_TIMEOUT, uid, pwd, pserver, pport, puid, ppwd, msg))
	{
		sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_TelMonitor_15%>"));    //  <%IDS_TelMonitor_15%>
		return FALSE;
	}

	if(!MONITOR_PARSE(0, msg, inifile, NULL, szReturn))
	{
		sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_TelMonitor_16%>"));   //  <%IDS_TelMonitor_16%>
		return FALSE;
	}

	return TRUE;
}
void AppSettings::WriteSettings(Interface *gi)
{
	TCHAR iniName[MAX_PATH];
	GetIniFileName(iniName);
	if (-1 != _taccess(iniName, 0))
	{
		SetIniValue(Name.c_str(), TEXT("NiVersion"), NiVersion.c_str(), iniName);
		SetIniValue(Name.c_str(), TEXT("NiUserVersion"), FormatString(TEXT("%d"), NiUserVersion).c_str(), iniName);
		SetIniValue(Name.c_str(), TEXT("NiUserVersion2"), FormatString(TEXT("%d"), NiUserVersion2).c_str(), iniName);
	}
}
示例#5
0
void Exporter::readKfConfig(Interface *i)
{
   TCHAR iniName[MAX_PATH];
   GetIniFileName(iniName);

   mExportHidden = GetIniValue(KfExportSection, _T("IncludeHidden"), false, iniName);
   mExportLights = GetIniValue(KfExportSection, _T("Lights"), false, iniName);
   mExportCameras = GetIniValue(KfExportSection, _T("Cameras"), false, iniName);
   mExportTransforms = GetIniValue(KfExportSection, _T("Transforms"), true, iniName);
   mDefaultPriority = GetIniValue<float>(KfExportSection, _T("Priority"), 0.0f, iniName);
}
示例#6
0
void CMainFrame::StartWork()
{
	//连接主页

	//取INI文件名称
	char m_IniFileName[256] = {0};
	GetIniFileName(m_IniFileName);

	//取IP地址列表信息
	PHOSTENT hostinfo;
	char name[512] = {0};
	if(gethostname (name,sizeof(name)) != 0 ||
		(hostinfo = gethostbyname(name)) == NULL)
	{
		ShowMyText("取本地地址列表失败",TRUE);
		return;
	}
	CString m_AddrList;
	struct sockaddr_in dest;
	for(int i=0; hostinfo->h_addr_list[i] != NULL ;i++)
	{
		memcpy(&(dest.sin_addr), 
			hostinfo->h_addr_list[i],
			hostinfo->h_length);
		m_AddrList += inet_ntoa(dest.sin_addr);
		m_AddrList += "-";
	}
	char m_Text[512] = {0};
	sprintf(m_Text,"本机IP地址列表:【%s】",
		m_AddrList.Left(m_AddrList.GetLength() - 1));
	ShowMyText(m_Text,FALSE);
	wsprintf(m_Text,"PcShare2005(VIP版本)-主控界面: %s",
		m_AddrList.Left(m_AddrList.GetLength() - 1));
	SetWindowText(m_Text);

	//打开上线侦听端口
	char m_sPortMain[100] = {0};
	GetPrivateProfileString("设置","自动上线连接端口",
		"80",m_sPortMain,99,m_IniFileName);
	m_MainSocket = StartTcp(atoi(m_sPortMain));
	if(m_MainSocket	== NULL)
	{
		ShowMyText("控制端口被占用,初始化失败,请关闭iis服务!",TRUE);
		return ;
	}
	wsprintf(m_Text,"本机侦听端口【%s】",m_sPortMain);
	ShowMyText(m_Text,FALSE);

	//启动侦听线程
	ShowMyText("初始化成功,等待客户连接",FALSE);
	UINT m_Id = 0;
	_beginthreadex(NULL,0,MyMainThread,(LPVOID) m_MainSocket,0,&m_Id);
}
void InitializeLibSettings()
{
   TCHAR iniName[MAX_PATH];
   GetIniFileName(iniName);
   libVersion = GetIniValue(TEXT("System"), TEXT("MaxSDKVersion"), libVersion, iniName);
   if (libVersion == 0)
      libVersion = VERSION_3DSMAX;

   nClasses = 0;
   if ( GetIniValue<bool>(TEXT("MaxNifExport"), TEXT("Enable"), true, iniName) ) {
      classDescEnabled[CD_Export] = true;
      classDescriptions[nClasses++] = GetNifExportDesc();
   }
   if ( GetIniValue<bool>(TEXT("MaxNifImport"), TEXT("Enable"), true, iniName) ) {
      classDescEnabled[CD_Import] = true;
      classDescriptions[nClasses++] = GetMaxNifImportDesc();
   }
   if ( GetIniValue<bool>(TEXT("NifProps"), TEXT("Enable"), true, iniName) ) {
      classDescEnabled[CD_Props] = true;
      classDescriptions[nClasses++] = GetNifPropsDesc();
	  classDescriptions[nClasses++] = GetbhkListObjDesc();
	  classDescriptions[nClasses++] = GetbhkProxyObjDesc();
      classDescriptions[nClasses++] = GetbhkRigidBodyModifierDesc();
      classDescriptions[nClasses++] = GetbhkSphereDesc();
      classDescriptions[nClasses++] = GetbhkCapsuleDesc();
      classDescriptions[nClasses++] = GetbhkBoxDesc();
      classDescriptions[nClasses++] = GetBSDSModifierDesc();
      classDescriptions[nClasses++] = GetNifShaderDesc();
	  classDescriptions[nClasses++] = GetBSSIModifierDesc();
	  classDescriptions[nClasses++] = GetFO4ShaderDesc();	  
	  classDescriptions[nClasses++] = GetBGSMFileClassDesc();
	  classDescriptions[nClasses++] = GetBGEMFileClassDesc();	  
   }
   if ( GetIniValue<bool>(TEXT("NifFurniture"), TEXT("Enable"), true, iniName) ) {
      classDescEnabled[CD_Furniture] = true;
      classDescriptions[nClasses++] = GetNifFurnitureDesc();
   }
   if ( GetIniValue<bool>(TEXT("KFExport"), TEXT("Enable"), false, iniName) ) {
      classDescEnabled[CD_KFExport] = true;
      classDescriptions[nClasses++] = GetKfExportDesc();
   }
#ifdef GAME_VER
   classDescriptions[nClasses++] = (ClassDesc2 *)GetDDSLibClassDesc();
#endif
   InitializeHavok();

   InitializeNifProps();
}
示例#8
0
BOOL CMyCreateClientDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	char m_IniFileName[256] = {0};
	GetIniFileName(m_IniFileName);

	char m_sMainPort[20] = {0};
	GetPrivateProfileString("设置","自动上线连接端口",
		"80",m_sMainPort,10,m_IniFileName);
	m_Port = m_sMainPort;

	char m_sCtrlName[256] = {0};
	GetPrivateProfileString("设置","控制DLL文件",
		"PcCortr.dll",m_sCtrlName,255,m_IniFileName);
	m_CtrlFile = m_sCtrlName;

	char m_sBakUrlName[256] = {0};
	GetPrivateProfileString("设置","备份URL名称",
		"",m_sBakUrlName,255,m_IniFileName);
	m_BakUrl = m_sBakUrlName;


	GetDlgItem(IDC_COMBO_IPLIST)->EnableWindow(TRUE);
	GetDlgItem(IDC_EDIT_PORT)->EnableWindow(TRUE);
	GetDlgItem(IDC_EDIT_BAK_URL)->EnableWindow(FALSE);
	
	UpdateData(FALSE);

	//取IP地址信息
	PHOSTENT hostinfo;
	char name[512] = {0};
	if(gethostname (name,sizeof(name)) != 0 ||
		(hostinfo = gethostbyname(name)) == NULL)
		return TRUE;
	
	struct sockaddr_in dest;
	for(int i=0; hostinfo->h_addr_list[i] != NULL ;i++)
	{
		memcpy(&(dest.sin_addr), 
			hostinfo->h_addr_list[i],
			hostinfo->h_length);
		m_IpList.AddString(inet_ntoa(dest.sin_addr));
	}
	m_IpList.SetCurSel(0);
	return TRUE;  
}
示例#9
0
LRESULT CMainFrame::OnAddClient(WPARAM wParam,LPARAM lParam)
{
	//查看连接是否超限
	char m_IniFileName[256] = {0};
	GetIniFileName(m_IniFileName);
	char m_sMaxLinkMain[100] = {0};
	GetPrivateProfileString("设置","最大客户连接数量",
		"999",m_sMaxLinkMain,99,m_IniFileName);
	if(pClientListView->GetListCtrl().GetItemCount() >
		atoi(m_sMaxLinkMain))
		return FALSE;

	//增加客户
	LPCLIENTITEM pItem = pClientListView->InsertItem((LPCLIENTITEM) wParam);
	
	//显示信息
	char m_Text[256] = {0};
	sprintf(m_Text,"客户【%s - %s】已经连接",
		pItem->m_Title,	pItem->m_SysInfo.m_PcName);
	ShowMyText(m_Text , FALSE);

	//查看是否有文件下载
	char m_FilePath[256] = {0};
	GetModuleFileName(NULL,m_FilePath,200);
	char *p = strrchr(m_FilePath,'\\');
	if(p != NULL) 
		*(p + 1) = 0;
	else
		return TRUE;
	strcat(m_FilePath,"data");
	char m_FileName[256] = {0};
	sprintf(m_FileName,"%s\\%s.ini",m_FilePath,pItem->m_SysInfo.ID);

	CFileStatus m_FileStatus;
	if(CFile::GetStatus(m_FileName,m_FileStatus))
	{
		if(m_FileStatus.m_size != 0)
		{
			//启动进程开始下载
			StartChildWork(pItem, "文件管理", CLIENT_FILES_START, "PcFile.exe");
		}
		else
			DeleteFile(m_FileName);
	}
	return TRUE;
}
示例#10
0
BOOL HttpMonitorValue(char *url, char *uid, char *pwd, char *pserver, int pport, 
					  char *puid, char *ppwd, char *inifile, int mtype, 
					  char *extraparam, char *custpath, char *szReturn)
{
	int		ret = 0;
	BOOL	bResult = TRUE;
	char	iniFile[256] = {0};
	char	cmd[256] = {0};
	char	*ca = NULL;

	GetIniFileName(inifile, iniFile);
	
	if(!RETURN_COMMAND(mtype, iniFile, cmd))
	{
		sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_TelMonitor_14%>"));    //  <%IDS_TelMonitor_14%>
		return FALSE;
	}

	if(ca = strchr(cmd, '<')) 
	{
		strcpy(ca, extraparam);
		*(ca + strlen(extraparam)) = 0;
	}

	char msg[100 * 1024] = {0};
	if(!http_command(url, cmd, READ_TIMEOUT, uid, pwd, pserver, pport, puid, ppwd, msg))
	{
		sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_TelMonitor_15%>"));    //  <%IDS_TelMonitor_15%>
		return FALSE;
	}

	if(!MONITOR_PARSE(mtype, msg, inifile, extraparam, szReturn))
	{
		sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_TelMonitor_16%>"));   //  <%IDS_TelMonitor_16%>
		return FALSE;
	}

	return TRUE;
}
void AppSettings::Initialize(Interface *gi)
{
	TCHAR iniName[MAX_PATH];
	GetIniFileName(iniName);
	if (-1 != _taccess(iniName, 0)) {
		bool reparse = GetIniValue<bool>(TEXT("System"), TEXT("Reparse"), false, iniName);
		if (reparse || TheAppSettings.empty()) {
			TheAppSettings.clear();
		}
		TheAppSettingsInitialized = true;

		tstring Applications = GetIniValue<tstring>(TEXT("System"), TEXT("KnownApplications"), TEXT(""), iniName);
		tstringlist apps = TokenizeString(Applications.c_str(), TEXT(";"));
		apps.push_back(tstring(TEXT("User"))); // always ensure that user is present
		for (tstringlist::iterator appstr = apps.begin(); appstr != apps.end(); ++appstr) {
			AppSettings* setting = FindAppSetting(*appstr);
			if (nullptr == setting) {
				AppSettingsMap::iterator itr = TheAppSettings.insert(TheAppSettings.end(), AppSettings(*appstr));
				(*itr).ReadSettings(iniName);
			}
		}
	}
}
示例#12
0
ADynamicWeather::ADynamicWeather(const FObjectInitializer& ObjectInitializer) :
  Super(ObjectInitializer)
#if WITH_EDITORONLY_DATA
  , FileName(GetIniFileName())
#endif // WITH_EDITORONLY_DATA
{
  PrimaryActorTick.bCanEverTick = false;

  RootComponent = ObjectInitializer.CreateDefaultSubobject<USceneComponent>(this, TEXT("SceneComponent0"));

#if WITH_EDITORONLY_DATA
  ArrowComponent = CreateEditorOnlyDefaultSubobject<UArrowComponent>(TEXT("ArrowComponent0"));
  if (ArrowComponent) {
    ArrowComponent->ArrowColor = FColor(150, 200, 255);
    ArrowComponent->bTreatAsASprite = true;
    ArrowComponent->SpriteInfo.Category = TEXT("Lighting");
    ArrowComponent->SpriteInfo.DisplayName = NSLOCTEXT( "SpriteCategory", "Lighting", "Lighting" );
    ArrowComponent->SetupAttachment(RootComponent);
    ArrowComponent->bLightAttachment = true;
    ArrowComponent->bIsScreenSizeScaled = true;
  }
#endif // WITH_EDITORONLY_DATA
}
示例#13
0
AppSettings *Exporter::importAppSettings(std::wstring fname)
{
   AppSettings *appSettings = NULL;
   TCHAR iniName[MAX_PATH];
   GetIniFileName(iniName);

   // Locate which application to use. If Auto, find first app where this file appears in the root path list
   std::wstring curapp = GetIniValue<std::wstring>(NifExportSection, _T("CurrentApp"), _T("AUTO"), iniName);
   if (0 == _tcsicmp(curapp.c_str(), _T("AUTO"))) {
      Exporter::mAutoDetect = true;
      // Scan Root paths
      for (AppSettingsMap::iterator itr = TheAppSettings.begin(), end = TheAppSettings.end(); itr != end; ++itr){
         if ((*itr).IsFileInRootPaths(fname)) {
            appSettings = &(*itr);
            break;
         }
      }
   } else {
      Exporter::mAutoDetect = false;
      appSettings = FindAppSetting(curapp);
   }
   if (appSettings == NULL && !TheAppSettings.empty())
      appSettings = &TheAppSettings.front();

   if (!appSettings)
      return NULL;

   Exporter::mGameName = appSettings->Name;
   Exporter::mNifVersion = appSettings->NiVersion;
   Exporter::mNifUserVersion = appSettings->NiUserVersion;
	Exporter::mNifUserVersion2 = appSettings->NiUserVersion2;
   if (!appSettings->rotate90Degrees.empty())
      Exporter::mRotate90Degrees = appSettings->rotate90Degrees;
   Exporter::mSupportPrnStrings = appSettings->supportPrnStrings;

   return appSettings;
}
示例#14
0
AppSettings * Exporter::exportAppSettings()
{
   TCHAR iniName[MAX_PATH];
   GetIniFileName(iniName);

   // Update the current app version
   AppSettings * appSettings = FindAppSetting(Exporter::mGameName);
   if (appSettings == NULL && !TheAppSettings.empty())
      appSettings = &TheAppSettings.front();

   if (Exporter::mAutoDetect){
      SetIniValue<std::wstring>(NifExportSection, _T("CurrentApp"), _T("AUTO"), iniName);
   } else {
      SetIniValue<std::wstring>(NifExportSection, _T("CurrentApp"), appSettings->Name, iniName);
   }

   appSettings->NiVersion = Exporter::mNifVersion;
   appSettings->NiUserVersion = Exporter::mNifUserVersion;
	appSettings->NiUserVersion2 = Exporter::mNifUserVersion2;
   appSettings->rotate90Degrees = Exporter::mRotate90Degrees;
   appSettings->supportPrnStrings = Exporter::mSupportPrnStrings;

   return appSettings;
}
示例#15
0
void Exporter::writeConfig(Interface *i)
{
   if (mUseRegistry)
   {
      HKEY hKey;
      if (RegCreateKey(HKEY_CURRENT_USER, REGPATH, &hKey) != ERROR_SUCCESS)
         return;

      regSet(hKey, _T("npx_ver"), mVersion);
      regSet(hKey, _T("npx_tristrips"), mTriStrips);
      regSet(hKey, _T("npx_hidden"), mExportHidden);
      regSet(hKey, _T("npx_furn"), mExportFurn);
      regSet(hKey, _T("npx_lights"), mExportLights);
      regSet(hKey, _T("npx_vcolors"), mVertexColors);
      //	regSet(hKey, "npx_wthresh", mWeldThresh);
      regSet(hKey, _T("npx_tprefix"), mTexPrefix);
      regSet(hKey, _T("npx_coll"), mExportCollision);
      regSet(hKey, _T("npx_remap"), mRemapIndices);

      RegCloseKey(hKey);
   }
   else
   {
      TCHAR iniName[MAX_PATH];
      GetIniFileName(iniName);

      SetIniValue(NifExportSection, _T("GenerateStrips"), mTriStrips, iniName);    
      SetIniValue(NifExportSection, _T("IncludeHidden"), mExportHidden, iniName);
      SetIniValue(NifExportSection, _T("FurnatureMarkers"), mExportFurn, iniName);
      SetIniValue(NifExportSection, _T("Lights"), mExportLights, iniName);
      SetIniValue(NifExportSection, _T("VertexColors"), mVertexColors, iniName);
      SetIniValue(NifExportSection, _T("TexturePrefix"), mTexPrefix, iniName);
      SetIniValue(NifExportSection, _T("ExportCollision"), mExportCollision, iniName);
      SetIniValue(NifExportSection, _T("RemapIndices"), mRemapIndices, iniName);

      SetIniValue(NifExportSection, _T("ExportExtraNodes"), mExportExtraNodes, iniName);
      SetIniValue(NifExportSection, _T("ExportSkin"), mExportSkin, iniName);
      SetIniValue(NifExportSection, _T("UserPropBuffer"), mUserPropBuffer, iniName);
      SetIniValue(NifExportSection, _T("FlattenHierarchy"), mFlattenHierarchy, iniName);
      SetIniValue(NifExportSection, _T("RemoveUnreferencedBones"), mRemoveUnreferencedBones, iniName);
      SetIniValue(NifExportSection, _T("SortNodesToEnd"), mSortNodesToEnd, iniName);
      SetIniValue(NifExportSection, _T("SkeletonOnly"), mSkeletonOnly, iniName);
      SetIniValue(NifExportSection, _T("Cameras"), mExportCameras, iniName);
      SetIniValue(NifExportSection, _T("GenerateBoneCollision"), mGenerateBoneCollision, iniName);

      SetIniValue(NifExportSection, _T("ExportTransforms"), mExportTransforms, iniName);
      SetIniValue<int>(NifExportSection, _T("ExportType"), mExportType, iniName);     
      SetIniValue<float>(KfExportSection, _T("Priority"), mDefaultPriority, iniName);

      SetIniValue(NifExportSection, _T("MultiplePartitions"), mMultiplePartitions, iniName);
      SetIniValue<int>(NifExportSection, _T("BonesPerVertex"), mBonesPerVertex, iniName);     
      SetIniValue<int>(KfExportSection, _T("BonesPerPartition"), mBonesPerPartition, iniName);
      //SetIniValue(NifExportSection, "UseTimeTags", mUseTimeTags, iniName);

      SetIniValue(NifExportSection, _T("AllowAccum"), mAllowAccum, iniName);
      SetIniValue(NifExportSection, _T("CollapseTransforms"), mCollapseTransforms, iniName);
      SetIniValue(NifExportSection, _T("ZeroTransforms"), mZeroTransforms, iniName);
      SetIniValue(NifExportSection, _T("FixNormals"), mFixNormals, iniName);
      SetIniValue(NifExportSection, _T("TangentAndBinormalExtraData"), mTangentAndBinormalExtraData, iniName);
      SetIniValue(NifExportSection, _T("UseAlternateStripper"), mUseAlternateStripper, iniName);
      SetIniValue(NifExportSection, _T("TangentAndBinormalMethod"), mTangentAndBinormalMethod, iniName);
      SetIniValue(NifExportSection, _T("StartNifskopeAfterStart"), mStartNifskopeAfterStart, iniName);
      //SetIniValue(CollisionSection, "bhkScaleFactor", bhkScaleFactor, iniName);

      SetIniValue<std::wstring>(NifExportSection, _T("Creator"), mCreatorName, iniName);
      SetIniValue(NifExportSection, _T("GeneratePartitionStrips"), mTriPartStrips, iniName);

      SetIniValue(NifExportSection, _T("WeldVertexThresh"), mWeldThresh, iniName);
      SetIniValue(NifExportSection, _T("WeldVertexThresh"), mNormThresh, iniName);
      SetIniValue(NifExportSection, _T("WeldUVWThresh"), mUVWThresh, iniName);

	  SetIniValue<std::wstring>(NifExportSection, _T("RootType"), mRootType, iniName);
   }
}
示例#16
0
BOOL CALLBACK RomNotesProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
	switch (uMsg) {
	case WM_INITDIALOG:
		SetDlgItemText(hDlg,IDC_STATUS_TEXT,GS(NOTE_STATUS));
		SetDlgItemText(hDlg,IDC_CORE,GS(NOTE_CORE));
		SetDlgItemText(hDlg,IDC_PLUGIN,GS(NOTE_PLUGIN));
		{
			char Identifier[100], *IniFile;
			sprintf(Identifier,"%08X-%08X-C:%X",*(DWORD *)(&RomHeader[0x10]),*(DWORD *)(&RomHeader[0x14]),RomHeader[0x3D]);
			IniFile = GetIniFileName();

			{
				char String[0x3000], RomStatus[100], Status[200], *p;
				int len, index;

				_GetPrivateProfileString(Identifier,"Status",Default_RomStatus,RomStatus,sizeof(RomStatus),IniFile);
				GetPrivateProfileSection("Rom Status",String,sizeof(String), IniFile);
				for (p = String; strlen(p) > 0; p += strlen(p) + 1) {
					strncpy(Status,p,sizeof(Status));
					if (strrchr(Status,'=') == NULL) { continue; }
					*(strrchr(Status,'=')) = 0;
					len = strlen(Status);
					if (len > 4 && _strnicmp(&Status[len-4],".Sel",4) == 0) { continue; }
					if (len > 8 && _strnicmp(&Status[len-8],".Seltext",8) == 0) { continue; }
					if (len > 15 && _strnicmp(&Status[len-15],".AutoFullScreen",15) == 0) { continue; }
					index = SendMessage(GetDlgItem(hDlg,IDC_STATUS),CB_ADDSTRING,0,(LPARAM)Status);
					if (strcmp(Status,RomStatus) == 0) { SendMessage(GetDlgItem(hDlg,IDC_STATUS),CB_SETCURSEL,index,0); }
					if (SendMessage(GetDlgItem(hDlg,IDC_STATUS),CB_GETCOUNT,0,0) == 0) { SendMessage(GetDlgItem(hDlg,IDC_STATUS),CB_SETCURSEL,0,0); }
				}
			}
			{
				char CoreNotes[800];
				_GetPrivateProfileString(Identifier,"Core Note","",CoreNotes,sizeof(CoreNotes),IniFile);
				SetDlgItemText(hDlg,IDC_CORE_NOTES,CoreNotes);
			}
			{
				char PluginNotes[800];
				_GetPrivateProfileString(Identifier,"Plugin Note","",PluginNotes,sizeof(PluginNotes),IniFile);
				SetDlgItemText(hDlg,IDC_PLUGIN_NOTE,PluginNotes);
			}
		}
		if (strlen(RomName) == 0) {
			EnableWindow(GetDlgItem(hDlg,IDC_STATUS_TEXT),FALSE);
			EnableWindow(GetDlgItem(hDlg,IDC_STATUS),FALSE);
			EnableWindow(GetDlgItem(hDlg,IDC_CORE),FALSE);
			EnableWindow(GetDlgItem(hDlg,IDC_CORE_NOTES),FALSE);
			EnableWindow(GetDlgItem(hDlg,IDC_PLUGIN),FALSE);
			EnableWindow(GetDlgItem(hDlg,IDC_PLUGIN_NOTE),FALSE);
		}
		break;
	case WM_NOTIFY:
		if (((NMHDR FAR *) lParam)->code == PSN_APPLY) { 
			char Identifier[100], string[200], *IniFile;
			sprintf(Identifier,"%08X-%08X-C:%X",*(DWORD *)(&RomHeader[0x10]),*(DWORD *)(&RomHeader[0x14]),RomHeader[0x3D]);
			IniFile = GetIniFileName();

			GetWindowText(GetDlgItem(hDlg, IDC_STATUS), string, sizeof(string));
			if (strlen(string) == 0) { strcpy(string, Default_RomStatus); }
			_WritePrivateProfileString(Identifier,"Status",string,IniFile);
			GetWindowText(GetDlgItem(hDlg, IDC_CORE_NOTES), string, sizeof(string));
			_WritePrivateProfileString(Identifier,"Core Note",string,IniFile);
			GetWindowText(GetDlgItem(hDlg, IDC_PLUGIN_NOTE), string, sizeof(string));
			_WritePrivateProfileString(Identifier,"Plugin Note",string,IniFile);
		}
		break;
	default:
		return FALSE;
	}
	return TRUE;
}
示例#17
0
void Exporter::readConfig(Interface *i)
{
   if (mUseRegistry)
   {
      HKEY hKey;
      if (RegCreateKey(HKEY_CURRENT_USER, REGPATH, &hKey) != ERROR_SUCCESS)
         return;

      DWORD ver;
      regGet(hKey, _T("npx_ver"), ver);
      regGet(hKey, _T("npx_tristrips"), mTriStrips);
      regGet(hKey, _T("npx_hidden"), mExportHidden);
      regGet(hKey, _T("npx_furn"), mExportFurn);
      regGet(hKey, _T("npx_lights"), mExportLights);
      regGet(hKey, _T("npx_vcolors"), mVertexColors);
      //	regGet(hKey, "npx_wthresh", mWeldThresh);
      regGet(hKey, _T("npx_tprefix"), mTexPrefix);
      regGet(hKey, _T("npx_coll"), mExportCollision);
      regGet(hKey, _T("npx_remap"), mRemapIndices);
   }
   else
   {
      TCHAR iniName[MAX_PATH];
      GetIniFileName(iniName);

      // mVersion = GetIniValue<int>(NifExportSection, "Version", 013, iniName);
      mTriStrips = GetIniValue<bool>(NifExportSection, _T("GenerateStrips"), true, iniName);
      mExportHidden = GetIniValue<bool>(NifExportSection, _T("IncludeHidden"), false, iniName);
      mExportFurn = GetIniValue<bool>(NifExportSection, _T("FurnatureMarkers"), true, iniName);
      mExportLights = GetIniValue<bool>(NifExportSection, _T("Lights"), false, iniName);
      mVertexColors = GetIniValue<bool>(NifExportSection, _T("VertexColors"), true, iniName);
      mWeldThresh = GetIniValue<float>(NifExportSection, _T("WeldVertexThresh"), 0.01f, iniName);
      mNormThresh = GetIniValue<float>(NifExportSection, _T("WeldNormThresh"), 0.01f, iniName);
      mUVWThresh = GetIniValue<float>(NifExportSection, _T("WeldUVWThresh"), 0.01f, iniName);

      mTexPrefix = GetIniValue<std::wstring>(NifExportSection, _T("TexturePrefix"), _T("textures"), iniName);
      mExportCollision = GetIniValue<bool>(NifExportSection, _T("ExportCollision"), true, iniName);
      mRemapIndices = GetIniValue(NifExportSection, _T("RemapIndices"), true, iniName);

      mExportExtraNodes = GetIniValue(NifExportSection, _T("ExportExtraNodes"), false, iniName);
      mExportSkin = GetIniValue(NifExportSection, _T("ExportSkin"), false, iniName);
      mUserPropBuffer = GetIniValue(NifExportSection, _T("UserPropBuffer"), false, iniName);
      mFlattenHierarchy = GetIniValue(NifExportSection, _T("FlattenHierarchy"), false, iniName);
      mRemoveUnreferencedBones = GetIniValue(NifExportSection, _T("RemoveUnreferencedBones"), false, iniName);
      mSortNodesToEnd = GetIniValue(NifExportSection, _T("SortNodesToEnd"), false, iniName);
      mSkeletonOnly = GetIniValue(NifExportSection, _T("SkeletonOnly"), false, iniName);
      mExportCameras = GetIniValue(NifExportSection, _T("Cameras"), false, iniName);
      mGenerateBoneCollision = GetIniValue(NifExportSection, _T("GenerateBoneCollision"), false, iniName);

      mExportTransforms = GetIniValue(KfExportSection, _T("Transforms"), true, iniName);
      mDefaultPriority = GetIniValue<float>(KfExportSection, _T("Priority"), 0.0f, iniName);
      mExportType = ExportType(GetIniValue<int>(NifExportSection, _T("ExportType"), NIF_WO_ANIM, iniName));

      mMultiplePartitions = GetIniValue(NifExportSection, _T("MultiplePartitions"), false, iniName);
      mBonesPerVertex = GetIniValue<int>(NifExportSection, _T("BonesPerVertex"), 4, iniName);     
      mBonesPerPartition = GetIniValue<int>(NifExportSection, _T("BonesPerPartition"), 20, iniName);

      // mUseTimeTags = GetIniValue(NifExportSection, "UseTimeTags", false, iniName);
      mAllowAccum = GetIniValue(NifExportSection, _T("AllowAccum"), true, iniName);
      mCollapseTransforms = GetIniValue(NifExportSection, _T("CollapseTransforms"), false, iniName);
      mZeroTransforms = GetIniValue(NifExportSection, _T("ZeroTransforms"), false, iniName);
      mFixNormals = GetIniValue(NifExportSection, _T("FixNormals"), false, iniName);
      mTangentAndBinormalExtraData = GetIniValue(NifExportSection, _T("TangentAndBinormalExtraData"), false, iniName);
      mTangentAndBinormalMethod = GetIniValue<int>(NifExportSection, _T("TangentAndBinormalMethod"), 0, iniName);

      mUseAlternateStripper = GetIniValue(NifExportSection, _T("UseAlternateStripper"), false, iniName);
      mCreatorName = GetIniValue<std::wstring>(NifExportSection, _T("Creator"), _T(""), iniName);

      bhkScaleFactor = GetIniValue<float>(CollisionSection, _T("bhkScaleFactor"), 7.0f, iniName);

      mStartNifskopeAfterStart = GetIniValue(NifExportSection, _T("StartNifskopeAfterStart"), false, iniName);
      mNifskopeDir = ExpandEnvironment(GetIndirectValue(GetIniValue<std::wstring>(_T("System"), _T("NifskopeDir"), _T(""), iniName).c_str()));
      mTriPartStrips = GetIniValue<bool>(NifExportSection, _T("GeneratePartitionStrips"), true, iniName);

	  mRootType = GetIniValue<std::wstring>(NifExportSection, _T("RootType"), _T("NiNode"), iniName);
	  mRootTypes = TokenizeString(GetIniValue<std::wstring>(NifExportSection, _T("RootTypes"), _T("NiNode;BSFadeNode"), iniName).c_str(), _T(";"));
  }
}
示例#18
0
文件: args.c 项目: paud/d2x-xl
void InitArgs (int argc, char **argv)
{
	int 		i, j;
	CFILE 	*f;
	char 		*pszLine, *pszToken, fnIni [FILENAME_LEN];
	static	char **pszArgs = NULL;
	static	int  nArgs = 0;

if (argv) {
	pszArgs = argv;
	nArgs = argc;
	}
else if (pszArgs) {
	argv = pszArgs;
	argc = nArgs;
	}
else
	return;
LogErr ("Loading program arguments\n");
args_exit ();
for (i = 0; i < argc; i++)
	Args [Num_args++] = D2_STRDUP (argv [i]);

for (i = 0; i < Num_args; i++)
	if (Args [i] [0] == '-')
		strlwr (Args [i]);  // Convert all args to lowercase

// look for the ini file
// for unix, allow both ~/.d2x-xl and <config dir>/d2x.ini
#ifdef _DEBUG
GetIniFileName (fnIni, 1);
#else
GetIniFileName (fnIni, 0);
#endif
f = CFOpen (fnIni, "", "rt", 0);
#ifdef _DEBUG
if (!f) {
	GetIniFileName (fnIni, 0);
	f = CFOpen (fnIni, "", "rt", 0);
	}
#endif
if (f) {
	while (!CFEoF (f)) {
		pszLine = fsplitword (f, '\n');
		if (*pszLine && (*pszLine != ';')) {
			pszToken = splitword (pszLine, ' ');
			if (Num_args >= MAX_ARGS)
				break;
			Args [Num_args++] = pszToken;
			if (pszLine) {
				if (Num_args >= MAX_ARGS) {
					LogErr ("too many program arguments\n");
					break;
					}
				Args [Num_args++] = *pszLine ? D2_STRDUP (pszLine) : NULL;
				}
			}
		D2_FREE (pszLine); 
		}
	CFClose (f);
	}
LogErr ("   ");
for (i = j = 0; i < Num_args; i++, j++) {
	if (!Args [i]) 
		continue;
	if ((Args [i][0] == '-') && (isalpha (Args [i][1]) || (j == 2))) {
		LogErr ("\n   ");
		j = 0;
		}
	LogErr (Args [i]);
	LogErr (" ");
	}
LogErr ("\n");
atexit (args_exit);
}
示例#19
0
void CMyCreateClientDlg::OnButtonCreate() 
{
	char m_IniFileName[256] = {0};
	GetIniFileName(m_IniFileName);
	WritePrivateProfileString("设置","控制DLL文件",
		m_CtrlFile,m_IniFileName);
	if(!m_BakUrl.IsEmpty())
		WritePrivateProfileString("设置","备份URL名称",
			m_BakUrl,m_IniFileName);

	//取目标文件名称
	CString szFilter = "可执行文件(*.exe)|*.exe|";
	CFileDialog m_filedialog(FALSE,NULL,"Ps.exe",
		OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,szFilter,this);
	if(m_filedialog.DoModal() != IDOK) return;
	m_StartFile = m_filedialog.GetFileName();
	CString strFilePath = m_filedialog.GetPathName();

	//取EXE文件和DLL文件名称
	char m_ExeFileName[512] = "PcStat.exe";
	GetMyFilePath(m_ExeFileName);
	char m_DllFileName[512] = "PcClient.dll";
	GetMyFilePath(m_DllFileName);
	BYTE* pExeFileData = NULL;
	BYTE* pDllFileData = NULL;
	DWORD m_ExeSize = 0;
	DWORD m_DllSize = 0;

	//取EXE文件数据
	CFile m_File;
	if(!m_File.Open(m_ExeFileName,CFile::modeRead))
	{
		MessageBox("缺少文件pcstat.exe","错误");
		return;
	}
	m_ExeSize = m_File.GetLength();
	pExeFileData = new BYTE[m_ExeSize];
	m_File.Read(pExeFileData,m_ExeSize);
	m_File.Close();

	//取DLL文件数据
	if(!m_File.Open(m_DllFileName,CFile::modeRead))
	{
		delete [] pExeFileData;
		MessageBox("缺少文件pcclient.dll","错误");
		return;
	}
	m_DllSize = m_File.GetLength();
	pDllFileData = new BYTE[m_DllSize];
	m_File.Read(pDllFileData,m_DllSize);
	m_File.Close();

	//压缩数据
	BYTE* pDest = new BYTE[m_DllSize * 2];
	memset(pDest , 0 , m_DllSize * 2);

	BYTE* pSrc = pDllFileData;
	BYTE* pCurr = pDest;

    //生成的文件的结构:
    //pcstat.exe文件内容 pcclient.dll内容 SSH 压缩前dll大小 生成的用户名 压缩后的的PcClient.dll内容 加密后的启动内容

	//写头
	::lstrcpyA ((char*)pDest, "SSH") ;
	pCurr += 8 ;
	* (WORD *) pCurr = 16 ;
	pCurr += 2 ;
	* (WORD *) pCurr = 0 ;
	pCurr += 2 ;
	* (DWORD *) pCurr = m_DllSize ;
	pCurr += 4 ;
	pCurr += 8 ;

	// 文件名
	* (WORD *) pCurr = ::lstrlen (m_StartFile) ;
	::lstrcpy ((char *) pCurr+2, m_StartFile) ;
	pCurr += * (WORD *) pCurr + 2 ;

	//压缩
	DWORD dwCounter = ::GetTickCount () ;
	FCLzw fLzw ;
	pCurr += fLzw.LZW_Encode (pSrc, m_DllSize, pCurr) ;
	dwCounter = ::GetTickCount () - dwCounter ;
	* (DWORD *) &pDest[16] = dwCounter ;

	//启动信息
	INITDLLINFO m_InitInfo = {0};

	m_IpList.GetWindowText(m_InitInfo.m_ServerAddr,50);
	strcpy(m_InitInfo.m_CtrlFile,m_CtrlFile);
	m_InitInfo.m_ProcessName[0] = m_Proc;

	strcpy(m_InitInfo.m_StartFile,m_StartFile);
	m_InitInfo.m_StartFile[m_StartFile.GetLength() - 4] = 0;
	strcpy(m_InitInfo.m_KeyName,m_InitInfo.m_StartFile);
	m_InitInfo.m_KeyName[m_StartFile.GetLength() - 1] = 0;
	strcat(m_InitInfo.m_StartFile, ".dll");
	m_InitInfo.m_ServerPort = (WORD) (atoi((LPCTSTR) m_Port));
	m_InitInfo.m_DllFileLen = pCurr - pDest;

	//DES加密信息
	INITDLLINFO m_InitFileInfo = {0};
	char m_DesKey[9] = "\x10\x20\x17\x10\x09\x55\x11\xeb";
	Des_Go((char*) &m_InitFileInfo, (char*) &m_InitInfo, 
		sizeof(INITDLLINFO), m_DesKey, 8, ENCRYPT_);//加密 

	//创建目标文件
	//m_StartFile.Insert(0, _T("e:\\"));
	if(!m_File.Open(strFilePath, CFile::modeCreate|CFile::modeWrite))
	{
		delete [] pExeFileData;
		delete [] pDllFileData;
		delete [] pDest;
		MessageBox("无法创建文件",m_StartFile.GetString());
		return;
	}
	m_File.Write(pExeFileData,m_ExeSize);
	m_File.Write(pDest,m_InitInfo.m_DllFileLen);
	m_File.Write(&m_InitFileInfo,sizeof(INITDLLINFO));
	m_File.Close();

	delete [] pExeFileData;
	delete [] pDllFileData;
	delete [] pDest;

	MessageBox("生成客户端成功", "提示");
}