예제 #1
0
    public static void Main(string[] args)
    {
        ArcRels rels = ArcRels.Load(@"http://3dcustom.ath.cx/devel/arcs/code/mod0066/rels.xml");

        foreach (Relationship rel in rels.Relationships)
        {
            Console.WriteLine(rel.Id);
            Console.WriteLine(rel.FromId);
            Console.WriteLine(rel.ToId);
            Console.WriteLine(rel.Kind);
        }
    }
예제 #2
0
    public static ArcRels Load(string source_file)
    {
        XmlAttributeOverrides attrOverrides = new XmlAttributeOverrides();
        XmlAttributes         attrs         = new XmlAttributes();

        XmlElementAttribute attr = new XmlElementAttribute();

        attr.ElementName = "relationship";
        attr.Type        = typeof(Relationship);

        attrs.XmlElements.Add(attr);

        attrOverrides.Add(typeof(ArcRels), "Relationships", attrs);

        XmlReader     reader     = XmlReader.Create(source_file);
        XmlSerializer serializer = new XmlSerializer(typeof(ArcRels), attrOverrides);
        ArcRels       rels       = serializer.Deserialize(reader) as ArcRels;

        reader.Close();
        return(rels);
    }
예제 #3
0
        public void DoWorkerThread()
        {
            string  moddb = TDCGExplorer.GetSystemDatabase().moddb_url;
            string  relurl;
            ArcRels relationships;

            string msg = "<html><body>";

            int count = 0;

            //            Cursor.Current = Cursors.WaitCursor;
            try
            {
                relurl = moddb + "arcs/code/" + zipEntry.code + "/rels.xml";
                TDCGExplorer.SetToolTips(relurl);
                relationships = ArcRels.Load(relurl);

                Arc thisarc = Arc.Load(moddb + "arcs/code/" + zipEntry.code + ".xml");

                msg += "<h2><a href=" + moddb + "arcs/" + thisarc.Id + ">" + "MOD Archive code:" + zipEntry.code + "</a></h2>";

                if (relationships != null)
                {
                    if (relationships.Relationships != null)
                    {
                        foreach (Relationship relation in relationships.Relationships)
                        {
                            string   arcurl  = moddb + "arcs/" + relation.ToId.ToString() + ".xml";
                            string[] kindstr = { "0", "同一内容", "新版", "前提" };
                            try
                            {
                                Arc arc = Arc.Load(arcurl);
                                if (arc != null)
                                {
                                    msg += "<pre>";
                                    msg += "属性:" + kindstr[relation.Kind] + "<br/>";
                                    msg += "MODコード名:" + arc.Code + "<br/>";
                                    msg += "サマリー:" + arc.Summary + "<br/>";
                                    msg += "元ファイル名:" + arc.Origname + "<br/>";
                                    msg += "拡張子:" + arc.Extname + "<br/>";
                                    msg += "所在:" + arc.Location + "<br/>";
                                    msg += "</pre>";
                                    count++;
                                }
                            }
                            catch (Exception ex)
                            {
                                Debug.WriteLine(ex.Message);
                            }
                        }
                    }
                }

                relurl        = moddb + "arcs/code/" + zipEntry.code + "/revs.xml";
                relationships = ArcRels.Load(relurl);
                if (relationships != null)
                {
                    if (relationships.Relationships != null)
                    {
                        foreach (Relationship relation in relationships.Relationships)
                        {
                            if (relation.Kind == 1)
                            {
                                continue;
                            }
                            string   arcurl  = moddb + "arcs/" + relation.FromId.ToString() + ".xml";
                            string[] kindstr = { "0", "1", "旧版", "提供" };
                            try
                            {
                                Arc arc = Arc.Load(arcurl);
                                if (arc != null)
                                {
                                    msg += "<pre>";
                                    msg += "属性:" + kindstr[relation.Kind] + "<br/>";
                                    msg += "MODコード名:" + arc.Code + "<br/>";
                                    msg += "サマリー:" + arc.Summary + "<br/>";
                                    msg += "元ファイル名:" + arc.Origname + "<br/>";
                                    msg += "拡張子:" + arc.Extname + "<br/>";
                                    msg += "所在:" + arc.Location + "<br/>";
                                    msg += "</pre>";
                                    count++;
                                }
                            }
                            catch (Exception ex)
                            {
                                Debug.WriteLine(ex.Message);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
            //            Cursor.Current = Cursors.Default;

            if (count == 0)
            {
                msg += "<p>関連情報がありません</p>";
            }
            msg += "</body></html>";
            page.asyncDisplayFromArcs(msg);
        }