/// <summary> /// 插入实验模版 /// </summary> public void InsertTemplate() { string sql = "INSERT INTO ADMINISTRATOR.ThermalTestTemplate(TEMPLATENAME,UNITID,PARAID,SN,TEMPLATEID) VALUES('" + TemplateName + "','" + UnitID + "','" + ParaID + "'," + SN + "," + TemplateID + ")"; DataLink link = new DataLink(); link.Excute(sql); }
private List <DataLink> RecieveData(Message message) { List <DataLink> links = new List <DataLink>(); for (int i = 0; i < message.DataLinks.Count; i++) { DataLink current = message.DataLinks[i]; current.Adress = String.Format("({0}){1}", DateTime.Now.ToFileTime(), current.FileName); Log(String.Format("Data uploading by {0}: {1}", message.Author, current.Adress)); byte[] buffer; using (var write = File.OpenWrite(Path.Combine(data_folder, current.Adress))) { try { while ((buffer = users[message.Author].Upload(5000, 0)) != null) { write.Write(buffer, 0, buffer.Length); } } catch (Exception) { Log(String.Format("ERROR: failed to save {0} from user {1}", message.DataLinks[i].FileName, message.Author)); //throw new FaultException<ExceptionType>(ExceptionType.ErrorDuringDataTransfer); } } links.Add(current); } return(links); }
/// <summary> /// 返回报告模版编号 /// </summary> /// <param name="templateName">实验名</param> /// <param name="unitId">机组编号</param> /// <returns></returns> public int GetTemplateID(string templateName, string unitId) { DataTable dt = null; try { string sql = "SELECT TemplateID FROM ADMINISTRATOR.ThermalTestTemplate WHERE TemplateName='" + templateName + "' AND UNITID='" + unitId + "'"; if (unitId == "0") { if (templateName != "0") { sql = "SELECT TemplateID FROM ADMINISTRATOR.ThermalTestTemplate WHERE TemplateName='" + templateName + "'"; } else { return(0); } } //else //{ // if (templateName == "0") // sql = "SELECT TemplateID FROM ADMINISTRATOR.ThermalTestTemplate WHERE TemplateName='" + templateName + "'"; //} DataLink link = new DataLink(); dt = link.ExcuteRetureTable(sql); } catch (Exception ex) { throw ex; } return(Convert.ToInt32(dt.Rows[0][0])); }
protected virtual void SaveRequested(DataLink link, DataSet dataSet) { if (_link.DataField != null) { FieldValue = Image; } }
public void AddOrUpdateLink(DataLink dataLink, int stamp) { try { Node source = modelService.GetNode(dataLink.Source); if (!TryGetTarget(dataLink, out Node target)) { modelService.QueueNode(new DataNode(dataLink.Target, null, dataLink.TargetType)); return; } target.Stamp = stamp; if (TryGetLink(source, target, out Link link)) { // Already added link link.Stamp = stamp; return; } link = AddLink(source, target); link.Stamp = stamp; if (!dataLink.IsAdded) { AddLinkToLines(link); } } catch (Exception e) { Log.Exception(e, $"Failed to update link {dataLink}"); throw; } }
/** Make sure we can only accept items */ public override bool CanReceive(GuiComponent value) { if (DataLink == null) { return(true); } if (value == null) { return(false); } if (!Enabled) { return(false); } if (containsCursedItem() && DataLink.IsEquipSlot) { return(false); } if (value is GuiItem) { if ((value as GuiItem).ItemInstance == null) { return(true); } return(DataLink.CanAccept((value as GuiItem).ItemInstance)); } return(false); }
/// <summary> /// 控件值给DataLink /// </summary> /// <param name="dbType"></param> /// <param name="dbConn"></param> /// <param name="txtHostName"></param> /// <param name="txtUserName"></param> /// <param name="txtPwd"></param> /// <param name="txtPort"></param> /// <param name="txtServerName"></param> /// <param name="labServerName"></param> /// <returns></returns> public static DataLink ControlsToData(string dbType, TextBox txtHostName, TextBox txtUserName, TextBox txtPwd, TextBox txtPort, TextBox txtServerName, Label labServerName, bool isLink = false, TextBox txtLinkName = null) { var item = new DataLink(); item.dbType = dbType; item.hostName = txtHostName.Text.Trim(); item.userName = txtUserName.Text.Trim(); item.userPwd = txtPwd.Text.Trim(); item.port = txtPort.Text.Trim(); item.serverValue = txtServerName.Text.Trim(); item.serverName = labServerName.Content.ToString(); if (isLink) { if (txtLinkName.Text.Trim() == "") { item.linkName = GetLinkName(AppCache.GetBuildLink()); } else { item.linkName = txtLinkName.Text.Trim(); } } return(item); }
protected virtual void RowChanged(DataLink dataLink, DataSet dataSet, DataField field) { if (((field == null) || (field == _link.DataField)) && !_link.Modified && IsSetup()) { if ((field != null) && (field.ColumnName == ColumnName)) { using (IRow key = dataSet.GetKey()) { DBTreeNode node = FindNode(key); if (node != null) { node.Update(dataSet); } else { DataChanged(dataLink, dataSet); } } } else { DataChanged(dataLink, dataSet); } } }
void ProcessArrow(IDataConsumer dc, IObjectLabel label, Arrow arrow, List <Arrow> absc) { BlockPort bp = arrow.Source; string to = bp.Block; IObjectLabel l = desktop[to] as IObjectLabel; if (l == null) { return; } DataLink dl = new DataLink(); try { if (desktop is PureDesktopPeer) { PureDesktopPeer pdp = desktop as PureDesktopPeer; if (label.Ord < l.Ord) { absc.Add(arrow); return; } pdp.AddArrowWithExistingLabels(dl, label, l, "", ""); } } catch (Exception) { absc.Add(arrow); } }
protected internal void PerformDefault(DataLink link, EventParams paramsValue) { if (_enabled && link.Active) { InternalPerformDefault(link, _targetColumns.Split(';', ','), paramsValue); } }
private void FocusControl(DataLink link, DataSet dataSet, DataField field) { if (field == DataField) { Focus(); } }
public override void InitByDataLink(DataLink link) { base.InitByDataLink(link); foreach (var p in link.DataLinkParameter.Cast <DataLinkParameter>().Where(p => !p.LinkField)) { if (!string.IsNullOrEmpty(p.ObjectField) && string.IsNullOrEmpty(p.Expression)) { var path = p.ObjectField.LastIndexOf('.') > -1 ? p.ObjectField.Substring(0, p.ObjectField.LastIndexOf('.')) : ""; if (!SimpleFields.Keys.Contains(path)) { SimpleFields.Add(path, new MapSimpleField(RootType, p.LayerField, p.ObjectField, BasePrefix)); } else { SimpleFields[path].Add(p.LayerField, p.ObjectField); } } else { var expressionField = new MapExpressionField(RootType, p.LayerField, p.Expression, BasePrefix); ExpressionFields.Add(expressionField); } } }
//GET: Admin/Password public ActionResult ChangePassword() { try { ChangePassword cp = new ChangePassword(); string cookieName = FormsAuthentication.FormsCookieName; HttpCookie authCookie = HttpContext.Request.Cookies[cookieName]; FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value); string emailAddress = ticket.Name; cp.user.Email = emailAddress; if (CheckForRootAdmin(emailAddress)) { ViewBag.isAdmin = true; return(View(cp)); } else { ViewBag.isAdmin = false; return(View(cp)); } } catch (Exception e) { DataLink.LogError(e); throw; } }
protected virtual void MasterRowChanged(DataLink lInk, DataSet dataSet, DataField field) { if (Active && ((field == null) || MasterKey.Columns.Contains(field.ColumnName))) { CursorSetChanged(null, false); } }
protected virtual void MasterDataChanged(DataLink link, DataSet dataSet) { if (Active) { CursorSetChanged(null, false); } }
protected virtual void MasterPrepareToCancel(DataLink link, DataSet dataSet) { if (Active) { EnsureBrowseState(false); } }
//GET: Admin/PasswordOverride public ActionResult PasswordOverride(int?id) { try { AdminChangePassword change = new AdminChangePassword(); if (id != null) { Users user = ViewModels.GetUser(id); change.user.Email = user.Email; } string emailAddress = GetEmailFromToken(FormsAuthentication.FormsCookieName); if (CheckForRootAdmin(emailAddress)) { ViewBag.isAdmin = true; return(View(change)); } else { ViewBag.isAdmin = false; return(View(change)); } } catch (Exception e) { DataLink.LogError(e); throw; } }
protected override void InternalPerformDefault(DataLink link, string[] targetColumns, EventParams paramsValue) { if (_sourceValueExpressions != null) { for (int i = 0; i < Math.Min(_sourceValueExpressions.Count, targetColumns.Length); i++) { var targetField = link.DataSet[targetColumns[i].Trim()]; var source = (ValueExpression)_sourceValueExpressions[i]; switch (source.Token) { case TokenType.Boolean: targetField.AsBoolean = (bool)source.Value; break; case TokenType.Decimal: targetField.AsDecimal = (decimal)source.Value; break; case TokenType.Integer: targetField.AsInt32 = (int)source.Value; break; case TokenType.Money: targetField.AsDecimal = (decimal)source.Value; break; case TokenType.Nil: targetField.ClearValue(); break; case TokenType.String: targetField.AsString = (string)source.Value; break; } } } }
private static void AddDiskSpacePreset() { int driveCount = DataDiskSpace.GetDriveCount(); DataLink[] dataLink; if (driveCount > 1 && driveCount <= 4) { dataLink = new DataLink[driveCount]; for (int i = 0; i < driveCount; i++) { dataLink[i] = new DataLink(); dataLink[i].DataIndex = i; dataLink[i].DataClassRef = DataManager.GetDataClassRef("Disk Space"); } } else { dataLink = new DataLink[1]; dataLink[0].DataIndex = 0; dataLink[0].DataClassRef = DataManager.GetDataClassRef("Disk Space"); } IconManager.AddIcon("Disk Space", "{iconname}", dataLink, Globals.colorPresets[8].BackgroundColor, Globals.colorPresets[8].ForegroundColor); }
protected virtual void MasterPrepareToPost(DataLink link, DataSet dataSet) { if (Active) { EnsureBrowseState(); } }
protected virtual void Update() { if (gameObject.activeInHierarchy == false) { return; } DoCanvas(false); if (mGenerateOnNextUpdate == true) // complete redraw preceeds realtime { GenerateChart(); } else if (mRealtimeOnNextUpdate) { GenerateRealtime(); InvokeOnRedraw(); } mGenerateOnNextUpdate = false; // graph is invalidated set this back to false mRealtimeOnNextUpdate = false; DataLink.Update(); if (IsCanvas) { RectTransform trans = GetComponent <RectTransform>(); if (trans != null && trans.hasChanged) { if (mLastSetSize != trans.rect.size) { Invalidate(); } } } }
private static void AddDiskAccessPreset() { int driveCount = DataDiskAccess.GetHardDriveCount(); DataLink[] dataLink; if (driveCount > 1 && driveCount <= 4) { dataLink = new DataLink[driveCount]; for (int i = 0; i < driveCount; i++) { dataLink[i] = new DataLink(); dataLink[i].DataIndex = i + 1; dataLink[i].DataClassRef = DataManager.GetDataClassRef("Disk Access"); } } else { dataLink = new DataLink[1]; dataLink[0].DataIndex = 0; dataLink[0].DataClassRef = DataManager.GetDataClassRef("Disk Access"); } IconManager.AddIcon("Disk Access", "{iconname}", dataLink, Globals.colorPresets[10].BackgroundColor, Globals.colorPresets[10].ForegroundColor); }
protected void Page_Load(object sender, EventArgs e) { if (Request["submit"] != null) { string firstName = Request["firstName"]; string lastName = Request["lastName"]; string password = Request["userPassword"]; string email = Request["email"]; string id = Request["id"]; if (DataLink.IsEmailRegistered(email)) { serverResponse = string.Format("'{0}' is already registered", email); } else if (DataLink.IsIDRegistered(id)) { serverResponse = string.Format("'{0}' is already registered", id); } else { DataLink.AddUser(email, firstName, lastName, password, id); serverResponse = "User created"; AccessControl.LogIn(this, email, false); Response.Redirect("Homepage.aspx"); } } }
public void InitByDataLink(DataLink link) { Layer = $@"{link.LayerTable}"; RootType = TGHelper.ObjectType(link); TriggerKey = Regex.Replace(link.__PrimaryKey.ToString(), @"[^a-zA-Z]", string.Empty); if (TriggerKey.Length > 20) { TriggerKey = TriggerKey.Substring(0, 20); } foreach (var p in link.DataLinkParameter.Cast <DataLinkParameter>().Where(p => !p.LinkField)) { if (!string.IsNullOrEmpty(p.ObjectField) && string.IsNullOrEmpty(p.Expression)) { AddSimpleField(p.LayerField, p.ObjectField); } else { var match = Regex.Match(p.Expression, @"@(.+?)@"); int i = 0; while (match.Success) { AddSimpleField(p.LayerField + i++, match.Groups[1].Value); match = match.NextMatch(); } } } }
public override void InitByDataLink(DataLink link) { base.InitByDataLink(link); var hasher = System.Security.Cryptography.MD5.Create(); var hashdata = hasher.ComputeHash(System.Text.Encoding.Default.GetBytes($"procedure_unjoin_{TriggerKey}")); ProcedureName = string.Concat(hashdata.Select(b => b.ToString("x2")).ToArray()); Chain = new Chain(RootType, BasePrefix); GenerateCreateObjectTrigger = link.CreateObject; foreach (var p in link.DataLinkParameter.Cast <DataLinkParameter>().Where(p => !p.LinkField)) { if (!string.IsNullOrEmpty(p.ObjectField) && string.IsNullOrEmpty(p.Expression)) { Chain.Add(p.ObjectField); if (!SimpleFields.ContainsKey(p.LayerField)) { SimpleFields.Add(p.LayerField, p.ObjectField); } } else { var expressionField = new MapExpressionField(RootType, p.LayerField, p.Expression); ExpressionFields.Add(expressionField); foreach (var path in expressionField.Paths) { Chain.Add(path); } } } }
protected override void OnConstruct() { base.OnConstruct(); MainGraphic = new MetaModel { XMesh = new MeshConcretize { MeshDescription = new Graphics.Software.Meshes.MeshFromHeightmap { Grid = new Graphics.Software.Meshes.Grid { Position = Vector3.Zero, MeshType = MeshType.Indexed, Size = Size, NWidth = (int)((Ground.Heightmap.GetLength(1) - 1) * HeightmapSelection.Width), NHeight = (int)((Ground.Heightmap.GetLength(0) - 1) * HeightmapSelection.Height), }, Height = Ground.Height, Heightmap = heightmapLink = new DataLink <Graphics.Software.Texel.R32F[, ]>(Ground.Heightmap), Rectangle = HeightmapSelection, PointSample = true }, Layout = global::Graphics.Software.Vertex.PositionNormalTexcoord.Instance }, Texture = new TextureConcretizer { Texture = global::Graphics.Software.ITexture.SingleColorTexture(Common.Int2Color.Conv(color)) } }; }
public virtual async Task <DataLinkDto> CreateDataLinkAsync(int accountId, DataLinkDto dataLinkDto) { try { var prefetch = await PrefetchAndValidate(accountId, dataLinkDto); var dataLink = new DataLink { FromSubscriptionId = dataLinkDto.FromSubscriptionId, From = prefetch.From, ToSubscriptionId = dataLinkDto.ToSubscriptionId, To = prefetch.To, DataLinkTypeId = dataLinkDto.DataLinkTypeId, Type = prefetch.Type }; _db.DataLinks.Add(dataLink); await _db.SaveChangesAsync(); return(_mapper.Map <DataLinkDto>(dataLink)); } catch (DbException e) { throw new PersistenceException($"An error occurred while creating the DataLink ({nameof(accountId)} = {accountId}, {nameof(dataLinkDto)} = {JsonConvert.SerializeObject(dataLinkDto)})", e); } }
protected virtual void StateChanged(DataLink link, DataSet dataSet) { if (_link.Active) { if (_process == null) { StartProcess(); } else { if ((dataSet is DataView) && (!_aTJoined ^ (((DataView)dataSet).ApplicationTransactionServer == null))) { StopProcess(); StartProcess(); } } } else { StopProcess(); } if (!_autoRefresh) { UpdateTree(); } }
static public void UpdateExcelFromCADTable() { Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = doc.Editor; PromptEntityOptions peo = new PromptEntityOptions("\n 请选择你用来更新Excel的表格:"); peo.SetRejectMessage("\n选取实体不是表格!"); peo.AddAllowedClass(typeof(Table), false); PromptEntityResult per = ed.GetEntity(peo); if (per.Status != PromptStatus.OK) { return; } // 开启事务处理 using (Transaction trans = db.TransactionManager.StartTransaction()) { try { DBObject obj = trans.GetObject(per.ObjectId, OpenMode.ForRead) as DBObject; Table tb = obj as Table; if (tb != null) { tb.UpgradeOpen(); // 从CAD表格数据更新链接数据 tb.UpdateDataLink(UpdateDirection.DataToSource, UpdateOption.ForceFullSourceUpdate); // 由链接数据更新Excel表格 ObjectId dlId = tb.GetDataLink(0, 0); DataLink dl = trans.GetObject(dlId, OpenMode.ForWrite) as DataLink; dl.Update(UpdateDirection.DataToSource, UpdateOption.ForceFullSourceUpdate); } trans.Commit(); ed.WriteMessage("\n 已经成功由CAD表格更新Excel表格数据!"); } catch (Exception ex) { ed.WriteMessage( "\nException: {0}", ex.Message ); } } }
static public void UpdateCADTableFromExcel() { // 获取当前文档 数据库 命令行 Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = doc.Editor; // 定义一个交互提示选项 并设置提示内容 PromptEntityOptions peo = new PromptEntityOptions("\n请选择需要更新的表格:"); peo.SetRejectMessage("\n选取实体不是表格!"); // 选择实体类型只能是表格 peo.AddAllowedClass(typeof(Table), false); // 获取实体结果返回 PromptEntityResult per = ed.GetEntity(peo); // 判断选取状态 if (per.Status != PromptStatus.OK) { return; } // 开启事务处理 using (Transaction trans = db.TransactionManager.StartTransaction()) { try { // 获取表格对象 DBObject obj = trans.GetObject(per.ObjectId, OpenMode.ForRead) as DBObject; Table tb = obj as Table; // 检查是否是表格 if (tb != null) { // 升级打开方式 以写的方式 tb.UpgradeOpen(); // 从Excel表格数据更新链接数据 ObjectId dlId = tb.GetDataLink(0, 0); DataLink dl = trans.GetObject(dlId, OpenMode.ForWrite) as DataLink; // 更新数据 dl.Update(UpdateDirection.SourceToData, UpdateOption.None); // 从链接数据更新到CAD表格 tb.UpdateDataLink(UpdateDirection.SourceToData, UpdateOption.None); } trans.Commit(); ed.WriteMessage("\n已经成功从Excel电子表中更新CAD表格数据!"); } catch (Exception ex) { ed.WriteMessage("\nException: {0}", ex.Message); } } }
public DecryptedDevice(ICryptoHandler cryptographyHandler, IDevice device) { if (cryptographyHandler == null) { throw new ArgumentNullException(nameof(cryptographyHandler)); } if (device == null) { throw new ArgumentNullException(nameof(device)); } this.CryptographyHandler = cryptographyHandler; this.inputLink = new DataLink(); this.inputLink.CommandReceived += this.OnInputLinkCommandReceived; this.inputLink.CorruptCommandReceived += this.OnInputLinkCorruptCommandReceived; this.inputLink.AbortRequested += this.OnInputLinkAbortRequested; this.outputLink = new DataLink(); this.outputLink.CommandReceived += this.OnOutputLinkCommandReceived; this.outputLink.CorruptCommandReceived += this.OnOutputLinkCorruptCommandReceived; this.outputLink.AbortRequested += this.OnOutputLinkAbortRequested; this.device = device; this.device.Output += this.OnDeviceOutput; }
private static void AddCpuPerset() { int coreCount = Environment.ProcessorCount; DataLink[] dataLink; if (coreCount > 1 && coreCount <= 4) { dataLink = new DataLink[coreCount]; for (int i = 0; i < coreCount; i++) { dataLink[i] = new DataLink(); dataLink[i].DataIndex = i + 1; dataLink[i].DataClassRef = DataManager.GetDataClassRef("CPU"); } } else { dataLink = new DataLink[1]; dataLink[0].DataIndex = 0; dataLink[0].DataClassRef = DataManager.GetDataClassRef("CPU"); } IconManager.AddIcon("CPU", "{iconname} - {CPU%0}%", dataLink, Globals.colorPresets[12].BackgroundColor, Globals.colorPresets[12].ForegroundColor); }
private static void AddBatteryPreset() { DataLink[] dataLink = new DataLink[1]; dataLink[0] = new DataLink(); dataLink[0].DataIndex = 0; dataLink[0].DataClassRef = DataManager.GetDataClassRef("Battery"); IconManager.AddIcon("Battery", "{iconname} - {Battery%0}%", dataLink, Globals.colorPresets[4].BackgroundColor, Globals.colorPresets[4].ForegroundColor); }
public string AddSermon(string title, string descr, string by, string seriesID, string sermonPlace, string sermonDate, string audioLink, string imageLink, string videoLink, string artLink, string artSmallLink) { var json = ""; DataLink DBLink = new DataLink(); try { if (DBLink.AddSermon(NVL(title), NVL(descr), by, NVL(seriesID, "0"), NVL(sermonPlace), NVL(sermonDate, DateTime.Now.Date.ToString()), audioLink, NVL(imageLink), NVL(videoLink), artLink, artSmallLink)) json = "Success"; else json = "Failed"; } catch (Exception) { json = "Failed"; } return json; }
private void LoadSermon() { DataLink link = new DataLink(); dsSermon = link.GetSermon(sermonID).Tables[0]; #region Sermon Details Loading sermonName = GetCV(dsSermon, "SermonName"); sermonBy = GetCV(dsSermon, "SermonBy"); sermonDate = GetCV(dsSermon, "SermonDate"); sermonDesc = GetCV(dsSermon, "SermonDescription"); sermonImageLink = GetCV(dsSermon, "ImageLink"); sermonAudioLink = GetCV(dsSermon, "AudioLink"); sermonVideoLink = GetCV(dsSermon, "VideoLink"); sermonArtLink = GetCV(dsSermon, "ArtLink"); #endregion }
/// <summary> /// Creates a PacketBuilder that can build packets according to the given layers and with different timestamps. /// The layers' properties can be modified after the builder is built and this will affect the packets built. /// </summary> /// <param name="layers">The layers to build the packet accordingly and by their order.</param> public PacketBuilder(params ILayer[] layers) { if (layers == null) throw new ArgumentNullException("layers"); if (layers.Length == 0) throw new ArgumentException("At least one layer must be given", "layers"); DataLinkKind? dataLinkKind = layers[0].DataLink; if (dataLinkKind == null) throw new ArgumentException("First layer (" + layers[0].GetType() + ") must provide a DataLink", "layers"); _layers = layers; _dataLink = new DataLink(dataLinkKind.Value); }
private void ValidateSermon(string sermonid) { // DataLink link = new DataLink(); if (link.ValidateSermon(sermonid)) { if ((new DataLink()).GetSeriesForSermon(sermonID) != "0") { _isSeries = true; seriesID = (new DataLink()).GetSeriesForSermon(sermonID); } } else sermonID = "latest"; }
protected override void OnConstruct() { base.OnConstruct(); MainGraphic = new MetaModel { XMesh = new MeshConcretize { MeshDescription = new Graphics.Software.Meshes.MeshFromHeightmap { Grid = new Graphics.Software.Meshes.Grid { Position = Vector3.Zero, MeshType = MeshType.Indexed, Size = Size, NWidth = (int)((Ground.Heightmap.GetLength(1) - 1) * HeightmapSelection.Width), NHeight = (int)((Ground.Heightmap.GetLength(0) - 1) * HeightmapSelection.Height), UVMin = new Vector2(HeightmapSelection.X, HeightmapSelection.Y), UVMax = new Vector2(HeightmapSelection.X + HeightmapSelection.Width, HeightmapSelection.Y + HeightmapSelection.Height) }, Height = Ground.Height, Heightmap = heightmapLink = new DataLink<Graphics.Software.Texel.R32F[,]>(Ground.Heightmap), Rectangle = HeightmapSelection, PointSample = true }, Layout = global::Graphics.Software.Vertex.PositionNormalTexcoord.Instance }, //SplatMapped = true, //SplatTexutre = new[] { new TextureFromFile { FileName = "splatting.png" } }, //MaterialTexture = new[] { new TextureFromFile { FileName = "grass1.png" }, new TextureFromFile { FileName = "grass1.png" }, // new TextureFromFile { FileName = "moss1.png" }, new TextureFromFile { FileName = "sand1.png" }}, //BaseTexture = new TextureFromFile { FileName = "grass1.png" } Texture = new TextureConcretizer { Texture = global::Graphics.Software.ITexture.SingleColorTexture(Color) } }; }
public string GetSlideImages() { DataLink DBLink = new DataLink(); var json = DataTableToString(DBLink.GetSlides()); //Get slide image links from DB //Filter the image slide according to their dates return json; }
protected override void OnConstruct() { base.OnConstruct(); MainGraphic = new MetaModel { XMesh = new MeshConcretize { MeshDescription = new Graphics.Software.Meshes.MeshFromHeightmap { Grid = new Graphics.Software.Meshes.Grid { Position = Vector3.Zero, MeshType = MeshType.Indexed, Size = Size, NWidth = (int)((Ground.Heightmap.GetLength(1) - 1) * HeightmapSelection.Width), NHeight = (int)((Ground.Heightmap.GetLength(0) - 1) * HeightmapSelection.Height), }, Height = Ground.Height, Heightmap = heightmapLink = new DataLink<Graphics.Software.Texel.R32F[,]>(Ground.Heightmap), Rectangle = HeightmapSelection, PointSample = true }, Layout = global::Graphics.Software.Vertex.PositionNormalTexcoord.Instance }, Texture = new TextureConcretizer { Texture = global::Graphics.Software.ITexture.SingleColorTexture(Common.Int2Color.Conv(color)) } }; }
private void ValidateSeries(string seriesid) { // DataLink link = new DataLink(); if (link.ValidateSeries(seriesid)) _isSeries = true; else _isSeries = false; }
private void GetSermon(string sermonid) { DataLink link = new DataLink(); dsSermon = link.GetSermon(sermonid).Tables[0]; }
public string SaveSermon(string title, string desc, string by, string seriesID, string place, string date, string audio, string image, string video, string art, string artsml) { DataLink dl = new DataLink(); return dl.AddSermon(title, desc, by, seriesID, place, date, audio, image, video, art, artsml).ToString(); }
private static void AddRamPerset() { DataLink[] dataLink = new DataLink[1]; dataLink[0] = new DataLink(); dataLink[0].DataIndex = 0; dataLink[0].DataClassRef = DataManager.GetDataClassRef("Memory"); IconManager.AddIcon("Memory", "{iconname} - {Memory%0}%" + Environment.NewLine + Environment.NewLine + "{Memory#!0} - {Memory*!0}", dataLink, Globals.colorPresets[11].BackgroundColor, Globals.colorPresets[11].ForegroundColor); }
public string GetSermons() { DataLink link = new DataLink(); return Newtonsoft.Json.JsonConvert.SerializeObject(link.GetSermons()); }
private void GetSeries(string seriesid) { DataLink link = new DataLink(); dsSeries = link.GetSeries(seriesid); }
public string GetSpeakers() { DataLink DBLink = new DataLink(); var json = DataTableToString(DBLink.GetSpeakers().Tables[0]); return json; }
private void GetSermons() { DataLink link = new DataLink(); dsSermons = link.GetSermons(); }
protected override void OnConstruct() { base.OnConstruct(); if (Ground != null) { float gs = Ground.HeightmapHeightStep; float scalingSnapped = gs * (float)Math.Round(scaling / gs); var gridSize = new Vector2(scalingSnapped, scalingSnapped); var center = Position - Common.Math.ToVector3(gridSize / 2f); Translation = Ground.SnapToHeightmap(center); var transOffset = center - Translation; if (heightmapLink == null) { heightmapLink = new DataLink<Graphics.Software.Texel.R32F[,]>(Ground.Heightmap); heightmapLink.Version = Ground.CurrentHeightMapVersion; } else UpdateMesh(); Matrix? uvTransform = null; uvTransform = Matrix.Invert( Matrix.Translation(-0.5f, -0.5f, 0) * Matrix.RotationZ(orientation) * Matrix.Scaling(0.707106781f * scaling / scalingSnapped, 0.707106781f * scaling / scalingSnapped, 1) * Matrix.Translation(transOffset.X / gridSize.X, transOffset.Y / gridSize.Y, 0) * Matrix.Translation(0.5f, 0.5f, 0) ); ((MetaModel)MainGraphic).XMesh = new MeshConcretize { MeshDescription = new Graphics.Software.Meshes.MeshFromHeightmap3 { Grid = new Graphics.Software.Meshes.Grid { Position = Vector3.UnitZ * EditorHeight, MeshType = MeshType.Indexed, Size = gridSize, NWidth = (int)Math.Round(gridSize.X / Ground.HeightmapWidthStep), NHeight = (int)Math.Round(gridSize.Y / Ground.HeightmapHeightStep), UVMin = new Vector2(0, 0), UVMax = new Vector2(1, 1), UVTransform = uvTransform }, Height = Ground.Height, Heightmap = heightmapLink, HeightmapLayout = new RectangleF(0, 0, Ground.Size.Width, Ground.Size.Height), PointSample = PointSampleHeightMap, HeightmapReadPosition = translation }, Layout = global::Graphics.Software.Vertex.PositionNormalTexcoord.Instance }; VisibilityLocalBounding = CreateBoundingBoxFromModel((MetaModel)MainGraphic); PickingLocalBounding = CreateBoundingMeshFromModel((MetaModel)MainGraphic); } }
protected override void OnConstruct() { base.OnConstruct(); if (Ground != null) { Matrix uvMove = Matrix.Identity; if (SnapSizeToHeightmap) size = Common.Math.ToVector2(Ground.SnapToHeightmap(Common.Math.ToVector3(Size))); Vector3 positionOffset = Vector3.Zero; if (SnapPositionToHeightmap == DecalSnapping.Snap || SnapPositionToHeightmap == DecalSnapping.SnapAndUVAntiSnap) { positionOffset = Translation - Ground.SnapToHeightmap(Translation); if (SnapPositionToHeightmap == DecalSnapping.SnapAndUVAntiSnap) { var d = new Vector3(positionOffset.X / Size.X, positionOffset.Y / Size.Y, 0); uvMove = Matrix.Translation(-d); } GridPosition = Ground.SnapToHeightmap(GridPosition); } if (SnapGridResolutionToHeightmap) { GridResolution = new Size( (int)Math.Round(Size.X / Ground.HeightmapWidthStep), (int)Math.Round(Size.Y / Ground.HeightmapHeightStep) ); } if (heightmapLink == null) { heightmapLink = new DataLink<Graphics.Software.Texel.R32F[,]>(Ground.Heightmap); heightmapLink.Version = Ground.CurrentHeightMapVersion; } else UpdateMesh(); Vector2 uvmin_ = UVMin, uvmax_ = UVMax; Matrix? uvTransform = null; if (RotateUV) uvTransform = uvMove * Matrix.Invert(Matrix.Translation(-0.5f, -0.5f, 0) * Matrix.RotationZ(orientation) * Matrix.Translation(0.5f, 0.5f, 0)); ((MetaModel)MainGraphic).XMesh = new MeshConcretize { MeshDescription = new Graphics.Software.Meshes.MeshFromHeightmap2 { Grid = new Graphics.Software.Meshes.Grid { Position = GridPosition - positionOffset, MeshType = MeshType.Indexed, Size = Size, NWidth = GridResolution.Width, NHeight = GridResolution.Height, UVMin = uvmin_, UVMax = uvmax_, UVTransform = uvTransform }, Height = Ground.Height, Heightmap = heightmapLink, HeightmapLayout = new RectangleF(0, 0, Ground.Size.Width, Ground.Size.Height), PointSample = PointSampleHeightMap, CombinedWorld = CombinedWorldMatrix }, Layout = global::Graphics.Software.Vertex.PositionNormalTexcoord.Instance }; VisibilityLocalBounding = CreateBoundingBoxFromModel((MetaModel)MainGraphic); PickingLocalBounding = CreateBoundingMeshFromModel((MetaModel)MainGraphic); } }
private static void AddNetworkPreset() { DataLink[] dataLink = new DataLink[2]; dataLink[0] = new DataLink(); dataLink[1] = new DataLink(); dataLink[0].DataIndex = 0; dataLink[0].DataClassRef = DataManager.GetDataClassRef("Network Interface"); dataLink[1].DataIndex = 1; dataLink[1].DataClassRef = DataManager.GetDataClassRef("Network Interface"); IconManager.AddIcon("Network", "{iconname}" + Environment.NewLine + Environment.NewLine + "{Network Interface#!0} - {Network Interface*!0}" + Environment.NewLine + "{Network Interface#!1} - {Network Interface*!1}", dataLink, Globals.colorPresets[2].BackgroundColor, Globals.colorPresets[2].ForegroundColor); }
protected override void OnConstruct() { base.OnConstruct(); if (Ground != null) { Matrix combinedWorld = ((MetaModel)MainGraphic).World * CombinedWorldMatrix; Matrix? uvTransform = null; Vector3 positionOffset = Vector3.Zero; Matrix? gridTransform = null; if (RotateUV) { gridTransform = Matrix.Translation(-0.5f, -0.5f, 0) * Matrix.RotationZ(-orientation) * Matrix.Translation(0.5f, 0.5f, 0); combinedWorld = gridTransform.Value * combinedWorld; } Matrix invCombinedWorld = Matrix.Invert(combinedWorld); Vector3 rawPosition = Vector3.TransformCoordinate(Vector3.Zero, combinedWorld); if (SnapPositionToHeightmap == DecalSnapping.Snap || SnapPositionToHeightmap == DecalSnapping.SnapAndUVAntiSnap) { Vector3 snappedPosition = Ground.SnapToHeightmap(rawPosition); snappedPosition.Z = 0; positionOffset = Vector3.TransformCoordinate(snappedPosition, invCombinedWorld); positionOffset.Z = Common.Math.Position(((MetaModel)MainGraphic).World).Z; if (SnapPositionToHeightmap == DecalSnapping.SnapAndUVAntiSnap) { var d = new Vector3(positionOffset.X, positionOffset.Y, 0); uvTransform = Matrix.Translation(d); } } Vector2 planeSize = new Vector2(1, 1); Vector3 size; Quaternion rotation; Vector3 position; combinedWorld.Decompose(out size, out rotation, out position); if (SnapSizeToHeightmap != DecalSnapping.None) { Vector3 snappedSize = Ground.SnapToHeightmap(size); planeSize = new Vector2(snappedSize.X / size.X, snappedSize.Y / size.Y); if (SnapSizeToHeightmap == DecalSnapping.SnapAndUVAntiSnap) { uvTransform = Matrix.Scaling(planeSize.X, planeSize.Y, 0) * (uvTransform.HasValue ? uvTransform.Value : Matrix.Identity); } size = snappedSize; } if (SnapGridResolutionToHeightmap) { GridResolution = new Size( (int)Math.Floor(size.X / Ground.HeightmapWidthStep), (int)Math.Floor(size.Y / Ground.HeightmapHeightStep) ); } if (heightmapLink == null) { heightmapLink = new DataLink<Graphics.Software.Texel.R32F[,]>(Ground.Heightmap); heightmapLink.Version = Ground.CurrentHeightMapVersion; } else UpdateMesh(); Vector2 uvmin_ = UVMin, uvmax_ = UVMax; if (RotateUV) { uvTransform = (uvTransform.HasValue ? uvTransform.Value : Matrix.Identity) * Matrix.Translation(-0.5f, -0.5f, 0) * Matrix.RotationZ(orientation) * Matrix.Translation(0.5f, 0.5f, 0); } if (GridResolution.Width < 1 || GridResolution.Height < 1) { ((MetaModel)MainGraphic).XMesh = null; return; } ((MetaModel)MainGraphic).XMesh = new MeshConcretize { MeshDescription = new Graphics.Software.Meshes.MeshFromHeightmap2 { Grid = new Graphics.Software.Meshes.Grid { Position = positionOffset, MeshType = MeshType.Indexed, Size = planeSize, NWidth = GridResolution.Width, NHeight = GridResolution.Height, UVMin = uvmin_, UVMax = uvmax_, UVTransform = uvTransform, Transform = gridTransform }, Height = Ground.Height, Heightmap = heightmapLink, HeightmapLayout = new RectangleF(0, 0, Ground.Size.Width, Ground.Size.Height), PointSample = PointSampleHeightMap, CombinedWorld = (gridTransform.HasValue ? Matrix.Invert(gridTransform.Value) : Matrix.Identity) * combinedWorld }, Layout = global::Graphics.Software.Vertex.PositionNormalTexcoord.Instance }; VisibilityLocalBounding = CreateBoundingBoxFromModel((MetaModel)MainGraphic); PickingLocalBounding = CreateBoundingMeshFromModel((MetaModel)MainGraphic); } }