/// <summary> /// Get Data from database /// </summary> /// <param name="album"></param> /// <returns></returns> public int AddAlbum(GB.News.Components.Entities.AlbumInfo album) { int rt=-1; //todo 1 store the album to database and store ContentItem to DataBase //todo 2 if process store error then store error in LogSystem dnn and throw an exception SqlServerDb.GetInstance().Insert(album); return rt; }
void AutoLink2MountPoint() { //动力组件会自动吸附能被看到的任何节点,而不是只吸附合法零件上的节点 //对于动力组件来说父节点永远为空,如果这个组件没有被拾取,不需要开启自动吸附 if (!be_picked) { return; } //每帧清空投影坐标列表: project_allMP.Clear(); //更新吸附的距离阈值 float auto_link_threshold = Screen.width * auto_link_threshold_scale; Debug.Log("auto_link_threshold = " + auto_link_threshold); for (int i = 0; i < mount_points.Count; i++) { MountPoint MP_now = mount_points[i]; if (MP_now.link_info[0] != -999) { Debug.LogError("严重错误:一个组件正在运行自动吸附,但是它的这个节点的信息没有被清空!" + MP_now.name); } else { Vector3 project_thisMP = Camera.main.WorldToScreenPoint(MP_now.transform.position); project_thisMP.z = 0; project_allMP.Add(project_thisMP); } } //节点的投影到另一个节点的投影的距离 float dis_self2mp = -1000f; //把所有位于设计平台上的零件的所有节点(不论是否合法)投影到虚拟平面上 foreach (var GB in unit_blueprint.all_parts) { Part part = GB.GetComponent <Part>(); if (part.transform == transform) { //如果找到的零件是自身,就跳过 continue; } //如果找到的零件不是自身,就开始投影--判断吸附的逻辑 foreach (var mp in part.mount_points) { //如果不是一个空节点,就跳过这个节点接着分析下一个节点 if (mp.link_info[0] != -999) { continue; } Vector3 this_mp_screen_pos = Camera.main.WorldToScreenPoint(mp.transform.position); #region 见的节点应该被屏蔽掉,还没写 //Ray ray = Camera.main.ScreenPointToRay(this_mp_screen_pos); //if (Physics.Raycast(ray,)) #endregion this_mp_screen_pos.z = 0; //对于自身每一个节点,都需要分别执行一次距离计算: for (int i = 0; i < project_allMP.Count; i++) { MountPoint self_MP_now = mount_points[i]; Vector3 project_thisMP = project_allMP[i]; float dis_self2mp_now = Vector3.Distance(project_thisMP, this_mp_screen_pos); if (dis_self2mp < 0) { dis_self2mp = dis_self2mp_now; } if (dis_self2mp_now <= auto_link_threshold) { //判断法线方向是否相符: if (mp.transform.forward == -1 * self_MP_now.transform.forward) { //法线方向吻合的话直接把两个零件互挂 bool b = self_MP_now.Link2MountPoint(mp); //正确的挂完了之后自动解除被拾取状态 if (b) { be_picked = false; unit_blueprint.mouse_picking_a_part = false; return; } } } } } } }
public override bool IsPlatformMatch(byte[] rom) { return(GB.VerifyLogo(rom, GbHeader.GbHeaderOffset)); }
/// <summary>Crea una nueva consola y la enlaza con la pantalla</summary> /// <param name="rom">Ruta al fichero del cartucho</param> private static void iniciarConsola(String rom) { try{ // Detiene cualquier emulacion previa if (_consola != null){ _consola.parar(); _pantalla.limpiar(); } _consola = new GB(rom); _consola.graphics.pantalla = _pantalla; menuItemConsolaIniciar.Sensitive = true; menuItemConsolaDebug.Sensitive = true; statusBar.Pop(0); statusBar.Push(0, _consola.cartucho.nombre); }catch(Exception e){ perifericos.Debug.WriteLine(e.Message); perifericos.Debug.WriteLine(e.StackTrace); } }
/// <summary> /// Validates VAT number /// </summary> /// <returns>Corrected VAT number in VatNumber object</returns> public static VatNumber Validate(string vat, EUCountry euCountry) { string countryCode = euCountry.ToString().ToUpper(); vat = vat.ToUpper(); CountryBase countryBase; switch (euCountry) { case EUCountry.AT: countryBase = new AT(); break; case EUCountry.BE: countryBase = new BE(); break; case EUCountry.BG: countryBase = new BG(); break; case EUCountry.CY: countryBase = new CY(); break; case EUCountry.CZ: countryBase = new CZ(); break; case EUCountry.DE: countryBase = new DE(); break; case EUCountry.DK: countryBase = new DK(); break; case EUCountry.EE: countryBase = new EE(); break; case EUCountry.EL: countryBase = new EL(); break; case EUCountry.ES: countryBase = new ES(); break; case EUCountry.FI: countryBase = new FI(); break; case EUCountry.FR: countryBase = new FR(); break; case EUCountry.GB: countryBase = new GB(); break; case EUCountry.HR: countryBase = new HR(); break; case EUCountry.HU: countryBase = new HU(); break; case EUCountry.IE: countryBase = new IE(); break; case EUCountry.IT: countryBase = new IT(); break; case EUCountry.LT: countryBase = new LT(); break; case EUCountry.LU: countryBase = new LU(); break; case EUCountry.LV: countryBase = new LV(); break; case EUCountry.MT: countryBase = new MT(); break; case EUCountry.NL: countryBase = new NL(); break; case EUCountry.PL: countryBase = new PL(); break; case EUCountry.PT: countryBase = new PT(); break; case EUCountry.RO: countryBase = new RO(); break; case EUCountry.SE: countryBase = new SE(); break; case EUCountry.SI: countryBase = new SI(); break; case EUCountry.SK: countryBase = new SK(); break; default: throw new InvalidCountryException(); } if (countryBase.StripLetters) { return(new VatNumber(euCountry, countryBase.Validate(Strip(vat)))); } return(new VatNumber(euCountry, countryBase.Validate(StripNoLetters(vat, countryCode)))); }