Exemplo n.º 1
0
 private void WriteHeader(dsw sw, DatHeader datHeader)
 {
     sw.WriteLine("<header>", 1);
     sw.WriteNode("name", datHeader.Name);
     sw.WriteNode("rootdir", datHeader.RootDir);
     sw.WriteNode("header", datHeader.Header);
     sw.WriteNode("type", datHeader.Type);
     sw.WriteNode("description", datHeader.Description);
     sw.WriteNode("category", datHeader.Category);
     sw.WriteNode("version", datHeader.Version);
     sw.WriteNode("date", datHeader.Date);
     sw.WriteNode("author", datHeader.Author);
     sw.WriteNode("email", datHeader.Email);
     sw.WriteNode("homepage", datHeader.Homepage);
     sw.WriteNode("url", datHeader.URL);
     sw.WriteNode("comment", datHeader.Comment);
     sw.Write(@"<romvault");
     sw.WriteItem("forcepacking", datHeader.Compression);
     sw.WriteEnd(@"/>");
     sw.WriteLine("</header>", -1);
 }
Exemplo n.º 2
0
        private void writeBase(dsw sw, DatDir baseDirIn, bool newStyle)
        {
            DatBase[] dirChildren = baseDirIn.ToArray();

            if (dirChildren == null)
            {
                return;
            }
            foreach (DatBase baseObj in dirChildren)
            {
                DatDir baseDir = baseObj as DatDir;
                if (baseDir != null)
                {
                    if (baseDir.DGame != null)
                    {
                        DatGame g = baseDir.DGame;
                        sw.Write(newStyle ? @"<set" : @"<game");

                        sw.WriteItem("name", baseDir.Name);

                        if (newStyle)
                        {
                            if (baseDir.DatFileType == DatFileType.DirTorrentZip)
                            {
                                sw.WriteItem("type", "trrntzip");
                            }
                            else if (baseDir.DatFileType == DatFileType.DirRVZip)
                            {
                                sw.WriteItem("type", "rvzip");
                            }
                            else if (baseDir.DatFileType == DatFileType.Dir7Zip)
                            {
                                sw.WriteItem("type", "7zip");
                            }
                            else if (baseDir.DatFileType == DatFileType.Dir)
                            {
                                sw.WriteItem("type", "dir");
                            }
                        }

                        if (!g.IsEmuArc)
                        {
                            //         sw.WriteItem("cloneof", g.CloneOf);
                            //         sw.WriteItem("romof", g.RomOf);
                        }
                        sw.WriteEnd(@">", 1);

                        sw.WriteNode("description", g.Description);
                        if (g.IsEmuArc)
                        {
                            sw.WriteLine("<tea>", 1);
                            sw.WriteNode("titleid", g.TitleId);
                            sw.WriteNode("source", g.Source);
                            sw.WriteNode("publisher", g.Publisher);
                            sw.WriteNode("developer", g.Developer);
                            sw.WriteNode("year", g.Year);
                            sw.WriteNode("genre", g.Genre);
                            sw.WriteNode("subgenre", g.SubGenre);
                            sw.WriteNode("ratings", g.Ratings);
                            sw.WriteNode("score", g.Score);
                            sw.WriteNode("players", g.Players);
                            sw.WriteNode("enabled", g.Enabled);
                            sw.WriteNode("crc", g.CRC);
                            sw.WriteNode("cloneof", g.CloneOf);
                            sw.WriteNode("relatedto", g.RelatedTo);

                            sw.WriteLine("</trurip>", -1);
                        }
                        else
                        {
                            sw.WriteNode("year", g.Year);
                            sw.WriteNode("manufacturer", g.Manufacturer);
                        }

                        writeBase(sw, baseDir, newStyle);
                        sw.WriteLine(newStyle ? @"</set>" : @"</game>", -1);
                    }
                    else
                    {
                        sw.WriteLine(@"<dir name=""" + Etxt(baseDir.Name) + @""">", 1);
                        writeBase(sw, baseDir, newStyle);
                        sw.WriteLine(@"</dir>", -1);
                    }
                    continue;
                }

                if (baseObj is DatFile baseRom)
                {
                    if (baseRom.Name.Substring(baseRom.Name.Length - 1) == "/" && newStyle)
                    {
                        sw.Write(@"<dir");
                        sw.WriteItem("name", baseRom.Name.Substring(0, baseRom.Name.Length - 1));
                        //sw.WriteItem("merge", baseRom.Merge);
                        if (baseRom.Date != "1996/12/24 23:32:00")
                        {
                            sw.WriteItem("date", baseRom.Date);
                        }
                        sw.WriteEnd("/>");
                    }
                    else
                    {
                        sw.Write(newStyle ? @"<file" : @"<rom");
                        sw.WriteItem("name", baseRom.Name);
                        //sw.WriteItem("merge", baseRom.Merge);
                        sw.WriteItem("size", baseRom.Size);
                        sw.WriteItem("crc", baseRom.CRC);
                        sw.WriteItem("sha1", baseRom.SHA1);
                        sw.WriteItem("md5", baseRom.MD5);
                        if (baseRom.Date != "1996/12/24 23:32:00")
                        {
                            sw.WriteItem("date", baseRom.Date);
                        }
                        if (baseRom.Status != null && baseRom.Status.ToLower() != "good")
                        {
                            sw.WriteItem("status", baseRom.Status);
                        }
                        sw.WriteEnd("/>");
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void writeBase(dsw sw, DatDir baseDirIn)
        {
            DatBase[] dirChildren = baseDirIn.ToArray();

            if (dirChildren == null)
            {
                return;
            }
            foreach (DatBase baseObj in dirChildren)
            {
                DatDir baseDir = baseObj as DatDir;
                if (baseDir != null)
                {
                    if (baseDir.DGame != null)
                    {
                        DatGame g = baseDir.DGame;
                        sw.Write(@"<game");
                        sw.WriteItem("name", baseDir.Name);
                        if (!g.IsTea)
                        {
                            //         sw.WriteItem("cloneof", g.CloneOf);
                            //         sw.WriteItem("romof", g.RomOf);
                        }
                        sw.WriteEnd(@">", 1);

                        sw.WriteNode("description", g.Description);
                        if (g.IsTea)
                        {
                            sw.WriteLine("<tea>", 1);
                            sw.WriteNode("titleid", g.TitleId);
                            sw.WriteNode("source", g.Source);
                            sw.WriteNode("publisher", g.Publisher);
                            sw.WriteNode("developer", g.Developer);
                            sw.WriteNode("year", g.Year);
                            sw.WriteNode("genre", g.Genre);
                            sw.WriteNode("subgenre", g.SubGenre);
                            sw.WriteNode("ratings", g.Ratings);
                            sw.WriteNode("score", g.Score);
                            sw.WriteNode("players", g.Players);
                            sw.WriteNode("enabled", g.Enabled);
                            sw.WriteNode("crc", g.CRC);
                            sw.WriteNode("cloneof", g.CloneOf);
                            sw.WriteNode("relatedto", g.RelatedTo);

                            sw.WriteLine("</trurip>", -1);
                        }
                        else
                        {
                            sw.WriteNode("year", g.Year);
                            sw.WriteNode("manufacturer", g.Manufacturer);
                        }

                        writeBase(sw, baseDir);
                        sw.WriteLine(@"</game>", -1);
                    }
                    else
                    {
                        sw.WriteLine(@"<dir name=""" + Etxt(baseDir.Name) + @""">", 1);
                        writeBase(sw, baseDir);
                        sw.WriteLine(@"</dir>", -1);
                    }
                    continue;
                }
                DatFile baseRom = baseObj as DatFile;
                if (baseRom != null)
                {
                    sw.Write(@"<rom");
                    sw.WriteItem("name", baseRom.Name);
                    //sw.WriteItem("merge", baseRom.Merge);
                    sw.WriteItem("size", baseRom.Size);
                    sw.WriteItem("crc", baseRom.CRC);
                    sw.WriteItem("sha1", baseRom.SHA1);
                    sw.WriteItem("md5", baseRom.MD5);
                    if (baseRom.Status.ToLower() != "good")
                    {
                        sw.WriteItem("status", baseRom.Status);
                    }
                    sw.WriteEnd("/>");
                }
            }
        }