コード例 #1
0
 /// <summary>
 /// Maps the mod data.
 /// </summary>
 /// <param name="pdxMod">The PDX mod.</param>
 /// <param name="mod">The mod.</param>
 protected virtual void MapModData(IPdxMod pdxMod, IMod mod)
 {
     pdxMod.DisplayName     = mod.Name;
     pdxMod.Tags            = mod.Tags?.ToList();
     pdxMod.RequiredVersion = mod.Version;
     pdxMod.GameRegistryId  = mod.DescriptorFile;
     pdxMod.Status          = Constants.Ready_to_play;
     pdxMod.Source          = MapPdxType(mod.Source);
     MapPdxPath(pdxMod, mod);
     MapPdxId(pdxMod, mod);
 }
コード例 #2
0
 /// <summary>
 /// Maps the PDX path.
 /// </summary>
 /// <param name="pdxMod">The PDX mod.</param>
 /// <param name="mod">The mod.</param>
 protected virtual void MapPdxPath(IPdxMod pdxMod, IMod mod)
 {
     if (mod.FileName.EndsWith(Shared.Constants.ZipExtension, StringComparison.OrdinalIgnoreCase) ||
         mod.FileName.EndsWith(Shared.Constants.BinExtension, StringComparison.OrdinalIgnoreCase))
     {
         pdxMod.ArchivePath = mod.FileName;
         if (mod.Source != ModSource.Local)
         {
             pdxMod.DirPath = Path.GetDirectoryName(mod.FileName);
         }
     }
     else
     {
         pdxMod.DirPath = mod.FileName;
     }
 }
コード例 #3
0
        /// <summary>
        /// Maps the PDX identifier.
        /// </summary>
        /// <param name="pdxMod">The PDX mod.</param>
        /// <param name="mod">The mod.</param>
        protected virtual void MapPdxId(IPdxMod pdxMod, IMod mod)
        {
            if (mod.RemoteId.HasValue)
            {
                switch (mod.Source)
                {
                case ModSource.Paradox:
                    pdxMod.PdxId = mod.RemoteId.ToString();
                    break;

                default:
                    // Assume steam
                    pdxMod.SteamId = mod.RemoteId.ToString();
                    break;
                }
            }
        }