当前位置: 首页>>代码示例>>C++>>正文


C++ AppSettings::WriteSettings方法代码示例

本文整理汇总了C++中AppSettings::WriteSettings方法的典型用法代码示例。如果您正苦于以下问题:C++ AppSettings::WriteSettings方法的具体用法?C++ AppSettings::WriteSettings怎么用?C++ AppSettings::WriteSettings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AppSettings的用法示例。


在下文中一共展示了AppSettings::WriteSettings方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: exp

int	KfExport::DoExport(const TCHAR *name, ExpInterface *ei, Interface *i, BOOL suppressPrompts, DWORD options)
{
   try
   {
      // read application settings
      AppSettings::Initialize(i);

      TCHAR iniName[MAX_PATH];
      GetIniFileName(iniName);
      bool iniNameIsValid = (-1 != _taccess(iniName, 0));

      // read config from registry
      Exporter::readKfConfig(i);

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

      Exporter::mGameName = appSettings->Name;
      Exporter::mNifVersion = appSettings->NiVersion;
      Exporter::mNifUserVersion = appSettings->NiUserVersion;

      if(!suppressPrompts)
      {
         if (DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_KF_PANEL), GetActiveWindow(), KfExportOptionsDlgProc, (LPARAM)this) != IDOK)
            return true;

         // write config to registry
         Exporter::writeKfConfig(i);

         // write config to root node
         Exporter::writeConfig(i->GetRootNode());

         // Update the current app version
         appSettings = FindAppSetting(Exporter::mGameName);
         if (appSettings == NULL && !TheAppSettings.empty())
            appSettings = &TheAppSettings.front();
         appSettings->NiVersion = Exporter::mNifVersion;
         appSettings->NiUserVersion = Exporter::mNifUserVersion;
         appSettings->WriteSettings(i);
      }

      int nifVersion = VER_20_0_0_5;
      int nifUserVer = Exporter::mNifUserVersion;

      if (!Exporter::mNifVersion.empty())
      {
         if (!IsSupportedVersion(nifVersion))
         {
            string tmp = FormatVersionString(nifVersion);
            if (IDNO == MessageBox(GetActiveWindow(), FormatString("Version '%s' is not a known version. Do you wish to continue?", tmp.c_str()).c_str(), "NifExport", MB_YESNO|MB_DEFBUTTON2|MB_ICONSTOP))
               return FALSE;
         }
      }

      Exporter::mSelectedOnly = (options&SCENE_EXPORT_SELECTED) != 0;
      Exporter exp(i, appSettings);

      Ref<NiControllerSequence> root = new NiControllerSequence();

      TCHAR fname[MAX_PATH];
      _tcscpy(fname, PathFindFileName(name));
      PathRemoveExtension(fname);
      root->SetName(fname);

      Exporter::Result result = exp.doAnimExport(root);

      if (result!=Exporter::Ok)
         throw exception("Unknown error.");

      Niflib::NifInfo info(nifVersion, nifUserVer, nifUserVer);
      info.creator = Exporter::mCreatorName;
      info.exportInfo1 = "Niflib";
      info.exportInfo2 = FormatText("Niftools Max Plugins %s", fileVersion.data());
      WriteNifTree(name, StaticCast<NiObject>(root), info);
   }

   catch (exception &e)
   {
      MessageBox(NULL, e.what(), "Export Error", MB_OK);
      return true;
   }

//.........这里部分代码省略.........
开发者ID:Anchoys1,项目名称:max_nif_plugin,代码行数:101,代码来源:KfExport.cpp


注:本文中的AppSettings::WriteSettings方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。