示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="directory"></param>
        /// <returns></returns>
        public Mod(DirectoryInfo directory, Game game)
        {
            var files = directory.GetFiles("*.txt");

            foreach (var file in files)
            {
                // try {
                var lines = File.ReadAllLines(file.FullName);
                foreach (var line in lines)
                {
                    var attrs = line.Split('#');
                    WorkshopVersion = attrs[0];
                    Name            = attrs[1];
                    Uuid            = attrs[2];
                    GroFile         = new FileWithHash(attrs[3], attrs[4]);
                    Thumbnail       = new FileWithHash(attrs[5], attrs[6]);
                }
                break;
                // } catch (Exception ex) { Console.WriteLine(ex.Message); }
            }
            // decimal.TryParse(directory.Name, )
            Id        = directory.Name;
            Directory = directory;
            Game      = game;
        }
示例#2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="id"></param>
 /// <param name="directory"></param>
 /// <param name="workshopversion"></param>
 /// <param name="name"></param>
 /// <param name="uuid"></param>
 /// <param name="grofile"></param>
 /// <param name="thumbnail"></param>
 public Mod(string id, DirectoryInfo directory, string workshopversion, string name, string uuid, FileWithHash grofile, FileWithHash thumbnail)
 {
     Id = id; Directory = directory; WorkshopVersion = workshopversion; Name = name; Uuid = uuid; GroFile = grofile; Thumbnail = thumbnail;
 }