示例#1
0
        /// <summary>
        /// Gets the path to a specific Mod's folder
        /// </summary>
        /// <param name="mod">the Id of the mod</param>
        /// <returns>The path to a specific Mod's folder</returns>
        internal static string ModArchivePath(ID mod)
        {
            string root = Regex.Replace(mod.Root, @"[^\w]", "_");
            string value = Regex.Replace(mod.Value, @"[^\w]", "_");
            string ver = Regex.Replace(mod.Version, @"[^\w]", "_");

            return Path.Combine(ArchivesPath, root, value, ver);
        }
示例#2
0
 /// <summary>
 /// Loads a list of ModVersions from the database for a given Mod
 /// </summary>
 /// <param name="id">the ID of the Mod for which to load versions</param>
 /// <returns>a list of ModVersions</returns>
 internal static IEnumerable<ModVersion> GetVersions(ID id)
 {
     using (var dbConn = Database.GetConnection())
     {
         return dbConn.Query("SELECT version, url, packing, hash, filename FROM ModVersion WHERE ModId = @Id", new { Id = (string)id })
             .Select(v => new ModVersion
             {
                 ParentId = id,
                 Ver = v.version,
                 Url = v.url,
                 Packing = Enum.Parse(typeof(PackingType), v.packing),
                 Hash = v.hash,
                 FileName = v.filename
             });
     }
 }