/// <summary> /// Retreaves StringDictionary object from database or file system /// </summary> /// <param name="exType">Extension Type</param> /// <param name="exId">Extension Id</param> /// <returns>StringDictionary object as Stream</returns> public object GetSettings(ExtensionType exType, string exId) { SerializableStringDictionary ssd = null; StringDictionary sd = new StringDictionary(); XmlSerializer serializer = new XmlSerializer(typeof(SerializableStringDictionary)); if (_section.DefaultProvider == "XmlTrainProvider") { Stream stm = (Stream)TrainService.LoadFromDataStore(exType, exId); if (stm != null) { ssd = (SerializableStringDictionary)serializer.Deserialize(stm); stm.Close(); sd = (StringDictionary)ssd; } } else { object o = TrainService.LoadFromDataStore(exType, exId); if (!string.IsNullOrEmpty((string)o)) { using (StringReader reader = new StringReader((string)o)) { ssd = (SerializableStringDictionary)serializer.Deserialize(reader); } sd = (StringDictionary)ssd; } } return(sd); }
/// <summary> /// Gets settings from data store /// </summary> /// <param name="exType">Extension Type</param> /// <param name="exId">Extension ID</param> /// <returns>Settings as Stream</returns> public object GetSettings(ExtensionType exType, string exId) { WidgetData wd = new WidgetData(); XmlDocument xml = new XmlDocument(); if (_section.DefaultProvider == "XmlTrainProvider") { Stream stm = (Stream)TrainService.LoadFromDataStore(exType, exId); if (stm != null) { XmlSerializer x = new XmlSerializer(typeof(XmlDocument)); xml = (XmlDocument)x.Deserialize(stm); stm.Close(); } } else { object o = TrainService.LoadFromDataStore(exType, exId); if (!string.IsNullOrEmpty((string)o)) { XmlSerializer serializer = new XmlSerializer(typeof(WidgetData)); using (StringReader reader = new StringReader((string)o)) { wd = (WidgetData)serializer.Deserialize(reader); } if (wd.Settings.Length > 0) { xml.InnerXml = wd.Settings; } } } return(xml); }
/// <summary> /// 強化学習によって学習したAIを使い、指定したクエストを試す /// </summary> /// <param name="args"></param> public static void Main(string[] args) { if (args.Length == 0) { Console.WriteLine("[usage] Program <Quest Master ID>"); return; } var questMasterId = int.Parse(args[0]); var envService = new GetEnvironmentService(); // ================================================================ // 学習 // ================================================================ var envs = envService.GetEnvironments(); var trainService = new TrainService(); var network = trainService.Train(envs, TrainTimes); // ================================================================ // 結果出力 // ================================================================ var env = envService.GetEnvironment(1, 100); var computeService = new ComputeService(); computeService.Compute(network, env, questMasterId); }
void DrawDebugButtons() { if (GUI.Button(new Rect(0, 0, 100, 50), "Next Step")) { PathService.ConnectPathFromPreviousNodeColors(model, Config.Width, ++step); } if (GUI.Button(new Rect(100, 0, 100, 50), "Complete")) { PathService.ConnectPathFromPreviousNodeColors(model, Config.Width, Config.Height); } if (GUI.Button(new Rect(0, 50, 100, 50), "Move")) { TrainService.MoveTrainForward(model); } if (GUI.Button(new Rect(100, 50, 100, 50), "Reset")) { InitWorld(); } if (GUI.Button(new Rect(0, 100, 100, 50), "Save")) { Save(); } if (GUI.Button(new Rect(100, 100, 100, 50), "Load")) { Load(); } if (GUI.Button(new Rect(0, 150, 100, 50), "Toggle Nodes")) { model.debugSettings.isShowingNodes = !model.debugSettings.isShowingNodes; } if (GUI.Button(new Rect(100, 150, 100, 50), "Toggle Connection Info")) { model.debugSettings.isShowingConnectionInfo = !model.debugSettings.isShowingConnectionInfo; } }
/// <summary> /// Inserts a new object to the data store. /// </summary> protected override void DataInsert() { if (IsNew) { TrainService.InsertRes(this); } }
/// <summary> /// Updates the object in its data store. /// </summary> protected override void DataUpdate() { if (IsChanged) { TrainService.UpdateRes(this); } }
protected override void DataInsert() { if (IsNew) { TrainService.InsertCurriculaInfo(this); } }
protected override void DataUpdate() { if (IsChanged) { TrainService.UpdateCurriculaInfo(this); } }
protected override void DataDelete() { TrainService.DeleteProfile(this); if (Profiles.Contains(this)) { Profiles.Remove(this); } }
protected override void DataDelete() { TrainService.DeleteUserHis(this); if (UserHiss.Contains(this)) { UserHiss.Remove(this); } }
public AdminRideController(RideService rideService, TrainService trainService, RouteService routeService, StopToRouteService stopToRouteService) { _rideService = rideService; _trainService = trainService; _routeService = routeService; _stopToRouteService = stopToRouteService; }
protected override void DataInsert() { TrainService.InsertProfile(this); if (IsNew) { Profiles.Add(this); } }
public void Service_WillObjectThrowExceptionWithEmptyPathForAnn_Exception() { ITrainService trainService = new TrainService(); Assert.Throws <InvalidSaveAnnPathException>(() => { trainService.SetPathToSaveAnn(string.Empty); }); }
public void Start_Should_Start_Train() { var service = new TrainService(); var train = new Train(1); service.Start(train); train.Status.Equals(TrainStatus.Running); }
public void GetTrainsTo_ValidCrs_ShouldReturnTrains(string crsFrom, string crsTo) { var service = new TrainService(GetMockLdbService()); var trains = service.GetTrainsTo(crsFrom, crsTo); Assert.NotNull(trains); Assert.IsNotEmpty(trains); }
public void Service_WillObjectThrowExceptionWithEmptyPathForSample_Exception() { ITrainService trainService = new TrainService(); Assert.Throws <InvalidGetSamplesPathException>(() => { trainService.GetPathOfLanguageSample(string.Empty); }); }
protected override void DataInsert() { TrainService.InsertUserHis(this); if (IsNew) { UserHiss.Add(this); } }
/// <summary> /// 胸部推举机上报解析 /// </summary> /// <param name="body"></param> public void PaserXall(byte[] body, string idCard, DeviceType deviceType) { //运动强度 byte strength = ProtocolUtil.BcdToInt(body[1]); //运动时间 1/100秒 Int32 time = BitConverter.ToInt32(body, 2); time = IPAddress.NetworkToHostOrder(time); //总移动距离 毫米 Int32 distance = BitConverter.ToInt32(body, 6); distance = IPAddress.NetworkToHostOrder(distance); //总功 1/100 焦耳 Int32 energy = BitConverter.ToInt32(body, 10); energy = IPAddress.NetworkToHostOrder(energy); //消耗热量 1/100 卡路里 Int32 heat = BitConverter.ToInt32(body, 14); heat = IPAddress.NetworkToHostOrder(heat); //指数标识 0 正数 1 负数 //指数值 1/100 Int32 singer = BitConverter.ToInt32(body, 19); singer = IPAddress.NetworkToHostOrder(singer); singer = body[18] == 0x00 ? singer : -1 * singer; //动作节奏 0没问题 1 有些许问题 2 有问题 byte rhythem = body[23]; //使用者感想 string think = ProtocolUtil.GetEndString(body, 24); PrescriptionResult result = new PrescriptionResult(); //自觉运动强度 result.PR_SportStrength = (byte)(strength - 5); result.PR_Time1 = time / 100.0; result.PR_Distance = distance; result.PR_CountWorkQuantity = energy / 100.0; result.PR_Cal = heat / 100.0; result.PR_Index = singer / 100.0; result.PR_Evaluate = rhythem; result.PR_UserThoughts = think; result.Gmt_Create = DateTime.Now; result.Gmt_Modified = result.Gmt_Create; StringBuilder sb = new StringBuilder(); sb.Append("运动强度:").Append(strength).Append("运动时间:").Append(time).Append("总移动距离:").Append(distance).Append("总功:").Append(energy) .Append("消耗热量").Append(heat).Append("指数值:").Append(singer).Append("动作节奏:").Append(rhythem); logger.Info("训练上报的解析结果:" + sb.ToString()); TrainService trainService = new TrainService(); // 存数据库 trainService.AddPrescriptionResult(idCard, result, deviceType); }
void Update() { TrainService.TickTrain(model, Time.deltaTime); view.Tick(model); Vector3 camPos = model.train.pos.Vector3(); Camera.main.transform.position = camPos; Camera.main.transform.localPosition += -Camera.main.transform.forward * 10f; }
/// <summary> /// Deletes the Post from the current TrainProvider. /// </summary> protected override void DataDelete() { TrainService.DeleteCurricula(this); if (Curriculas.Contains(this)) { Curriculas.Remove(this); Dispose(); AddRelations(); } }
/// <summary> /// Deletes the Post from the current TrainProvider. /// </summary> protected override void DataDelete() { TrainService.DeleteTraining(this); if (Trainings.Contains(this)) { Trainings.Remove(this); Dispose(); AddRelations(); } }
/// <summary> /// Inserts a new object to the data store. /// </summary> protected override void DataInsert() { TrainService.InsertExcellent(this); if (this.IsNew) { Excellents.Add(this); Excellents.Sort(); AddRelations(); } }
public int BlobUpdate() { if (CurrentPostFileBuffer.LongLength > 0) { return(TrainService.UpdateBlob(this)); } else { return(-1); } }
/// <summary> /// Inserts a new Training to the current TrainProvider. /// </summary> protected override void DataInsert() { TrainService.InsertTraining(this); if (this.IsNew) { Trainings.Add(this); Trainings.Sort(); AddRelations(); } }
/// <summary> /// Inserts a new Training to the current TrainProvider. /// </summary> protected override void DataInsert() { TrainService.InsertCurricula(this); if (this.IsNew) { Curriculas.Add(this); Curriculas.Sort(); AddRelations(); } }
/// <summary> /// Saves extension to database or file system /// </summary> /// <param name="exType">Extension Type</param> /// <param name="exId">Extension ID</param> /// <param name="settings">Extension object</param> /// <returns>True if saved</returns> public bool SaveSettings(ExtensionType exType, string exId, object settings) { try { TrainService.SaveToDataStore(exType, exId, settings); return(true); } catch (Exception) { throw; } }
/// <summary> /// Deletes the object from the data store. /// </summary> protected override void DataDelete() { if (IsDeleted) { TrainService.DeleteExcellent(this); } if (Excellents.Contains(this)) { Excellents.Remove(this); } Dispose(); }
protected override void DataDelete() { if (IsDeleted) { TrainService.DeleteCurriculaInfo(this); } if (CurriculaInfos.Contains(this)) { CurriculaInfos.Remove(this); } Dispose(); }
/// <summary> /// Deletes the object from the data store. /// </summary> protected override void DataDelete() { if (IsDeleted) { TrainService.DeleteRes(this); } if (Ress.Contains(this)) { Ress.Remove(this); } Dispose(); }
/// <summary> /// Deletes the object from the data store. /// </summary> protected override void DataDelete() { if (IsDeleted) { TrainService.DeleteField(this); } if (Fields.Contains(this)) { Fields.Remove(this); } Dispose(); }