예제 #1
0
            //  } ws_train_stops;

            public override bool get(String outStr, string args)
            {
                Train     trn;
                TrainStop stp;
                string    sep = wxPorting.T("{");

                outStr.append(wxPorting.T("{\n"));
                if (Globals.wxStrncmp(args, wxPorting.T("t="), 2) == 0)
                {
                    trn = Globals.find_train(Globals.schedule, args + 2);
                    if (trn != null)
                    {
                        json(outStr, wxPorting.T("name"), trn.name);
                        outStr.append(wxPorting.T("\"stops\" :\n["));
                        for (stp = trn.stops; stp != null; stp = stp.next)
                        {
                            outStr.append(sep);
                            json(outStr, wxPorting.T("station"), stp.station);
                            json(outStr, wxPorting.T("arrival"), Globals.format_time(stp.arrival));
                            json(outStr, wxPorting.T("departure"), Globals.format_time(stp.departure));
                            json(outStr, wxPorting.T("minstop"), stp.minstop);
                            json(outStr, wxPorting.T("stopped"), stp.stopped);
                            json(outStr, wxPorting.T("late"), stp.late);
                            json(outStr, wxPorting.T("delay"), stp.delay, true);
                            sep = wxPorting.T("},\n{");
                        }
                        if (trn.stops != null)
                        {
                            outStr.append(wxPorting.T("}"));
                        }
                        outStr.append(wxPorting.T("\n]\n"));
                    }
                }
                outStr.append(wxPorting.T("}\n"));
                return(true);
            }