public static void load() { try { if (File.Exists(fullPath)) { string stringData = File.ReadAllText(fullPath); data = JsonConvert.DeserializeObject <serviceData>(stringData); } else { save(); } } catch (Exception err) { log.Error(err, "Can't load AppService data."); } }
public static JObject Services() { var jserviceData = new JObject(); try { var list = new JArray(); var SVList = new List <serviceData>(); foreach (ServiceController sc in ServiceController.GetServices()) { var tempSVList = new serviceData(); tempSVList.DisplayName = sc.DisplayName; tempSVList.ServiceName = sc.ServiceName; tempSVList.Status = sc.Status.ToString(); SVList.Add(tempSVList); } foreach (serviceData serviceRunning in SVList.Where(x => x.Status == "Running")) { var tempSVListJO = new JObject(); tempSVListJO["display_name"] = serviceRunning.DisplayName; tempSVListJO["service_name"] = serviceRunning.ServiceName; tempSVListJO["status"] = serviceRunning.Status; list.Add(tempSVListJO); } jserviceData["Running"] = list; list = new JArray(); foreach (serviceData serviceStopped in SVList.Where(x => x.Status == "Stopped")) { var tempSVListJO = new JObject(); tempSVListJO["display_name"] = serviceStopped.DisplayName; tempSVListJO["service_name"] = serviceStopped.ServiceName; tempSVListJO["status"] = serviceStopped.Status; list.Add(tempSVListJO); } jserviceData["Stopped"] = list; list = new JArray(); foreach (serviceData servicePause in SVList.Where(x => x.Status == "Pause")) { var tempSVListJO = new JObject(); tempSVListJO["display_name"] = servicePause.DisplayName; tempSVListJO["service_name"] = servicePause.ServiceName; tempSVListJO["status"] = servicePause.Status; list.Add(tempSVListJO); } jserviceData["Pause"] = list; } catch (Exception e) { Logger.Log("Could not retrieve service info.", LogLevel.Error); Logger.LogException(e); } return(jserviceData); }
public static JObject Services() { var jserviceData = new JObject(); try { var list = new JArray(); var SVList = new List<serviceData>(); foreach (ServiceController sc in ServiceController.GetServices()) { var tempSVList = new serviceData(); tempSVList.DisplayName = sc.DisplayName; tempSVList.ServiceName = sc.ServiceName; tempSVList.Status = sc.Status.ToString(); SVList.Add(tempSVList); } foreach (serviceData serviceRunning in SVList.Where(x => x.Status == "Running")) { var tempSVListJO = new JObject(); tempSVListJO["display_name"] = serviceRunning.DisplayName; tempSVListJO["service_name"] = serviceRunning.ServiceName; tempSVListJO["status"] = serviceRunning.Status; list.Add(tempSVListJO); } jserviceData["Running"] = list; list = new JArray(); foreach (serviceData serviceStopped in SVList.Where(x => x.Status == "Stopped")) { var tempSVListJO = new JObject(); tempSVListJO["display_name"] = serviceStopped.DisplayName; tempSVListJO["service_name"] = serviceStopped.ServiceName; tempSVListJO["status"] = serviceStopped.Status; list.Add(tempSVListJO); } jserviceData["Stopped"] = list; list = new JArray(); foreach (serviceData servicePause in SVList.Where(x => x.Status == "Pause")) { var tempSVListJO = new JObject(); tempSVListJO["display_name"] = servicePause.DisplayName; tempSVListJO["service_name"] = servicePause.ServiceName; tempSVListJO["status"] = servicePause.Status; list.Add(tempSVListJO); } jserviceData["Pause"] = list; } catch (Exception e) { Logger.Log("Could not retrieve service info.", LogLevel.Error); Logger.LogException(e); } return jserviceData; }
public override List <outputFormatBasic> getData() { List <outputFormatBasic> result = new List <outputFormatBasic>(); Int32 index = 0; Int32.TryParse(this.service.uri, out index); if (index > data.Count) { index = data.Count - 1; } serviceData conf = this.data.First(); // 特殊 1日当たり96event、9:30AM-17:30で5分間隔。 // StartTime は、this.today の 日付のみ借りて 9:30AM強制 // これを this.daycount日分繰り返す for (Int32 days = 0; days < 24 /* this.daycount */; days++) { DateTime startTime = new DateTime(today.Year, today.Month, today.Day, conf.startTime.Hour, conf.startTime.Minute, 0).AddDays(days); int counterEncodeRate = 0; for (Int32 eventCount = 0; eventCount < 96; eventCount++) { outputFormatBasic ou = new outputFormatBasic( service.networkId.value, service, null); ou.eventtime = new epgEventTime(startTime); ou.eventid.value = ou.eventid.setEventIdFromDate(ou.eventtime.value); ou.duration = new epgDuration(conf.duration); ou.videoInfo = new List <outputFormatExtList>(); outputFormatVideo p = new outputFormatVideo(); // p.componentType = new epgVideoComponentType(0xb3); p.componentType = new epgVideoComponentType(service.DefaultVideoComponentType.value); p.videoType = new epgVideoType("HD映像"); ou.videoInfo.Add(p); ou.audioInfo = new List <outputFormatExtList>(); ou.audioInfo.Add(new outputFormatAudio(ou.service.forceJlab035)); ou.title.value = conf.title; ou.contents.set(conf.desc.Trim()); if (conf.addEncRateText == true) { ou.encoderInfo = new outputFormatEncoderInfo(); Int32 rate = conf.rate[counterEncodeRate % conf.rate.Length]; ou.encoderInfo.rate.value = rate; ou.title.value += " " + ((Int32)(rate / 1000)).ToString() + "Mbps"; } else { ou.encoderInfo.clear(); } ou.genleInfo = new List <outputFormatExtList>(); outputFormatGenle genle = new outputFormatGenle(); genle.genleBig = new epgGenleBig(0x02); // 情報/ワイドショー genle.genleSmall = new epgGenleSmall(0x04); // ショッピング・通販 ou.genleInfo.Add(genle); ou.extDescriptorInfo = new List <outputFormatExtList>(); foreach (TagData tag in conf.tags) { outputFormatExtDescription exDesc = new outputFormatExtDescription(); exDesc.makeExtDescription(tag.name, tag.desc); ou.extDescriptorInfo.Add(exDesc); } counterEncodeRate++; startTime = startTime.AddMinutes(conf.duration); result.Add(ou); } } return(result); }
private void initializeData() { serviceData p; TagData pp; DateTime baseTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0); this.data = new List <serviceData>(); p = new serviceData(); p.index = 1; p.title = "ショップチャンネル"; p.addEncRateText = true; p.desc = "ショップチャンネルは、ファッション、コスメ、家庭用品、健康グッズなど、世界中から厳選した商品を、生放送でご紹介。"; p.duration = 5; p.startTime = baseTime.AddHours(9).AddMinutes(30); p.rate = new Int32[] { 8000, 10000 }; p.tags = new List <TagData>(); pp = new TagData(); pp.name = "URL"; pp.desc = "http://www.shopch.jp"; p.tags.Add(pp); pp = new TagData(); pp.name = "TEL"; pp.desc = "フリーダイヤル:0120-000123"; p.tags.Add(pp); pp = new TagData(); pp.name = "番組詳細"; pp.desc = "商品の人気度や残量がリアルタイムでわかる、生放送ならではの臨場感をぜひ、お楽しみ下さい。ご注文は24時間年中無休! 在庫状況により番組に変更が生じる場合がございます。ご了承ください。"; p.tags.Add(pp); this.data.Add(p); p = new serviceData(); p.index = 2; p.title = "QVC"; p.addEncRateText = true; p.desc = "世界最大24時間完全生放送のTVショッピングチャンネル<QVC>。"; p.duration = 5; p.startTime = baseTime.AddHours(9).AddMinutes(30); p.rate = new Int32[] { 10000, 8000 }; p.tags = new List <TagData>(); pp = new TagData(); pp.name = "URL"; pp.desc = "http://qvc.jp (パソコン・携帯電話から)"; p.tags.Add(pp); pp = new TagData(); pp.name = "TEL"; pp.desc = "<ご注文> 0120-945-009 (アドバイザー) 0120-945-007 (音声自動応答)"; p.tags.Add(pp); pp = new TagData(); pp.name = "番組詳細"; pp.desc = "驚きの商品が、つぎつぎ登場しますので、欲しい商品を見つけたらスグにお電話ください。24時間、オペレーターが注文を承ります。 "; p.tags.Add(pp); this.data.Add(p); // Pattern 3 p = new serviceData(); p.index = 3; p.title = "壱弐参四五六七八九拾壱弐参四五六七八九拾"; p.addEncRateText = false; p.desc = "壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾"; p.duration = 15; p.startTime = baseTime; p.rate = new Int32[] { 10000, 8000, 4000, }; p.tags = new List <TagData>(); pp = new TagData(); pp.name = "最大長の試験~壱"; pp.desc = "壱弐参四五六七八九10壱弐参四五六七八九20壱弐参四五六七八九30壱弐参四五六七八九40壱弐参四五六七八九50壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾"; p.tags.Add(pp); pp = new TagData(); pp.name = "最大長の試験~弐"; pp.desc = "壱弐参四五六七八九10壱弐参四五六七八九20壱弐参四五六七八九30壱弐参四五六七八九40壱弐参四五六七八九50壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾"; p.tags.Add(pp); pp = new TagData(); pp.name = "最大長の試験~参"; pp.desc = "壱弐参四五六七八九10壱弐参四五六七八九20壱弐参四五六七八九30壱弐参四五六七八九40壱弐参四五六七八九50壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾"; p.tags.Add(pp); pp = new TagData(); pp.name = "最大長の試験~四"; pp.desc = "壱弐参四五六七八九10壱弐参四五六七八九20壱弐参四五六七八九30壱弐参四五六七八九40壱弐参四五六七八九50壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾"; p.tags.Add(pp); pp = new TagData(); pp.name = "最大長の試験~五"; pp.desc = "壱弐参四五六七八九10壱弐参四五六七八九20壱弐参四五六七八九30壱弐参四五六七八九40壱弐参四五六七八九50壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾"; p.tags.Add(pp); pp = new TagData(); pp.name = "最大長の試験~六"; pp.desc = "壱弐参四五六七八九10壱弐参四五六七八九20壱弐参四五六七八九30壱弐参四五六七八九40壱弐参四五六七八九50壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾"; p.tags.Add(pp); pp = new TagData(); pp.name = "最大長の試験~七"; pp.desc = "壱弐参四五六七八九10壱弐参四五六七八九20壱弐参四五六七八九30壱弐参四五六七八九40壱弐参四五六七八九50壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾"; p.tags.Add(pp); pp = new TagData(); pp.name = "最大長の試験~八"; pp.desc = "壱弐参四五六七八九10壱弐参四五六七八九20壱弐参四五六七八九30壱弐参四五六七八九40壱弐参四五六七八九50壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾"; p.tags.Add(pp); pp = new TagData(); pp.name = "最大長の試験~九"; pp.desc = "壱弐参四五六七八九10壱弐参四五六七八九20壱弐参四五六七八九30壱弐参四五六七八九40壱弐参四五六七八九50壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾壱弐参四五六七八九拾"; p.tags.Add(pp); this.data.Add(p); }