public static void delet(Models.Alunos pAluno) { DataBase db = getDataBase(); var query = from e in db.Estrelas where e.IdAluno == pAluno.IdAluno select e; db.Estrelas.DeleteOnSubmit(query.ToList()[0]); db.SubmitChanges(); }
public ActionResult SaveSalesDelivery(Models.ViewModels.Sales.SalesDeliveryViewModel model) { var salesDelivery = new SalesDeliveryHeader() { CustomerId = model.CustomerId, PaymentTermId = model.PaymentTermId, Date = model.Date, CreatedBy = User.Identity.Name, CreatedOn = DateTime.Now, ModifiedBy = User.Identity.Name, ModifiedOn = DateTime.Now, }; foreach(var line in model.SalesDeliveryLines) { salesDelivery.SalesDeliveryLines.Add(new SalesDeliveryLine() { ItemId = line.ItemId, MeasurementId = line.MeasurementId, Quantity = line.Quantity, Discount = line.Discount, Price = line.Quantity * line.Price, CreatedBy = User.Identity.Name, CreatedOn = DateTime.Now, ModifiedBy = User.Identity.Name, ModifiedOn = DateTime.Now, }); } _salesService.AddSalesDelivery(salesDelivery, true); return RedirectToAction("SalesDeliveries"); }
public override void Import(Models.Repository repository, System.IO.Stream zipStream, bool @override) { List<string> schemaNames = new List<string>(); Dictionary<string, Schema> oldSchemas = new Dictionary<string, Schema>(); using (var zipFile = ZipFile.Read(zipStream)) { foreach (var entry in zipFile.Entries) { if (entry.FileName.IndexOf('/') == entry.FileName.Length - 1) { var schemaName = entry.FileName.Substring(0, entry.FileName.Length - 1); schemaNames.Add(schemaName); oldSchemas[schemaName] = this.Get(new Schema(repository, schemaName)); } } } zipStream.Position = 0; base.Import(repository, zipStream, @override); foreach (var name in schemaNames) { var oldSchema = oldSchemas[name]; var newSchema = this.Get(new Models.Schema(repository, name)); if (oldSchema != null) { SchemaManager.Update(newSchema, oldSchema); } else { Initialize(newSchema); } } }
public static Models.ValidationResult AddGroup(Models.Group group, int userId) { using (var uow = new DAL.UnitOfWork()) { var validationResult = ValidateGroup(group, true); if (validationResult.IsValid) { uow.GroupRepository.Insert(group); validationResult.IsValid = uow.Save(); //If Group management is being used add this group to the allowed users list var userManagedGroups = BLL.UserGroupManagement.Get(userId); if (userManagedGroups.Count > 0) BLL.UserGroupManagement.AddUserGroupManagements( new List<Models.UserGroupManagement> { new Models.UserGroupManagement { GroupId = group.Id, UserId = userId } }); } return validationResult; } }
public int Post(Models.MstItemGroup itemgroup) { try { var isLocked = true; var identityUserId = User.Identity.GetUserId(); var mstUserId = (from d in db.MstUsers where "" + d.Id == identityUserId select d.Id).SingleOrDefault(); var date = DateTime.Now; Data.MstItemGroup newItemGroup = new Data.MstItemGroup(); // newItemGroup.ItemGroup = itemgroup.ItemGroup; newItemGroup.ImagePath = itemgroup.ImagePath; newItemGroup.KitchenReport = itemgroup.KitchenReport; newItemGroup.EntryUserId = mstUserId; newItemGroup.EntryDateTime = date; newItemGroup.UpdateUserId = mstUserId; newItemGroup.UpdateDateTime = date; newItemGroup.IsLocked = isLocked; // db.MstItemGroups.InsertOnSubmit(newItemGroup); db.SubmitChanges(); return newItemGroup.Id; } catch { return 0; } }
public static void AddCharacter(Models.Character character) { var query = new MySqlCommand("INSERT INTO characters (id, account, nickname, level, experience, sex, breed, skincolor," + " haircolor, pupilcolor, skincolorfactor, haircolorfactor, cloth, face, title) VALUES " + "(@id, @account, @nickname, @level, @experience, @sex, @breed, @skincolor, @haircolor," + " @pupilcolor, @skincolorfactor, @haircolorfactor, @cloth, @face, @title)", DatabaseManager.Connection); query.Parameters.Add(new MySqlParameter("@id", character.ID)); query.Parameters.Add(new MySqlParameter("@account", character.Account)); query.Parameters.Add(new MySqlParameter("@nickname", character.Nickname)); query.Parameters.Add(new MySqlParameter("@level", character.Level)); query.Parameters.Add(new MySqlParameter("@experience", character.Experience)); query.Parameters.Add(new MySqlParameter("@sex", character.Sex)); query.Parameters.Add(new MySqlParameter("@breed", character.Breed)); query.Parameters.Add(new MySqlParameter("@skincolor", character.SkinColor)); query.Parameters.Add(new MySqlParameter("@haircolor", character.HairColor)); query.Parameters.Add(new MySqlParameter("@pupilcolor", character.PupilColor)); query.Parameters.Add(new MySqlParameter("@skincolorfactor", character.SkinColorFactor)); query.Parameters.Add(new MySqlParameter("@haircolorfactor", character.HairColorFactor)); query.Parameters.Add(new MySqlParameter("@cloth", character.Cloth)); query.Parameters.Add(new MySqlParameter("@face", character.Face)); query.Parameters.Add(new MySqlParameter("@title", character.Title)); query.ExecuteNonQuery(); Characters.Add(character); }
public ClientPartitionHelper(Models.ImageProfile imageProfile) { string schema = null; if (imageProfile != null) { _imageProfile = imageProfile; if (imageProfile.PartitionMethod == "Dynamic" && !string.IsNullOrEmpty(imageProfile.CustomSchema)) { schema = imageProfile.CustomSchema; } else { var path = Settings.PrimaryStoragePath + "images" + Path.DirectorySeparatorChar + imageProfile.Image.Name + Path.DirectorySeparatorChar + "schema"; if (File.Exists(path)) { using (var reader = new StreamReader(path)) { schema = reader.ReadLine() ?? ""; } } } } if (!string.IsNullOrEmpty(schema)) { _imageSchema = JsonConvert.DeserializeObject<Models.ImageSchema.ImageSchema>(schema); } }
public ActionResult List(Models.User.ListModel.SearchQuery query) { var size = 30; query.Page = Math.Max(1, query.Page); var user = _UserMangaer.GetUser(CurrentUser.Uid); if (user.Role < UserRoles.Admin) return RedirectToAction("index", "index"); var result = _UserMangaer.SearchUser(query); var count = result.Count(); if (query.Page > 1) result = result.Skip((query.Page - 1) * size); result = result.Take(size); var model = new Models.User.ListModel { Query = query, Items = new Core.PageModel<Models.User.ListModel.Item>(result.Select(r => new Models.User.ListModel.Item { Email = r.email, IsEnabled = r.enabled, Name = r.name, Uid = r.uid, Registered = r.created, Role = r.role }), query.Page, (int)Math.Ceiling((double)count / (double)size), count) }; return View(model); }
public void add(Models.Author author) { using (BookLibrary dc = new BookLibrary(connectionString, mapping)) { dc.addAuthor(author.Id, author.name); } }
public string Generate(Repository repository, Models.DataRuleSetting dataRule, bool inlineEdit) { if (dataRule.DataRule is DataRuleBase) { var dataRuleBase = (DataRuleBase)dataRule.DataRule; var schema = dataRuleBase.GetSchema(repository).AsActual(); string html = @" <div> <h3 class=""title""{3}><%= ViewBag.{0}.{1}%></h3> <div class=""content""> {2} </div> </div>"; string columnTp = @" <div{2}> <%= ViewBag.{1}.{0}%> </div> "; var titleField = schema.GetSummarizeColumn().Name; var editField = " <%:ViewHelper.Edit(ViewBag.{0},\"{1}\")%>"; schema = schema.AsActual(); StringBuilder sb = new StringBuilder(); foreach (var column in schema.Columns) { if (!column.Name.EqualsOrNullEmpty(titleField, StringComparison.CurrentCultureIgnoreCase)) { sb.AppendFormat(columnTp, column.Name, dataRule.DataName, inlineEdit ? string.Format(editField, dataRule.DataName, column.Name) : ""); } } return string.Format(html, dataRule.DataName, schema.GetSummarizeColumn().Name, sb.ToString(), inlineEdit ? string.Format(editField, dataRule.DataName, titleField) : ""); } return string.Empty; }
public int Post(Models.MstUser user) { try { var isLocked = true; var identityUserId = User.Identity.GetUserId(); var mstUserId = (from d in db.MstUsers where "" + d.Id == identityUserId select d.Id).SingleOrDefault(); var date = DateTime.Now; Data.MstUser newUser = new Data.MstUser(); newUser.UserName = user.UserName; newUser.IsLocked = isLocked; newUser.Password = user.Password; newUser.FullName = user.FullName; newUser.UserCardNumber = user.UserCardNumber; newUser.EntryUserId = mstUserId; newUser.EntryDateTime = date; newUser.UpdateUserId = mstUserId; newUser.UpdateDateTime = date; db.MstUsers.InsertOnSubmit(newUser); db.SubmitChanges(); return newUser.Id; } catch { return 0; } }
public void Save(Models.EmployeeCost cost) { if (cost.IsNew) base.CreatePostRequest(cost); else base.CreatePutRequest(cost.Id, cost); }
protected bool Equals(Models.Character other) { return Number == other.Number && Priority == other.Priority && string.Equals(Logograph, other.Logograph) && string.Equals(Pronunciation, other.Pronunciation) && Equals(ReviewTime, other.ReviewTime) && Equals(Definitions, other.Definitions) && Equals(Usages, other.Usages) && Equals(Phrases, other.Phrases) && Equals(Idioms, other.Idioms); }
public void AddCompileResult(Models.CompileCommandResult result) { if (InvokeRequired) { this.Invoke(new AddCompileResultDelegate(AddCompileResult), new object[] { result }); return; } if (result.IsSuccess){ result.ResultText = "success"; } List<Models.CompileCommandResult> compileResults = (List<Models.CompileCommandResult>)compileResultsDataGridView.DataSource; compileResults.Insert(0, result); compileResultsDataGridView_DataChanged(); if (result.IsSuccess && Program.Settings.ShowSuccessMessages) { ShowSuccessNotification("Successful compile", result.ResultText); } else if(!result.IsSuccess) { ShowErrorNotification("Compile error", result.ResultText); } }
public Task AddTask(HttpRequestMessage requestMessage, Models.Task newTask) { return new Task { Subject = "In v2, newTask.Subject = " + newTask.Subject }; }
public IEnumerable<Page> All(Models.Site site) { List<Page> results = new List<Page>(); while (site != null) { var tempResults = QueryBySite(site); if (results.Count == 0) { results.AddRange(tempResults); } else { foreach (var item in tempResults) { if (!results.Any(it => it.Name.Equals(item.Name, StringComparison.InvariantCultureIgnoreCase))) { results.Add(item); } } } site = site.Parent; } return results; }
public int Post(Models.SysAuditTrail audittrail) { try { var identityUserId = User.Identity.GetUserId(); var mstUserId = (from d in db.MstUsers where "" + d.Id == identityUserId select d.Id).SingleOrDefault(); Data.SysAuditTrail newAuditTrail = new Data.SysAuditTrail(); // newAuditTrail.UserId = mstUserId; newAuditTrail.AuditDate = Convert.ToDateTime(audittrail.AuditDate); newAuditTrail.TableInformation = audittrail.TableInformation; newAuditTrail.RecordInformation = audittrail.RecordInformation; newAuditTrail.FormInformation = audittrail.FormInformation; newAuditTrail.ActionInformation = audittrail.ActionInformation; // db.SysAuditTrails.InsertOnSubmit(newAuditTrail); db.SubmitChanges(); return newAuditTrail.Id; } catch { return 0; } }
// [Authorize(Roles = "customer")] public ActionResult ShowOrderWorkflow(string viewName, Models.Order order) { var workflowList = SaleService.GetWorkflow(order); SetupUrl(workflowList); ViewData.Model = workflowList; return PartialView(viewName); }
// [Authorize(Roles = "customer")] public ActionResult ShowQuoteWorkflow(string viewName, Models.Quote quote) { var workflowList = SaleService.GetWorkflow(quote); SetupUrl(workflowList); ViewData.Model = workflowList; return PartialView(viewName); }
public string saveTransaction(Models.EntryModel model) { using (var transaction=_ctx.Database.BeginTransaction()) { try { Guid salesId = Guid.NewGuid(); SalesMaster salesMaster = new SalesMaster(); salesMaster.id = salesId; salesMaster.timeStamp = model.TimeStamp; salesMaster.location_name = model.LocationName; salesMaster.sale_invoice_number = model.InvoiceNo; salesMaster.total_sales_amount = model.TotalAmount; salesMaster.currency = model.Currency; List<SalesDetail> sales = model.SalesDetails.Select(a => new SalesDetail() { ProductId = a.Id, SalesMasterId = salesId, Quantity = a.Quantity }).ToList(); sales.ForEach(s => _ctx.salesDetail.Add(s)); _ctx.salesMaster.Add(salesMaster); _ctx.SaveChanges(); transaction.Commit(); return salesId.ToString(); } catch { transaction.Rollback(); return null; } } }
public DeleteViewModel Fill(Models.Rsvp rsvp) { Id = rsvp.Id; Name = rsvp.Name; return this; }
public ActionResult AddDetail(Models.LedgerAddDetailModel model) { using (db00ccd2da5aff4a5983c0a17b010f53a6Entities context = new db00ccd2da5aff4a5983c0a17b010f53a6Entities()) { var theLedger = context.Ledgers.FirstOrDefault(l => l.LedgerId == model.LedgerId); if (theLedger == default(Ledger)) { return View("ErrorMessage", new Models.ErrorMessageModel { Title = "No Such Ledger!", Message = "The ledger you are attempting to access does not exist in the database.", ReturnAction = "Index", ReturnRouteValues = new { } }); } else if (theLedger.UserProfile.UserName != User.Identity.Name && theLedger.Editors.FirstOrDefault(u => u.UserName == User.Identity.Name) == default(UserProfile)) { return View("ErrorMessage", new Models.ErrorMessageModel { Title = "No Permission!", Message = "You are neither the owner nor an editor of the ledger you are attempting to access.", ReturnAction = "Index", ReturnRouteValues = new { } }); } var theDetail = new LedgerDetail(); theDetail.Amount = model.Amount; theDetail.Legder_LedgerId = model.LedgerId; theDetail.Memo = model.Memo; theDetail.Payor = model.Payor; theDetail.PaySource = model.PaySource; theDetail.Category = model.Category; theDetail.When = model.When; theLedger.LedgerDetails.Add(theDetail); context.SaveChanges(); return RedirectToAction("Detail", new { id=model.LedgerId }); } }
private void RenderBody(Models.RenderingModel model, StringBuilder sbHtml) { sbHtml.AppendLine("<tbody>"); foreach (var row in model.Rows) { sbHtml.Append("<tr"); AppendCssAttribute(row.CalculatedCssClass, sbHtml); sbHtml.AppendLine(">"); foreach (var col in model.Columns) { var cell = row.Cells[col.Name]; sbHtml.Append("<td"); AppendCssAttribute(cell.CalculatedCssClass, sbHtml); sbHtml.Append(">"); sbHtml.Append(cell.HtmlText); sbHtml.Append("</td>"); } sbHtml.AppendLine(" </tr>"); } sbHtml.AppendLine("</tbody>"); }
public Int32 insertAccountCategory(Models.MstAccountCategory accountCategory) { try { var userId = (from d in db.MstUsers where d.UserId == User.Identity.GetUserId() select d.Id).SingleOrDefault(); Data.MstAccountCategory newAccountCategory = new Data.MstAccountCategory(); newAccountCategory.AccountCategoryCode = accountCategory.AccountCategoryCode; newAccountCategory.AccountCategory = accountCategory.AccountCategory; newAccountCategory.IsLocked = accountCategory.IsLocked; newAccountCategory.CreatedById = userId; newAccountCategory.CreatedDateTime = DateTime.Now; newAccountCategory.UpdatedById = userId; newAccountCategory.UpdatedDateTime = DateTime.Now; db.MstAccountCategories.InsertOnSubmit(newAccountCategory); db.SubmitChanges(); return newAccountCategory.Id; } catch { return 0; } }
public int AddApp(XXF.Db.DbConn PubConn, Models.DbModels.app model) { if (string.IsNullOrEmpty(model.appid)) { model.appid = XXF.Db.LibString.MakeRandomNumber(16).ToLower(); } if (ExitAppid(PubConn, model.appid)) { return -2; } if (string.IsNullOrEmpty(model.appsecret)) { model.appsecret = Guid.NewGuid().ToString().Replace("-", ""); } string sql = "insert into app(appid,appname,apptype,appgradeno,appsecret,appdesc,freeze) values(@appid,@appname,@apptype,@appgradeno,@appsecret,@appdesc,@freeze)"; XXF.Db.SimpleProcedureParameter para = new XXF.Db.SimpleProcedureParameter(); para.Add("@appid", model.appid); para.Add("@appsecret", model.appsecret); para.Add("@appname", model.appname); para.Add("@apptype", model.apptype); para.Add("@appgradeno", model.appgradeno); para.Add("@freeze", model.freeze); para.Add("@appdesc", model.appdesc ?? ""); int r = PubConn.ExecuteSql(sql, para.ToParameters()); return r; }
public void Save(Models.ConsumableUsage model) { if(model.IsNew) base.CreatePostRequest(model); else base.CreatePutRequest(model.Id, model); }
//public Models.SearchResult<Models.ConsumableUsage> Search(Models.DateRangeSearchInfo searchInfo) //{ // string url = string.Format("{0}?page={1}&limit={2}&start={3}&end={4}", // ResourceUrl, searchInfo.PageIndex, searchInfo.PageSize, searchInfo.Start, searchInfo.End); // return CreateGetRequest<SearchResult<Models.ConsumableUsage>>(Guid.Empty, url); //} public Models.SearchResult<Models.ConsumableUsage> Search(Models.ConsumableUsageSearchInfo searchInfo) { string url = string.Format("{0}?page={1}&limit={2}&start={3}&end={4}", ResourceUrl ,searchInfo.PageIndex, searchInfo.PageSize, searchInfo.Start, searchInfo.End); return CreateGetRequest<SearchResult<ConsumableUsage>>(Guid.Empty, url); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Models.m_announcement_user model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into m_announcement_user("); strSql.Append("ANNOUNCEMENT_ID,USER_ACCOUNT,STATUS)"); strSql.Append(" values ("); strSql.Append("@ANNOUNCEMENT_ID,@USER_ACCOUNT,@STATUS)"); SqlParameter[] parameters = { new SqlParameter("@ANNOUNCEMENT_ID", SqlDbType.UniqueIdentifier,16), new SqlParameter("@USER_ACCOUNT", SqlDbType.NVarChar,50), new SqlParameter("@STATUS", SqlDbType.NVarChar,50)}; parameters[0].Value = model.ANNOUNCEMENT_ID; parameters[1].Value = model.USER_ACCOUNT; parameters[2].Value = model.STATUS; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return true; } else { return false; } }
public string CloudUpload(Models.RegisterBindingModel user) { if (HandleFileUpload(ref user)) { Account acount = new Account("gigantor", "986286566519458", "GT87e1BTMnfLut1_gXhSH0giZPg"); Cloudinary cloudinary = new Cloudinary(acount); string userId = this.User.Identity.GetUserId(); ApplicationUser user1 = db.Users.Find(userId); if (user1.ProfilePicUrl != null && user1.ProfilePicUrl.StartsWith("http://res.cloudinary.com/gigantor/image/upload/")) //this block of code deletes the previous image if the user had one { //this here is just a string manipulation to get to the ImageID from cloudinary string assist = "http://res.cloudinary.com/gigantor/image/upload/"; string part1 = user1.ProfilePicUrl.Remove(user1.ProfilePicUrl.IndexOf(assist), assist.Length); string part2 = part1.Remove(0, 12); string toDelete = part2.Remove(part2.Length - 4); cloudinary.DeleteResources(toDelete); //this finally deletes the image } user1.ProfilePicUrl = CloudinaryUpload(user); db.Entry(user1).State = EntityState.Modified; db.SaveChanges(); return user1.ProfilePicUrl; } return user.ProfileUrl; }
public ActionResult AddEditor(Models.LedgerAddEditorModel model) { using (db00ccd2da5aff4a5983c0a17b010f53a6Entities context = new db00ccd2da5aff4a5983c0a17b010f53a6Entities()) { var theLedger = context.Ledgers.FirstOrDefault(l => l.LedgerId == model.LedgerId); if (theLedger == default(Ledger)) { return View("ErrorMessage", new Models.ErrorMessageModel { Title = "No Such Ledger!", Message = "The ledger you are attempting to access does not exist in the database.", ReturnAction = "Index", ReturnRouteValues = new { } }); } else if (theLedger.UserProfile.UserName != User.Identity.Name) { return View("ErrorMessage", new Models.ErrorMessageModel { Title = "No Permission!", Message = "You are not the owner of the ledger you are attempting to access.", ReturnAction = "Index", ReturnRouteValues = new { } }); } var theUser = context.UserProfiles.FirstOrDefault(u => u.UserName == model.EditorName); if (theUser == default(UserProfile)) { return View("ErrorMessage", new Models.ErrorMessageModel { Title = "No Such User!", Message = "The user you are attempting to add does not exist in the database.", ReturnAction = "Editors", ReturnRouteValues = new { id= model.LedgerId } }); } if (theLedger.Editors.Any(u => u.UserId == theUser.UserId)) { return View("ErrorMessage", new Models.ErrorMessageModel { Title = "User Already an Editor!", Message = "The user you are attempting to add is already an editor.", ReturnAction = "Editors", ReturnRouteValues = new { id=model.LedgerId } }); } theLedger.Editors.Add(theUser); context.SaveChanges(); return RedirectToAction("Editors", new { id = model.LedgerId }); } }
protected OutcomeOverviewModel FindModel(IEvent payload) => Models.FirstOrDefault(o => o.Key.Equals(payload.AggregateKey));
private void ResolveBindings() { Models.Resolve(); Agents.Resolve(); Views.Resolve(); }
public override void ReadDataXML(XElement ele, ElderScrollsPlugin master) { XElement subEle; if (ele.TryPathTo("EditorID", false, out subEle)) { if (EditorID == null) { EditorID = new SimpleSubrecord <String>(); } EditorID.ReadXML(subEle, master); } if (ele.TryPathTo("ObjectBounds", false, out subEle)) { if (ObjectBounds == null) { ObjectBounds = new ObjectBounds(); } ObjectBounds.ReadXML(subEle, master); } if (ele.TryPathTo("Name", false, out subEle)) { if (Name == null) { Name = new SimpleSubrecord <String>(); } Name.ReadXML(subEle, master); } if (ele.TryPathTo("Model", false, out subEle)) { if (Model == null) { Model = new Model(); } Model.ReadXML(subEle, master); } if (ele.TryPathTo("ActorEffects", false, out subEle)) { if (ActorEffects == null) { ActorEffects = new List <RecordReference>(); } foreach (XElement e in subEle.Elements()) { RecordReference tempSPLO = new RecordReference(); tempSPLO.ReadXML(e, master); ActorEffects.Add(tempSPLO); } } if (ele.TryPathTo("Unarmed/AttackEffect", false, out subEle)) { if (UnarmedAttackEffect == null) { UnarmedAttackEffect = new RecordReference(); } UnarmedAttackEffect.ReadXML(subEle, master); } if (ele.TryPathTo("Unarmed/AttackAnimation", false, out subEle)) { if (UnarmedAttackAnimation == null) { UnarmedAttackAnimation = new SimpleSubrecord <UInt16>(); } UnarmedAttackAnimation.ReadXML(subEle, master); } if (ele.TryPathTo("Models", false, out subEle)) { if (Models == null) { Models = new SubNullStringList(); } Models.ReadXML(subEle, master); } if (ele.TryPathTo("TextureHashes", false, out subEle)) { if (TextureHashes == null) { TextureHashes = new SimpleSubrecord <Byte[]>(); } TextureHashes.ReadXML(subEle, master); } if (ele.TryPathTo("BaseStats", false, out subEle)) { if (BaseStats == null) { BaseStats = new CreatureBaseStats(); } BaseStats.ReadXML(subEle, master); } if (ele.TryPathTo("Factions", false, out subEle)) { if (Factions == null) { Factions = new List <FactionMembership>(); } foreach (XElement e in subEle.Elements()) { FactionMembership tempSNAM = new FactionMembership(); tempSNAM.ReadXML(e, master); Factions.Add(tempSNAM); } } if (ele.TryPathTo("DeathItem", false, out subEle)) { if (DeathItem == null) { DeathItem = new RecordReference(); } DeathItem.ReadXML(subEle, master); } if (ele.TryPathTo("VoiceType", false, out subEle)) { if (VoiceType == null) { VoiceType = new RecordReference(); } VoiceType.ReadXML(subEle, master); } if (ele.TryPathTo("Template", false, out subEle)) { if (Template == null) { Template = new RecordReference(); } Template.ReadXML(subEle, master); } if (ele.TryPathTo("Destructable", false, out subEle)) { if (Destructable == null) { Destructable = new Destructable(); } Destructable.ReadXML(subEle, master); } if (ele.TryPathTo("Script", false, out subEle)) { if (Script == null) { Script = new RecordReference(); } Script.ReadXML(subEle, master); } if (ele.TryPathTo("Contents", false, out subEle)) { if (Contents == null) { Contents = new List <InventoryItem>(); } foreach (XElement e in subEle.Elements()) { InventoryItem tempCNTO = new InventoryItem(); tempCNTO.ReadXML(e, master); Contents.Add(tempCNTO); } } if (ele.TryPathTo("AIData", false, out subEle)) { if (AIData == null) { AIData = new AIData(); } AIData.ReadXML(subEle, master); } if (ele.TryPathTo("Packages", false, out subEle)) { if (Packages == null) { Packages = new List <RecordReference>(); } foreach (XElement e in subEle.Elements()) { RecordReference tempPKID = new RecordReference(); tempPKID.ReadXML(e, master); Packages.Add(tempPKID); } } if (ele.TryPathTo("Animations", false, out subEle)) { if (Animations == null) { Animations = new SubNullStringList(); } Animations.ReadXML(subEle, master); } if (ele.TryPathTo("Data", false, out subEle)) { if (Data == null) { Data = new CreatureData(); } Data.ReadXML(subEle, master); } if (ele.TryPathTo("AttackReach", false, out subEle)) { if (AttackReach == null) { AttackReach = new SimpleSubrecord <Byte>(); } AttackReach.ReadXML(subEle, master); } if (ele.TryPathTo("CombatStyle", false, out subEle)) { if (CombatStyle == null) { CombatStyle = new RecordReference(); } CombatStyle.ReadXML(subEle, master); } if (ele.TryPathTo("BodyPartData", false, out subEle)) { if (BodyPartData == null) { BodyPartData = new RecordReference(); } BodyPartData.ReadXML(subEle, master); } if (ele.TryPathTo("TurningSpeed", false, out subEle)) { if (TurningSpeed == null) { TurningSpeed = new SimpleSubrecord <Single>(); } TurningSpeed.ReadXML(subEle, master); } if (ele.TryPathTo("BaseScale", false, out subEle)) { if (BaseScale == null) { BaseScale = new SimpleSubrecord <Single>(); } BaseScale.ReadXML(subEle, master); } if (ele.TryPathTo("FootWeight", false, out subEle)) { if (FootWeight == null) { FootWeight = new SimpleSubrecord <Single>(); } FootWeight.ReadXML(subEle, master); } if (ele.TryPathTo("ImpactMaterialType", false, out subEle)) { if (ImpactMaterialType == null) { ImpactMaterialType = new SimpleSubrecord <MaterialTypeUInt>(); } ImpactMaterialType.ReadXML(subEle, master); } if (ele.TryPathTo("SoundLevel", false, out subEle)) { if (SoundLevel == null) { SoundLevel = new SimpleSubrecord <SoundLevel>(); } SoundLevel.ReadXML(subEle, master); } if (ele.TryPathTo("SoundTemplate", false, out subEle)) { if (SoundTemplate == null) { SoundTemplate = new RecordReference(); } SoundTemplate.ReadXML(subEle, master); } if (ele.TryPathTo("SoundData", false, out subEle)) { if (SoundData == null) { SoundData = new List <CreatureSoundData>(); } foreach (XElement e in subEle.Elements()) { CreatureSoundData tempCSDT = new CreatureSoundData(); tempCSDT.ReadXML(e, master); SoundData.Add(tempCSDT); } } if (ele.TryPathTo("ImpactDataset", false, out subEle)) { if (ImpactDataset == null) { ImpactDataset = new RecordReference(); } ImpactDataset.ReadXML(subEle, master); } if (ele.TryPathTo("MeleeWeaponList", false, out subEle)) { if (MeleeWeaponList == null) { MeleeWeaponList = new RecordReference(); } MeleeWeaponList.ReadXML(subEle, master); } }
public override void WriteDataXML(XElement ele, ElderScrollsPlugin master) { XElement subEle; if (EditorID != null) { ele.TryPathTo("EditorID", true, out subEle); EditorID.WriteXML(subEle, master); } if (ObjectBounds != null) { ele.TryPathTo("ObjectBounds", true, out subEle); ObjectBounds.WriteXML(subEle, master); } if (Name != null) { ele.TryPathTo("Name", true, out subEle); Name.WriteXML(subEle, master); } if (Model != null) { ele.TryPathTo("Model", true, out subEle); Model.WriteXML(subEle, master); } if (ActorEffects != null) { ele.TryPathTo("ActorEffects", true, out subEle); List <string> xmlNames = new List <string> { "ActorEffect" }; int i = 0; ActorEffects.Sort(); foreach (var entry in ActorEffects) { i = i % xmlNames.Count(); XElement newEle = new XElement(xmlNames[i]); entry.WriteXML(newEle, master); subEle.Add(newEle); i++; } } if (UnarmedAttackEffect != null) { ele.TryPathTo("Unarmed/AttackEffect", true, out subEle); UnarmedAttackEffect.WriteXML(subEle, master); } if (UnarmedAttackAnimation != null) { ele.TryPathTo("Unarmed/AttackAnimation", true, out subEle); UnarmedAttackAnimation.WriteXML(subEle, master); } if (Models != null) { ele.TryPathTo("Models", true, out subEle); Models.WriteXML(subEle, master); } if (TextureHashes != null) { ele.TryPathTo("TextureHashes", true, out subEle); TextureHashes.WriteXML(subEle, master); } if (BaseStats != null) { ele.TryPathTo("BaseStats", true, out subEle); BaseStats.WriteXML(subEle, master); } if (Factions != null) { ele.TryPathTo("Factions", true, out subEle); List <string> xmlNames = new List <string> { "Faction" }; int i = 0; Factions.Sort(); foreach (var entry in Factions) { i = i % xmlNames.Count(); XElement newEle = new XElement(xmlNames[i]); entry.WriteXML(newEle, master); subEle.Add(newEle); i++; } } if (DeathItem != null) { ele.TryPathTo("DeathItem", true, out subEle); DeathItem.WriteXML(subEle, master); } if (VoiceType != null) { ele.TryPathTo("VoiceType", true, out subEle); VoiceType.WriteXML(subEle, master); } if (Template != null) { ele.TryPathTo("Template", true, out subEle); Template.WriteXML(subEle, master); } if (Destructable != null) { ele.TryPathTo("Destructable", true, out subEle); Destructable.WriteXML(subEle, master); } if (Script != null) { ele.TryPathTo("Script", true, out subEle); Script.WriteXML(subEle, master); } if (Contents != null) { ele.TryPathTo("Contents", true, out subEle); List <string> xmlNames = new List <string> { "Item" }; int i = 0; Contents.Sort(); foreach (var entry in Contents) { i = i % xmlNames.Count(); XElement newEle = new XElement(xmlNames[i]); entry.WriteXML(newEle, master); subEle.Add(newEle); i++; } } if (AIData != null) { ele.TryPathTo("AIData", true, out subEle); AIData.WriteXML(subEle, master); } if (Packages != null) { ele.TryPathTo("Packages", true, out subEle); List <string> xmlNames = new List <string> { "Package" }; int i = 0; foreach (var entry in Packages) { i = i % xmlNames.Count(); XElement newEle = new XElement(xmlNames[i]); entry.WriteXML(newEle, master); subEle.Add(newEle); i++; } } if (Animations != null) { ele.TryPathTo("Animations", true, out subEle); Animations.WriteXML(subEle, master); } if (Data != null) { ele.TryPathTo("Data", true, out subEle); Data.WriteXML(subEle, master); } if (AttackReach != null) { ele.TryPathTo("AttackReach", true, out subEle); AttackReach.WriteXML(subEle, master); } if (CombatStyle != null) { ele.TryPathTo("CombatStyle", true, out subEle); CombatStyle.WriteXML(subEle, master); } if (BodyPartData != null) { ele.TryPathTo("BodyPartData", true, out subEle); BodyPartData.WriteXML(subEle, master); } if (TurningSpeed != null) { ele.TryPathTo("TurningSpeed", true, out subEle); TurningSpeed.WriteXML(subEle, master); } if (BaseScale != null) { ele.TryPathTo("BaseScale", true, out subEle); BaseScale.WriteXML(subEle, master); } if (FootWeight != null) { ele.TryPathTo("FootWeight", true, out subEle); FootWeight.WriteXML(subEle, master); } if (ImpactMaterialType != null) { ele.TryPathTo("ImpactMaterialType", true, out subEle); ImpactMaterialType.WriteXML(subEle, master); } if (SoundLevel != null) { ele.TryPathTo("SoundLevel", true, out subEle); SoundLevel.WriteXML(subEle, master); } if (SoundTemplate != null) { ele.TryPathTo("SoundTemplate", true, out subEle); SoundTemplate.WriteXML(subEle, master); } if (SoundData != null) { ele.TryPathTo("SoundData", true, out subEle); List <string> xmlNames = new List <string> { "Sound" }; int i = 0; foreach (var entry in SoundData) { i = i % xmlNames.Count(); XElement newEle = new XElement(xmlNames[i]); entry.WriteXML(newEle, master); subEle.Add(newEle); i++; } } if (ImpactDataset != null) { ele.TryPathTo("ImpactDataset", true, out subEle); ImpactDataset.WriteXML(subEle, master); } if (MeleeWeaponList != null) { ele.TryPathTo("MeleeWeaponList", true, out subEle); MeleeWeaponList.WriteXML(subEle, master); } }
public override void WriteData(ESPWriter writer) { if (EditorID != null) { EditorID.WriteBinary(writer); } if (ObjectBounds != null) { ObjectBounds.WriteBinary(writer); } if (Name != null) { Name.WriteBinary(writer); } if (Model != null) { Model.WriteBinary(writer); } if (ActorEffects != null) { ActorEffects.Sort(); foreach (var item in ActorEffects) { item.WriteBinary(writer); } } if (UnarmedAttackEffect != null) { UnarmedAttackEffect.WriteBinary(writer); } if (UnarmedAttackAnimation != null) { UnarmedAttackAnimation.WriteBinary(writer); } if (Models != null) { Models.WriteBinary(writer); } if (TextureHashes != null) { TextureHashes.WriteBinary(writer); } if (BaseStats != null) { BaseStats.WriteBinary(writer); } if (Factions != null) { Factions.Sort(); foreach (var item in Factions) { item.WriteBinary(writer); } } if (DeathItem != null) { DeathItem.WriteBinary(writer); } if (VoiceType != null) { VoiceType.WriteBinary(writer); } if (Template != null) { Template.WriteBinary(writer); } if (Destructable != null) { Destructable.WriteBinary(writer); } if (Script != null) { Script.WriteBinary(writer); } if (Contents != null) { Contents.Sort(); foreach (var item in Contents) { item.WriteBinary(writer); } } if (AIData != null) { AIData.WriteBinary(writer); } if (Packages != null) { foreach (var item in Packages) { item.WriteBinary(writer); } } if (Animations != null) { Animations.WriteBinary(writer); } if (Data != null) { Data.WriteBinary(writer); } if (AttackReach != null) { AttackReach.WriteBinary(writer); } if (CombatStyle != null) { CombatStyle.WriteBinary(writer); } if (BodyPartData != null) { BodyPartData.WriteBinary(writer); } if (TurningSpeed != null) { TurningSpeed.WriteBinary(writer); } if (BaseScale != null) { BaseScale.WriteBinary(writer); } if (FootWeight != null) { FootWeight.WriteBinary(writer); } if (ImpactMaterialType != null) { ImpactMaterialType.WriteBinary(writer); } if (SoundLevel != null) { SoundLevel.WriteBinary(writer); } if (SoundTemplate != null) { SoundTemplate.WriteBinary(writer); } if (SoundData != null) { foreach (var item in SoundData) { item.WriteBinary(writer); } } if (ImpactDataset != null) { ImpactDataset.WriteBinary(writer); } if (MeleeWeaponList != null) { MeleeWeaponList.WriteBinary(writer); } }
public override void ReadData(ESPReader reader, long dataEnd) { while (reader.BaseStream.Position < dataEnd) { string subTag = reader.PeekTag(); switch (subTag) { case "EDID": if (EditorID == null) { EditorID = new SimpleSubrecord <String>(); } EditorID.ReadBinary(reader); break; case "OBND": if (ObjectBounds == null) { ObjectBounds = new ObjectBounds(); } ObjectBounds.ReadBinary(reader); break; case "FULL": if (Name == null) { Name = new SimpleSubrecord <String>(); } Name.ReadBinary(reader); break; case "MODL": if (Model == null) { Model = new Model(); } Model.ReadBinary(reader); break; case "SPLO": if (ActorEffects == null) { ActorEffects = new List <RecordReference>(); } RecordReference tempSPLO = new RecordReference(); tempSPLO.ReadBinary(reader); ActorEffects.Add(tempSPLO); break; case "EITM": if (UnarmedAttackEffect == null) { UnarmedAttackEffect = new RecordReference(); } UnarmedAttackEffect.ReadBinary(reader); break; case "EAMT": if (UnarmedAttackAnimation == null) { UnarmedAttackAnimation = new SimpleSubrecord <UInt16>(); } UnarmedAttackAnimation.ReadBinary(reader); break; case "NIFZ": if (Models == null) { Models = new SubNullStringList(); } Models.ReadBinary(reader); break; case "NIFT": if (TextureHashes == null) { TextureHashes = new SimpleSubrecord <Byte[]>(); } TextureHashes.ReadBinary(reader); break; case "ACBS": if (BaseStats == null) { BaseStats = new CreatureBaseStats(); } BaseStats.ReadBinary(reader); break; case "SNAM": if (Factions == null) { Factions = new List <FactionMembership>(); } FactionMembership tempSNAM = new FactionMembership(); tempSNAM.ReadBinary(reader); Factions.Add(tempSNAM); break; case "INAM": if (DeathItem == null) { DeathItem = new RecordReference(); } DeathItem.ReadBinary(reader); break; case "VTCK": if (VoiceType == null) { VoiceType = new RecordReference(); } VoiceType.ReadBinary(reader); break; case "TPLT": if (Template == null) { Template = new RecordReference(); } Template.ReadBinary(reader); break; case "DEST": if (Destructable == null) { Destructable = new Destructable(); } Destructable.ReadBinary(reader); break; case "SCRI": if (Script == null) { Script = new RecordReference(); } Script.ReadBinary(reader); break; case "CNTO": if (Contents == null) { Contents = new List <InventoryItem>(); } InventoryItem tempCNTO = new InventoryItem(); tempCNTO.ReadBinary(reader); Contents.Add(tempCNTO); break; case "AIDT": if (AIData == null) { AIData = new AIData(); } AIData.ReadBinary(reader); break; case "PKID": if (Packages == null) { Packages = new List <RecordReference>(); } RecordReference tempPKID = new RecordReference(); tempPKID.ReadBinary(reader); Packages.Add(tempPKID); break; case "KFFZ": if (Animations == null) { Animations = new SubNullStringList(); } Animations.ReadBinary(reader); break; case "DATA": if (Data == null) { Data = new CreatureData(); } Data.ReadBinary(reader); break; case "RNAM": if (AttackReach == null) { AttackReach = new SimpleSubrecord <Byte>(); } AttackReach.ReadBinary(reader); break; case "ZNAM": if (CombatStyle == null) { CombatStyle = new RecordReference(); } CombatStyle.ReadBinary(reader); break; case "PNAM": if (BodyPartData == null) { BodyPartData = new RecordReference(); } BodyPartData.ReadBinary(reader); break; case "TNAM": if (TurningSpeed == null) { TurningSpeed = new SimpleSubrecord <Single>(); } TurningSpeed.ReadBinary(reader); break; case "BNAM": if (BaseScale == null) { BaseScale = new SimpleSubrecord <Single>(); } BaseScale.ReadBinary(reader); break; case "WNAM": if (FootWeight == null) { FootWeight = new SimpleSubrecord <Single>(); } FootWeight.ReadBinary(reader); break; case "NAM4": if (ImpactMaterialType == null) { ImpactMaterialType = new SimpleSubrecord <MaterialTypeUInt>(); } ImpactMaterialType.ReadBinary(reader); break; case "NAM5": if (SoundLevel == null) { SoundLevel = new SimpleSubrecord <SoundLevel>(); } SoundLevel.ReadBinary(reader); break; case "CSCR": if (SoundTemplate == null) { SoundTemplate = new RecordReference(); } SoundTemplate.ReadBinary(reader); break; case "CSDT": if (SoundData == null) { SoundData = new List <CreatureSoundData>(); } CreatureSoundData tempCSDT = new CreatureSoundData(); tempCSDT.ReadBinary(reader); SoundData.Add(tempCSDT); break; case "CNAM": if (ImpactDataset == null) { ImpactDataset = new RecordReference(); } ImpactDataset.ReadBinary(reader); break; case "LNAM": if (MeleeWeaponList == null) { MeleeWeaponList = new RecordReference(); } MeleeWeaponList.ReadBinary(reader); break; default: throw new Exception(); } } }
/// <summary> /// Import from <see cref="Filename"/>. /// </summary> /// <remarks> /// It doesn't really make sense to allow re-initialisation. /// Hence, this function is called only upon initialisation. /// </remarks> private void Import() { using (FileStream fs = new FileStream(Filename, FileMode.Open)) { using (BinaryReader reader = new BinaryReader(fs)) { /* * DO KEEP IN MIND THAT THE COUNTERS HERE REFER TO BYTES. */ List <Data4Bytes> tempHeader = new List <Data4Bytes>(); tempHeader.AddRange(Data4Bytes.GenerateFromByteArray(reader.ReadBytes(16))); Header = tempHeader; uint remainingDataSize = (uint)OriginalFileSize; // Will be decreased later. /* * Currently at 16 bytes = 4 words, next thing to read is the model size data. * This has to be performed as many times as there are models. * Every model has to be supplied with data that ranges from its size counter * (inclusive) to the last animation frame byte (inclusive). * The model initialisation process takes care of making sense of the data. * What matters now is getting after the last model correctly and parsing the * Material data; after that, there is no known data structure, so everthing * is going into the Unknown list. */ uint currentPositionInData = 16; remainingDataSize -= (currentPositionInData - 4); for (uint i = 0; i < ModelCount; ++i) { uint tempsize = ((Data4Bytes)(reader.ReadBytes(4))).ui; TPModel temp; //Size + 4 because we also want to supply the model size. List <byte> tempList = new List <byte>((int)tempsize + 4); tempList.InsertRange(0, ((Data4Bytes)tempsize).B); tempList.InsertRange(4, reader.ReadBytes((int)tempsize).ToList()); temp = new TPModel(tempList); Models.Add(temp); if (temp.PeekLog() != String.Empty) { log.AppendLine("--- Model " + i + " ---"); log.AppendLine(temp.DumpLog()); } currentPositionInData += tempsize + 4; remainingDataSize -= (tempsize - 4); } log.AppendLine("Added " + ModelCount + " model(s)."); /* * We will now import material data in a similar fashion. */ MaterialCount = ((Data4Bytes)(reader.ReadBytes(4))).ui; currentPositionInData += 4; for (uint i = 0; i < MaterialCount; ++i) { uint tempsize = ((Data4Bytes)(reader.ReadBytes(4))).ui; TPMaterial temp; //Size + 4 because we also want to supply the material size. List <byte> tempList = new List <byte>((int)tempsize + 4); tempList.InsertRange(0, ((Data4Bytes)tempsize).B); tempList.InsertRange(4, reader.ReadBytes((int)tempsize).ToList()); temp = new TPMaterial(tempList); Materials.Add(temp); if (temp.PeekLog() != String.Empty) { log.AppendLine("--- Material " + i + " ---"); log.AppendLine(temp.DumpLog()); } currentPositionInData += tempsize + 4; remainingDataSize -= (tempsize - 4); } log.AppendLine("Added " + MaterialCount + " material(s)."); OtherData.Capacity = (int)remainingDataSize; OtherData = reader.ReadBytes((int)remainingDataSize).ToList(); } } }
protected void Page_Load(object sender, EventArgs e) { intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oDesign = new Design(intProfile, dsn); oUser = new Users(intProfile, dsn); oModelsProperties = new ModelsProperties(intProfile, dsn); oForecast = new Forecast(intProfile, dsn); oModel = new Models(intProfile, dsn); if (Request.QueryString["id"] != null) { Int32.TryParse(Request.QueryString["id"], out intID); } if (Request.QueryString["type"] != null) { strType = Request.QueryString["type"]; } if (!IsPostBack) { if (intID > 0) { StringBuilder strLiteral = new StringBuilder(); int intModel = oDesign.GetModelProperty(intID); int intQuantity = 0; Int32.TryParse(oDesign.Get(intID, "quantity"), out intQuantity); switch (strType) { case "HELP": Page.Title = "ClearView Help"; panHelp.Visible = true; litHelpHeader.Text = oDesign.GetPhase(intID, "title"); litHelp.Text = oDesign.GetPhase(intID, "help"); break; case "ACCOUNTS": Page.Title = "ClearView Account Configuration"; panAccounts.Visible = true; rptAccounts.DataSource = oDesign.GetAccounts(intID); rptAccounts.DataBind(); foreach (RepeaterItem ri in rptAccounts.Items) { Label _permissions = (Label)ri.FindControl("lblPermissions"); switch (_permissions.Text) { case "0": _permissions.Text = "-----"; break; case "D": _permissions.Text = "Developer"; break; case "P": _permissions.Text = "Promoter"; break; case "S": _permissions.Text = "AppSupport"; break; case "U": _permissions.Text = "AppUsers"; break; } if (_permissions.ToolTip == "1") { _permissions.Text += " (R/D)"; } } if (rptAccounts.Items.Count == 0) { lblNone.Visible = true; } break; case "STORAGE_LUNS": Page.Title = "ClearView Storage Configuration"; panStorage.Visible = true; rptStorage.DataSource = oDesign.GetStorageDrives(intID); rptStorage.DataBind(); foreach (RepeaterItem ri in rptStorage.Items) { CheckBox _shared = (CheckBox)ri.FindControl("chkStorageSize"); _shared.Checked = (_shared.Text == "1"); _shared.Text = ""; } boolWindows = oDesign.IsWindows(intID); if (boolWindows) { trStorageApp.Visible = true; DataSet dsApp = oDesign.GetStorageDrive(intID, -1000); if (dsApp.Tables[0].Rows.Count > 0) { int intTemp = 0; if (Int32.TryParse(dsApp.Tables[0].Rows[0]["size"].ToString(), out intTemp) == true) { txtStorageSizeE.Text = intTemp.ToString(); } } } break; case "BACKUP_EXCLUSION": Page.Title = "ClearView Backup Exclusion Configuration"; panExclusions.Visible = true; rptExclusions.DataSource = oDesign.GetExclusions(intID); rptExclusions.DataBind(); if (rptExclusions.Items.Count == 0) { lblExclusion.Visible = true; } break; case "QUANTITY": Page.Title = "ClearView Server Count Configuration"; panQuantity.Visible = true; lblQuantity.Text = intQuantity.ToString(); if (lblQuantity.Text == "") { lblQuantity.Text = "0"; } if (oDesign.IsProd(intID)) { if (oDesign.Get(intID, "dr") == "0") { lblQuantityDR.Text = "0"; } else { lblQuantityDR.Text = lblQuantity.Text; trQuantityDR.Visible = true; } } else { lblQuantityDR.Text = "0"; } int intTotal = Int32.Parse(lblQuantity.Text) + Int32.Parse(lblQuantityDR.Text); lblQuantityTotal.Text = intTotal.ToString(); break; case "STORAGE_AMOUNT": Page.Title = "ClearView Storage Amount Configuration"; panStorageAmount.Visible = true; double dblReplicate = 0.00; double.TryParse(oModelsProperties.Get(intModel, "replicate_times"), out dblReplicate); double dblAmount = 0.00; double dblReplicated = 0.00; double dblTemp = 0.00; DataSet dsStorage = oDesign.GetStorageDrives(intID); foreach (DataRow drStorage in dsStorage.Tables[0].Rows) { if (double.TryParse(drStorage["size"].ToString(), out dblTemp) == true) { dblAmount += dblTemp; dblReplicated += (dblTemp * dblReplicate); } } DataSet dsApp2 = oDesign.GetStorageDrive(intID, -1000); if (dsApp2.Tables[0].Rows.Count > 0 && oDesign.IsWindows(intID)) { if (double.TryParse(dsApp2.Tables[0].Rows[0]["size"].ToString(), out dblTemp) == true) { dblAmount += dblTemp; dblReplicated += (dblTemp * dblReplicate); } } dblAmount = dblAmount * intQuantity; lblStorage.Text = dblAmount.ToString("0"); dblReplicated = dblReplicated * intQuantity; if (oDesign.IsProd(intID)) { if (oDesign.Get(intID, "dr") == "0") { dblReplicated = 0.00; } else { trStorageDR.Visible = true; lblStorageDR.Text = dblReplicated.ToString("0"); } } else { dblReplicated = 0.00; } double dblTotal = dblAmount + dblReplicated; lblStorageTotal.Text = dblTotal.ToString("0"); break; case "ACQUISITION": panLiteral.Visible = true; double dblQuantity = 0.00; double dblRecovery = 0.00; double.TryParse(oDesign.Get(intID, "quantity"), out dblQuantity); if (oDesign.IsProd(intID)) { if (oDesign.Get(intID, "dr") != "0") { dblRecovery = dblQuantity; } } else { lblQuantityDR.Text = "0"; } if (intModel > 0) { intModel = Int32.Parse(oModelsProperties.Get(intModel, "modelid")); } strLiteral.Append("<tr>"); strLiteral.Append("<td><b>Model:</b></td>"); strLiteral.Append("<td align=\"right\">"); strLiteral.Append(oModel.Get(intModel, "name")); strLiteral.Append("</td>"); strLiteral.Append("</tr>"); double dblAcquisition = 0.00; DataSet dsAcquisition = oForecast.GetAcquisitions(intModel, 1); foreach (DataRow dr in dsAcquisition.Tables[0].Rows) { strLiteral.Append("<tr>"); strLiteral.Append("<td><b>"); strLiteral.Append(dr["name"].ToString()); strLiteral.Append(":</b></td>"); double dblCost = double.Parse(dr["cost"].ToString()); dblAcquisition += dblCost; strLiteral.Append("<td align=\"right\">$"); strLiteral.Append(dblCost.ToString("N")); strLiteral.Append("</td>"); strLiteral.Append("</tr>"); } strLiteral.Append("<tr><td colspan=\"2\"><hr size=\"1\" noshade/></td></tr>"); strLiteral.Append("<tr><td>Total Amount:</td><td class=\"reddefault\" align=\"right\">$"); strLiteral.Append(dblAcquisition.ToString("N")); strLiteral.Append("</td></tr>"); strLiteral.Append("<tr><td colspan=\"2\"><img src=\"/images/spacer.gif\" border=\"0\" width=\"1\" height=\"1\"/></td></tr>"); strLiteral.Append("<tr><td>Quantity:</td><td align=\"right\">"); strLiteral.Append(dblQuantity.ToString("N")); strLiteral.Append("</td></tr>"); strLiteral.Append("<tr><td>Recovery:</td><td align=\"right\">+ "); strLiteral.Append(dblRecovery.ToString("N")); strLiteral.Append("</td></tr>"); strLiteral.Append("<tr><td colspan=\"2\"><hr size=\"1\" noshade/></td></tr>"); dblQuantity = dblQuantity + dblRecovery; strLiteral.Append("<tr><td>Total Quantity:</td><td align=\"right\">"); strLiteral.Append(dblQuantity.ToString("N")); strLiteral.Append("</td></tr>"); strLiteral.Append("<tr><td>Total Amount:</td><td class=\"reddefault\" align=\"right\">x $"); strLiteral.Append(dblAcquisition.ToString("N")); strLiteral.Append("</td></tr>"); strLiteral.Append("<tr><td colspan=\"2\"><hr size=\"1\" noshade/></td></tr>"); dblAcquisition = dblAcquisition * dblQuantity; strLiteral.Append("<tr><td><b>Grand Total:</b></td><td class=\"reddefault\" align=\"right\"><b>$"); strLiteral.Append(dblAcquisition.ToString("N")); strLiteral.Append("</b></td></tr>"); strLiteral.Insert(0, "<table width=\"350\" cellpadding=\"3\" cellspacing=\"2\" border=\"0\">"); strLiteral.Append("</table>"); litLiteral.Text = strLiteral.ToString(); break; case "OPERATIONAL": panLiteral.Visible = true; double dblQuantityO = 0.00; double dblRecoveryO = 0.00; double.TryParse(oDesign.Get(intID, "quantity"), out dblQuantityO); if (oDesign.IsProd(intID)) { if (oDesign.Get(intID, "dr") != "0") { dblRecoveryO = dblQuantityO; } } else { lblQuantityDR.Text = "0"; } if (intModel > 0) { intModel = Int32.Parse(oModelsProperties.Get(intModel, "modelid")); } strLiteral.Append("<tr>"); strLiteral.Append("<td><b>Model:</b></td>"); strLiteral.Append("<td align=\"right\">"); strLiteral.Append(oModel.Get(intModel, "name")); strLiteral.Append("</td>"); strLiteral.Append("</tr>"); double dblOperational = 0.00; DataSet dsOperational = oForecast.GetOperations(intModel, 1); foreach (DataRow dr in dsOperational.Tables[0].Rows) { strLiteral.Append("<tr>"); strLiteral.Append("<td><b>"); strLiteral.Append(dr["name"].ToString()); strLiteral.Append(":</b></td>"); double dblCost = double.Parse(dr["cost"].ToString()); dblOperational += dblCost; strLiteral.Append("<td align=\"right\">$"); strLiteral.Append(dblCost.ToString("N")); strLiteral.Append("</td>"); strLiteral.Append("</tr>"); } strLiteral.Append("<tr><td colspan=\"2\"><hr size=\"1\" noshade/></td></tr>"); strLiteral.Append("<tr><td>Total Amount:</td><td class=\"reddefault\" align=\"right\">$"); strLiteral.Append(dblOperational.ToString("N")); strLiteral.Append("</td></tr>"); strLiteral.Append("<tr><td colspan=\"2\"><img src=\"/images/spacer.gif\" border=\"0\" width=\"1\" height=\"1\"/></td></tr>"); strLiteral.Append("<tr><td>Quantity:</td><td align=\"right\">"); strLiteral.Append(dblQuantityO.ToString("N")); strLiteral.Append("</td></tr>"); strLiteral.Append("<tr><td>Recovery:</td><td align=\"right\">+ "); strLiteral.Append(dblRecoveryO.ToString("N")); strLiteral.Append("</td></tr>"); strLiteral.Append("<tr><td colspan=\"2\"><hr size=\"1\" noshade/></td></tr>"); dblQuantityO = dblQuantityO + dblRecoveryO; strLiteral.Append("<tr><td>Total Quantity:</td><td align=\"right\">"); strLiteral.Append(dblQuantityO.ToString("N")); strLiteral.Append("</td></tr>"); strLiteral.Append("<tr><td>Total Amount:</td><td class=\"reddefault\" align=\"right\">x $"); strLiteral.Append(dblOperational.ToString("N")); strLiteral.Append("</td></tr>"); strLiteral.Append("<tr><td colspan=\"2\"><hr size=\"1\" noshade/></td></tr>"); dblOperational = dblOperational * dblQuantityO; strLiteral.Append("<tr><td><b>Grand Total:</b></td><td class=\"reddefault\" align=\"right\"><b>$"); strLiteral.Append(dblOperational.ToString("N")); strLiteral.Append("</b></td></tr>"); strLiteral.Insert(0, "<table width=\"350\" cellpadding=\"3\" cellspacing=\"2\" border=\"0\">"); strLiteral.Append("</table>"); litLiteral.Text = strLiteral.ToString(); break; } } } }
private void Start() { carModel = Models.GetModel <CarModel>(); carModel.OnCurrentSpeedUpdated += OnCurrentSpeedUpdated; OnCurrentSpeedUpdated(carModel.currentSpeed); }
public PointLightViewModel(Models world, PointLightModel parent) : base(world, parent) { m_parent = parent; world.World.PropertyChanged += ModelOnPropertyChanged; }
public override MaterialViewModel CreateViewModel(Models models) { return(new BlendMaterialViewModel(models, this)); }
/// <summary> /// /// </summary> /// <param name="fileName"></param> public M50SongMemory(string fileName) : base(fileName) { Model = Models.Find(Models.EOsVersion.EOsVersionM50); }
private bool CanDisableAll() { return(Models.Any(m => m.IsEnabled)); }
protected void Page_Load(object sender, EventArgs e) { AuthenticateUser(); intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oOnDemand = new OnDemand(intProfile, dsn); oForecast = new Forecast(intProfile, dsn); oRequest = new Requests(intProfile, dsn); oWorkstation = new Workstations(intProfile, dsn); oStorage = new Storage(intProfile, dsn); oModel = new Models(intProfile, dsn); oModelsProperties = new ModelsProperties(intProfile, dsn); oOperatingSystem = new OperatingSystems(intProfile, dsn); if (Request.QueryString["aid"] != null && Request.QueryString["aid"] != "") { intAnswer = Int32.Parse(Request.QueryString["aid"]); } if (Request.QueryString["num"] != null && Request.QueryString["num"] != "") { intNumber = Int32.Parse(Request.QueryString["num"]); } int intWorkstation = 0; if (intAnswer > 0) { DataSet ds = oForecast.GetAnswer(intAnswer); if (ds.Tables[0].Rows.Count > 0) { int intModel = oForecast.GetModel(intAnswer); intModel = Int32.Parse(oModelsProperties.Get(intModel, "modelid")); int _classid = Int32.Parse(ds.Tables[0].Rows[0]["classid"].ToString()); int _environmentid = Int32.Parse(ds.Tables[0].Rows[0]["environmentid"].ToString()); intOS = Int32.Parse(oForecast.GetWorkstation(intAnswer, "osid")); intRequest = oForecast.GetRequestID(intAnswer, true); if (!IsPostBack) { LoadLists(_classid, _environmentid); ds = oWorkstation.GetVirtual(intAnswer, intNumber); if (ds.Tables[0].Rows.Count > 0) { intWorkstation = Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString()); lblId.Text = intWorkstation.ToString(); intOS = Int32.Parse(ds.Tables[0].Rows[0]["osid"].ToString()); } if (intOS > 0) { ddlOS.SelectedValue = intOS.ToString(); ddlServicePack.Enabled = true; ddlServicePack.DataValueField = "id"; ddlServicePack.DataTextField = "name"; ddlServicePack.DataSource = oOperatingSystem.GetServicePack(intOS); ddlServicePack.DataBind(); ddlServicePack.Items.Insert(0, new ListItem("-- SELECT --", "0")); chkComponents.DataValueField = "id"; chkComponents.DataTextField = "name"; chkComponents.DataSource = oWorkstation.GetComponentPermissionsOS(intOS); chkComponents.DataBind(); DataSet dsComponents = oWorkstation.GetComponentsSelected(intWorkstation); foreach (DataRow drComponent in dsComponents.Tables[0].Rows) { foreach (ListItem oItem in chkComponents.Items) { if (drComponent["componentid"].ToString() == oItem.Value) { oItem.Selected = true; break; } } } } if (ds.Tables[0].Rows.Count > 0) { ddlServicePack.SelectedValue = ds.Tables[0].Rows[0]["spid"].ToString(); hdnServicePack.Value = ds.Tables[0].Rows[0]["spid"].ToString(); ddlDomain.SelectedValue = ds.Tables[0].Rows[0]["domainid"].ToString(); } } btnClose.Attributes.Add("onclick", "return window.close();"); btnSaveConfig.Attributes.Add("onclick", "return ValidateDropDown('" + ddlServicePack.ClientID + "','Please select a service pack')" + " && ValidateDropDown('" + ddlDomain.ClientID + "','Please select a domain')" + ";"); ddlOS.Attributes.Add("onchange", "PopulateServicePacks('" + ddlOS.ClientID + "','" + ddlServicePack.ClientID + "');"); ddlServicePack.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlServicePack.ClientID + "','" + hdnServicePack.ClientID + "');"); } } }
/// <summary> /// /// </summary> /// <param name="fileName"></param> public KromeSongMemory(string fileName) : base(fileName) { Model = Models.Find(Models.EOsVersion.EOsVersionKrome); }
protected override void PopulateModels() { Models.Clear(); Models.AddAll(DataService.GetByGame(SettingsService.CurrentGame)); }
protected void Page_Load(object sender, EventArgs e) { intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oForecast = new Forecast(intProfile, dsn); oType = new Types(intProfile, dsn); oModel = new Models(intProfile, dsn); oPlatform = new Platforms(intProfile, dsn); if (Request.QueryString["parent"] != null && Request.QueryString["parent"] != "") { intForecast = Int32.Parse(Request.QueryString["parent"]); } if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { intID = Int32.Parse(Request.QueryString["id"]); } if (Request.QueryString["step"] != null && Request.QueryString["step"] != "") { panUpdate.Visible = true; } else { panNavigation.Visible = true; } int intCount = 0; int intAddress = 0; if (intID > 0) { DataSet ds = oForecast.GetAnswer(intID); if (ds.Tables[0].Rows.Count > 0) { bool boolHundred = false; int intConfidence = Int32.Parse(ds.Tables[0].Rows[0]["confidenceid"].ToString()); if (intConfidence > 0) { Confidence oConfidence = new Confidence(intProfile, dsn); string strConfidence = oConfidence.Get(intConfidence, "name"); if (strConfidence.Contains("100%") == true) { boolHundred = true; } } if (boolHundred == true) { panUpdate.Visible = false; panNavigation.Visible = false; btnHundred.Visible = true; } intPlatform = Int32.Parse(ds.Tables[0].Rows[0]["platformid"].ToString()); int intStep = Int32.Parse(ds.Tables[0].Rows[0]["step"].ToString()); int intModel = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString()); int intVendor = Int32.Parse(ds.Tables[0].Rows[0]["vendorid"].ToString()); intForecast = Int32.Parse(ds.Tables[0].Rows[0]["forecastid"].ToString()); DataSet dsSteps = oForecast.GetSteps(intPlatform, 1); if (dsSteps.Tables[0].Rows.Count == intStep) { btnNext.Text = "Finish"; } if (intStep == 0 || intStep == 1) { btnBack.Enabled = false; } lblVendor.Text = intVendor.ToString(); if (Request.QueryString["type"] != null && Request.QueryString["type"] != "") { intType = Int32.Parse(Request.QueryString["type"]); } else if (!IsPostBack) { if (ds.Tables[0].Rows[0]["vplatform"].ToString() != "") { intType = Int32.Parse(ds.Tables[0].Rows[0]["vplatform"].ToString()); } intAddress = Int32.Parse(ds.Tables[0].Rows[0]["addressid"].ToString()); txtMake.Text = ds.Tables[0].Rows[0]["make"].ToString(); txtModel.Text = ds.Tables[0].Rows[0]["modelname"].ToString(); txtOther.Text = ds.Tables[0].Rows[0]["description"].ToString(); txtWidth.Text = ds.Tables[0].Rows[0]["size_w"].ToString(); txtHeight.Text = ds.Tables[0].Rows[0]["size_h"].ToString(); txtAmp.Text = ds.Tables[0].Rows[0]["amp"].ToString(); ddlTypes.SelectedValue = ds.Tables[0].Rows[0]["typeid"].ToString(); } if (!IsPostBack) { intCount = LoadPlatform(intPlatform, intType); } } } btnClose.Attributes.Add("onclick", "return window.close();"); btnNext.Attributes.Add("onclick", "return ValidateDropDown('" + ddlPlatforms.ClientID + "','Please select a classification')" + " && ValidateDropDown('" + ddlTypes.ClientID + "','Please select a type')" + " && ValidateText('" + txtMake.ClientID + "','Please enter the make')" + " && ValidateText('" + txtModel.ClientID + "','Please enter the model')" + " && ValidateText('" + txtWidth.ClientID + "','Please enter the width')" + " && ValidateText('" + txtHeight.ClientID + "','Please enter the height')" + " && ValidateNumber('" + txtAmp.ClientID + "','Please enter the number of AMPs')" + ";"); btnUpdate.Attributes.Add("onclick", "return ValidateDropDown('" + ddlPlatforms.ClientID + "','Please select a classification')" + " && ValidateDropDown('" + ddlTypes.ClientID + "','Please select a type')" + " && ValidateText('" + txtMake.ClientID + "','Please enter the make')" + " && ValidateText('" + txtModel.ClientID + "','Please enter the model')" + " && ValidateText('" + txtWidth.ClientID + "','Please enter the width')" + " && ValidateText('" + txtHeight.ClientID + "','Please enter the height')" + " && ValidateNumber('" + txtAmp.ClientID + "','Please enter the number of AMPs')" + ";"); }
public SnapshotModel[] GetSelectedModels() { return(Models.Where((SnapshotModel model) => model.objselected).ToArray()); }
//private Dictionary<String, ModelInfo> models = new Dictionary<String, ModelInfo>(); //private List<MappingInfo> mapings = new List<MappingInfo>(); //private String nameSpace = null; public void AddModel(ModelInfo modelInfo) { Models.Add(modelInfo.Name, modelInfo); }
/// <summary> /// Baut ein Terrain-Modell /// </summary> /// <param name="name">Name des Modells</param> /// <param name="heightmap">Height Map Textur</param> /// <param name="texture">Textur der Oberfläche</param> /// <param name="width">Breite</param> /// <param name="height">Höhe</param> /// <param name="depth">Tiefe</param> /// <param name="texRepeatX">Texturwiederholung Breite</param> /// <param name="texRepeatZ">Texturwiederholung Tiefe</param> /// <param name="isFile">false, wenn die Texturen Teil der EXE sind (Eingebettete Ressource)</param> public static void BuildTerrainModel(string name, string heightmap, string texture, float width, float height, float depth, float texRepeatX = 1, float texRepeatZ = 1, bool isFile = true) { if (Models.ContainsKey(name)) { HelperGeneral.ShowErrorAndQuit("KWEngine::BuildTerrainModel()", "There already is a model with that name. Please choose a different name."); return; } GeoModel terrainModel = new GeoModel(); terrainModel.Name = name; terrainModel.Meshes = new Dictionary <string, GeoMesh>(); terrainModel.IsValid = true; GeoMeshHitbox meshHitBox = new GeoMeshHitbox(0 + width / 2, 0 + height / 2, 0 + depth / 2, 0 - width / 2, 0 - height / 2, 0 - depth / 2, null); meshHitBox.Model = terrainModel; meshHitBox.Name = name; terrainModel.MeshHitboxes = new List <GeoMeshHitbox>(); terrainModel.MeshHitboxes.Add(meshHitBox); GeoTerrain t = new GeoTerrain(); GeoMesh terrainMesh = t.BuildTerrain2(new Vector3(0, 0, 0), heightmap, width, height, depth, texRepeatX, texRepeatZ, isFile); terrainMesh.Terrain = t; GeoMaterial mat = new GeoMaterial(); mat.BlendMode = BlendingFactor.OneMinusSrcAlpha; mat.ColorAlbedo = new Vector4(1, 1, 1, 1); mat.ColorEmissive = new Vector4(0, 0, 0, 0); mat.Opacity = 1; mat.Metalness = 0; mat.Roughness = 1; GeoTexture texDiffuse = new GeoTexture(); texDiffuse.Filename = texture; texDiffuse.Type = TextureType.Albedo; texDiffuse.UVMapIndex = 0; texDiffuse.UVTransform = new Vector2(texRepeatX, texRepeatZ); bool dictFound = CustomTextures.TryGetValue(CurrentWorld, out Dictionary <string, int> texDict); if (dictFound && texDict.ContainsKey(texture)) { texDiffuse.OpenGLID = texDict[texture]; } else { int texId = isFile ? HelperTexture.LoadTextureForModelExternal(texture) : HelperTexture.LoadTextureForModelInternal(texture); texDiffuse.OpenGLID = texId > 0 ? texId : KWEngine.TextureDefault; if (dictFound && texId > 0) { texDict.Add(texture, texDiffuse.OpenGLID); } } mat.TextureAlbedo = texDiffuse; terrainMesh.Material = mat; terrainModel.Meshes.Add("Terrain", terrainMesh); KWEngine.Models.Add(name, terrainModel); }
protected void Page_Load(object sender, EventArgs e) { AuthenticateUser(); intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oForecast = new Forecast(intProfile, dsn); oModel = new Models(intProfile, dsn); oPlatform = new Platforms(intProfile, dsn); oModelsProperties = new ModelsProperties(intProfile, dsn); if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { StringBuilder sb = new StringBuilder(strSummary); int intID = Int32.Parse(Request.QueryString["id"]); int intModel = 0; double dblQuantity = double.Parse(oForecast.GetAnswer(intID, "quantity")); double dblRecovery = double.Parse(oForecast.GetAnswer(intID, "recovery_number")); int intServerModel = oForecast.GetModelAsset(intID); if (intServerModel == 0) { intServerModel = oForecast.GetModel(intID); } if (intServerModel == 0) { intModel = Int32.Parse(oForecast.GetAnswer(intID, "modelid")); } if (intServerModel > 0) { if (intModel == 0) { intModel = Int32.Parse(oModelsProperties.Get(intServerModel, "modelid")); } } sb.Append("<tr>"); sb.Append("<td><b>Model:</b></td>"); sb.Append("<td align=\"right\">"); sb.Append(oModel.Get(intModel, "name")); sb.Append("</td>"); sb.Append("</tr>"); double dblTotal = 0.00; DataSet ds = oForecast.GetAcquisitions(intModel, 1); foreach (DataRow dr in ds.Tables[0].Rows) { sb.Append("<tr>"); sb.Append("<td><b>"); sb.Append(dr["name"].ToString()); sb.Append(":</b></td>"); double dblCost = double.Parse(dr["cost"].ToString()); dblTotal += dblCost; sb.Append("<td align=\"right\">$"); sb.Append(dblCost.ToString("N")); sb.Append("</td>"); sb.Append("</tr>"); } sb.Append("<tr><td colspan=\"2\"><hr size=\"1\" noshade/></td></tr>"); sb.Append("<tr><td>Total Amount:</td><td class=\"reddefault\" align=\"right\">$"); sb.Append(dblTotal.ToString("N")); sb.Append("</td></tr>"); sb.Append("<tr><td colspan=\"2\"><img src=\"/images/spacer.gif\" border=\"0\" width=\"1\" height=\"1\"/></td></tr>"); sb.Append("<tr><td>Quantity:</td><td align=\"right\">"); sb.Append(dblQuantity.ToString("N")); sb.Append("</td></tr>"); sb.Append("<tr><td>Recovery:</td><td align=\"right\">+ "); sb.Append(dblRecovery.ToString("N")); sb.Append("</td></tr>"); sb.Append("<tr><td colspan=\"2\"><hr size=\"1\" noshade/></td></tr>"); dblQuantity = dblQuantity + dblRecovery; sb.Append("<tr><td>Total Quantity:</td><td align=\"right\">"); sb.Append(dblQuantity.ToString("N")); sb.Append("</td></tr>"); sb.Append("<tr><td>Total Amount:</td><td class=\"reddefault\" align=\"right\">x $"); sb.Append(dblTotal.ToString("N")); sb.Append("</td></tr>"); sb.Append("<tr><td colspan=\"2\"><hr size=\"1\" noshade/></td></tr>"); dblTotal = dblTotal * dblQuantity; sb.Append("<tr><td><b>Grand Total:</b></td><td class=\"reddefault\" align=\"right\"><b>$"); sb.Append(dblTotal.ToString("N")); sb.Append("</b></td></tr>"); sb.Insert(0, "<table width=\"350\" cellpadding=\"3\" cellspacing=\"2\" border=\"0\">"); sb.Append("</table>"); strSummary = sb.ToString(); } }
private void RenderChildren(BoundingFrustum frustum, CActor actor, Matrix world, bool parentAnimated) { if (RenderWheelsSeparately && actor.IsWheel) { return; } bool intersects; if (frustum == null) { intersects = true; } else { intersects = actor.BoundingBox.Max.X == 0; if (!intersects) { frustum.Intersects(ref actor.BoundingBox, out intersects); GameVars.NbrSectionsChecked++; } } if (intersects) { Matrix m = actor.GetDynamicMatrix(); if (actor.IsAnimated || parentAnimated) { if (actor.IsAnimated && !parentAnimated) { world = m * actor.ParentMatrix * GameVars.ScaleMatrix * world; } else { world = m * world; } GameVars.CurrentEffect.World = world; parentAnimated = true; } else { GameVars.CurrentEffect.World = m * world; } if (actor.Model != null) { actor.Model.Render(actor.Material); if (actor.Model is CDeformableModel) { Models.SetupRender(); } } GameVars.NbrSectionsRendered++; foreach (CActor child in actor.Children) { RenderChildren(frustum, child, world, parentAnimated); } } }
protected void Page_Load(object sender, EventArgs e) { intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oForecast = new Forecast(intProfile, dsn); oType = new Types(intProfile, dsn); oModel = new Models(intProfile, dsn); oModelsProperties = new ModelsProperties(intProfile, dsn); oSolution = new Solution(intProfile, dsn); oPlatform = new Platforms(intProfile, dsn); oClass = new Classes(intProfile, dsn); if (Request.QueryString["parent"] != null && Request.QueryString["parent"] != "") { intForecast = Int32.Parse(Request.QueryString["parent"]); } if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { intID = Int32.Parse(Request.QueryString["id"]); } if (Request.QueryString["step"] != null && Request.QueryString["step"] != "") { panUpdate.Visible = true; } else { panNavigation.Visible = true; } int intCount = 0; if (intID > 0) { DataSet ds = oForecast.GetAnswer(intID); if (ds.Tables[0].Rows.Count > 0) { bool boolHundred = false; int intConfidence = Int32.Parse(ds.Tables[0].Rows[0]["confidenceid"].ToString()); if (intConfidence > 0) { Confidence oConfidence = new Confidence(intProfile, dsn); string strConfidence = oConfidence.Get(intConfidence, "name"); if (strConfidence.Contains("100%") == true) { boolHundred = true; } } if (boolHundred == true) { panUpdate.Visible = false; panNavigation.Visible = false; btnHundred.Visible = true; } intPlatform = Int32.Parse(ds.Tables[0].Rows[0]["platformid"].ToString()); int intStep = Int32.Parse(ds.Tables[0].Rows[0]["step"].ToString()); int intClass = Int32.Parse(ds.Tables[0].Rows[0]["classid"].ToString()); if (oClass.IsProd(intClass)) { boolProduction = true; } int intEnv = Int32.Parse(ds.Tables[0].Rows[0]["environmentid"].ToString()); int intAddress = Int32.Parse(ds.Tables[0].Rows[0]["addressid"].ToString()); int intModel = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString()); intForecast = Int32.Parse(ds.Tables[0].Rows[0]["forecastid"].ToString()); lblRecovery.Text = ds.Tables[0].Rows[0]["recovery_number"].ToString(); lblQuantity.Text = ds.Tables[0].Rows[0]["quantity"].ToString(); DataSet dsSteps = oForecast.GetSteps(intPlatform, 1); if (dsSteps.Tables[0].Rows.Count == intStep) { btnNext.Text = "Finish"; } if (intStep == 0 || intStep == 1) { btnBack.Enabled = false; } if (Request.QueryString["type"] != null && Request.QueryString["type"] != "") { intType = Int32.Parse(Request.QueryString["type"]); } else if (!IsPostBack) { if (intModel > 0) { ddlModels.SelectedValue = intModel.ToString(); intModel = Int32.Parse(oModelsProperties.Get(intModel, "modelid")); intType = Int32.Parse(oModel.Get(intModel, "typeid")); } } if (!IsPostBack) { intCount = LoadPlatform(intPlatform, intType, intClass, intEnv, intAddress); } if (!IsPostBack) { LoadPlatform(intPlatform, intClass, intEnv); } } } Control ctrl = Page.ParseControl(strQuestions + strHidden); tdQuestions.Controls.Add(ctrl); btnNext.Attributes.Add("onclick", "return " + strAttributes); btnUpdate.Attributes.Add("onclick", "return " + strAttributes); btnClose.Attributes.Add("onclick", "return window.close();"); }
protected void Page_Load(object sender, EventArgs e) { AuthenticateUser(); if (Request.Cookies["profileid"] != null && Request.Cookies["profileid"].Value != "") { intProfile = Int32.Parse(Request.Cookies["profileid"].Value); } if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "") { intApplication = Int32.Parse(Request.QueryString["applicationid"]); } if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "") { intApplication = Int32.Parse(Request.Cookies["application"].Value); } oDataPoint = new DataPoint(intProfile, dsn); oUser = new Users(intProfile, dsn); oServer = new Servers(intProfile, dsn); oAsset = new Asset(intProfile, dsnAsset); oForecast = new Forecast(intProfile, dsn); oPlatform = new Platforms(intProfile, dsn); oType = new Types(intProfile, dsn); oModel = new Models(intProfile, dsn); oModelsProperties = new ModelsProperties(intProfile, dsn); oIPAddresses = new IPAddresses(intProfile, dsnIP, dsn); oFunction = new Functions(intProfile, dsn, intEnvironment); oOperatingSystem = new OperatingSystems(intProfile, dsn); oServicePack = new ServicePacks(intProfile, dsn); oClass = new Classes(intProfile, dsn); oEnvironment = new Environments(intProfile, dsn); oResiliency = new Resiliency(intProfile, dsn); oSolaris = new Solaris(intProfile, dsn); oStatusList = new StatusLevels(intProfile, dsn); if (oUser.IsAdmin(intProfile) == true || (oDataPoint.GetPagePermission(intApplication, "ASSET") == true || intDataPointAvailableAsset == 1)) { panAllow.Visible = true; if (Request.QueryString["save"] != null) { panSave.Visible = true; } if (Request.QueryString["error"] != null) { panError.Visible = true; } if (Request.QueryString["close"] != null) { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">window.close();<" + "/" + "script>"); } else if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { string strID = oFunction.decryptQueryString(Request.QueryString["id"]); DataSet ds = oDataPoint.GetAsset(Int32.Parse(strID)); if (ds.Tables[0].Rows.Count == 1) { // Load General Information intAsset = Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString()); lblAssetID.Text = "#" + intAsset.ToString(); string strSerial = ds.Tables[0].Rows[0]["serial"].ToString(); string strAsset = ds.Tables[0].Rows[0]["asset"].ToString(); string strHeader = (strSerial.Length > 15 ? strSerial.Substring(0, 15) + "..." : strSerial); lblHeader.Text = """ + strHeader.ToUpper() + """; Master.Page.Title = "DataPoint | Physical Deploy (" + strHeader + ")"; lblHeaderSub.Text = "Complete the following information to deploy a physical server..."; int intMenuTab = 0; if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "") { intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]); } Tab oTab = new Tab(hdnTab.ClientID, intMenuTab, "divMenu1", true, false); oTab.AddTab("Asset Information", ""); oTab.AddTab("Location Information", ""); oTab.AddTab("World Wide Port Names", ""); oTab.AddTab("Resource Dependencies", ""); oTab.AddTab("Provisioning History", ""); strMenuTab1 = oTab.GetTabs(); if (oUser.IsAdmin(intProfile) == true || oDataPoint.GetFieldPermission(intProfile, "SERVER_ADMIN") == true) { panOldLocationInfo.Visible = true; } if (!IsPostBack) { LoadList(); // Asset Information oDataPoint.LoadTextBox(txtPlatformSerial, intProfile, null, "", lblPlatformSerial, fldPlatformSerial, "PHYSICAL_SERIAL", strSerial, "", false, true); oDataPoint.LoadTextBox(txtPlatformAsset, intProfile, null, "", lblPlatformAsset, fldPlatformAsset, "PHYSICAL_ASSET", strAsset, "", false, true); int intAssetAttribute = Int32.Parse(oAsset.Get(intAsset, "asset_attribute")); oDataPoint.LoadDropDown(ddlAssetAttribute, intProfile, null, "", lblAssetAttribute, fldAssetAttribute, "ASSET_ATTRIBUTE", "Name", "AttributeId", oAsset.getAssetAttributes(null, "", 1), intAssetAttribute, true, false, false); oDataPoint.LoadTextBox(txtAssetAttributeComment, intProfile, null, "", lblAssetAttributeComment, fldAssetAttributeComment, "ASSET_ATTRIBUTE_COMMENT", oAsset.getAssetAttributesComments(intAsset), "", false, true); ddlAssetAttribute.Attributes.Add("onclick", "return SetControlsForAssetAttributes()"); ddlPlatform.Attributes.Add("onchange", "PopulatePlatformTypes('" + ddlPlatform.ClientID + "','" + ddlPlatformType.ClientID + "','" + ddlPlatformModel.ClientID + "','" + ddlPlatformModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');"); ddlPlatformType.Attributes.Add("onchange", "PopulatePlatformModels('" + ddlPlatformType.ClientID + "','" + ddlPlatformModel.ClientID + "','" + ddlPlatformModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');"); ddlPlatformModel.Attributes.Add("onchange", "PopulatePlatformModelProperties('" + ddlPlatformModel.ClientID + "','" + ddlPlatformModelProperty.ClientID + "');ResetDropDownHidden('" + hdnModel.ClientID + "');"); ddlPlatformModelProperty.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlPlatformModelProperty.ClientID + "','" + hdnModel.ClientID + "');"); int intModel = Int32.Parse(oAsset.Get(intAsset, "modelid")); int intParent = Int32.Parse(oModelsProperties.Get(intModel, "modelid")); if (oDataPoint.GetDeployModel(intProfile, intParent) == false && oUser.IsAdmin(intProfile) == false) { panAllow.Visible = false; panDenied.Visible = true; } hdnModel.Value = intModel.ToString(); int intModelParent = Int32.Parse(oModelsProperties.Get(intModel, "modelid")); int intType = oModel.GetType(intModelParent); int intPlatform = oType.GetPlatform(intType); oDataPoint.LoadDropDown(ddlPlatform, intProfile, null, "", lblPlatform, fldPlatform, "PHYSICAL_PLATFORM", "name", "platformid", oPlatform.Gets(1), intPlatform, false, false, true); oDataPoint.LoadDropDown(ddlPlatformType, intProfile, null, "", lblPlatformType, fldPlatformType, "PHYSICAL_TYPE", "name", "id", oType.Gets(intPlatform, 1), intType, false, false, true); oDataPoint.LoadDropDown(ddlPlatformModel, intProfile, null, "", lblPlatformModel, fldPlatformModel, "PHYSICAL_MODEL", "name", "id", oModel.Gets(intType, 1), intModelParent, false, false, true); oDataPoint.LoadDropDown(ddlPlatformModelProperty, intProfile, null, "", lblPlatformModelProperty, fldPlatformModelProperty, "PHYSICAL_MODEL_PROP", "name", "id", oModelsProperties.GetModels(0, intModelParent, 1), intModel, false, false, true); // Get Asset DataSet dsAsset = oAsset.GetServerOrBlade(intAsset); if (dsAsset.Tables[0].Rows.Count > 0) { Response.Redirect("/datapoint/asset/physical.aspx?t=serial&q=" + oFunction.encryptQueryString(strSerial) + "&id=" + oFunction.encryptQueryString(intAsset.ToString()) + "&r=0"); } oDataPoint.LoadDropDown(ddlPlatformClass, intProfile, null, "", lblPlatformClass, fldPlatformClass, "PHYSICAL_CLASS", "name", "id", oClass.Gets(1), 0, false, false, true); oDataPoint.LoadDropDown(ddlPlatformEnvironment, intProfile, null, "", lblPlatformEnvironment, fldPlatformEnvironment, "PHYSICAL_ENVIRONMENT", "name", "id", oClass.GetEnvironment(0, 0), 0, false, false, true); oDataPoint.LoadTextBox(txtPlatformILO, intProfile, null, "", lblPlatformILO, fldPlatformILO, "PHYSICAL_ILO", "", "", false, true); oDataPoint.LoadTextBox(txtPlatformDummy, intProfile, null, "", lblPlatformDummy, fldPlatformDummy, "PHYSICAL_DUMMY", "", "", false, true); oDataPoint.LoadTextBox(txtPlatformMAC, intProfile, null, "", lblPlatformMAC, fldPlatformMAC, "PHYSICAL_MAC", "", "", false, true); oDataPoint.LoadTextBox(txtPlatformVLAN, intProfile, null, "", lblPlatformVLAN, fldPlatformVLAN, "PHYSICAL_VLAN", "", "", false, true); oDataPoint.LoadDropDown(ddlPlatformBuildNetwork, intProfile, null, "", lblPlatformBuildNetwork, fldPlatformBuildNetwork, "PHYSICAL_BUILD_NETWORK", "name", "id", oSolaris.GetBuildNetworks(1), 0, false, false, false); oDataPoint.LoadDropDown(ddlPlatformResiliency, intProfile, null, "", lblPlatformResiliency, fldPlatformResiliency, "PHYSICAL_RESILIENCY", "name", "id", oResiliency.Gets(1), 0, false, false, true); oDataPoint.LoadDropDown(ddlPlatformOperatingSystemGroup, intProfile, null, "", lblPlatformOperatingSystemGroup, fldPlatformOperatingSystemGroup, "PHYSICAL_OS_GROUP", "name", "id", oOperatingSystem.GetGroups(1), 0, false, false, false); if (dsAsset.Tables[0].Rows.Count > 0) { lblOldlocation.Text = dsAsset.Tables[0].Rows[0]["OldLocation"].ToString(); lblOldRoom.Text = dsAsset.Tables[0].Rows[0]["OldRoom"].ToString(); lblOldRack.Text = dsAsset.Tables[0].Rows[0]["OldRack"].ToString(); txtLocation.Text = dsAsset.Tables[0].Rows[0]["Location"].ToString(); txtRoom.Text = dsAsset.Tables[0].Rows[0]["Room"].ToString(); txtZone.Text = dsAsset.Tables[0].Rows[0]["Zone"].ToString(); txtRack.Text = dsAsset.Tables[0].Rows[0]["Rack"].ToString(); txtRackPosition.Text = dsAsset.Tables[0].Rows[0]["Rackposition"].ToString(); oDataPoint.LoadTextBox(txtRackPosition, intProfile, null, "", lblRackPositionValue, fldLocation, "CHANGE_LOCATION", dsAsset.Tables[0].Rows[0]["rackposition"].ToString(), "", false, true); hdnRackId.Value = dsAsset.Tables[0].Rows[0]["RackId"].ToString(); } oDataPoint.LoadButton(btnSelectLocation, intProfile, fldLocation, "CHANGE_LOCATION", "return LoadLocationRoomRack('" + "rack" + "','" + hdnRackId.ClientID + "', '" + txtLocation.ClientID + "','" + txtRoom.ClientID + "','" + txtZone.ClientID + "','" + txtRack.ClientID + "');"); ddlPlatformStatus.SelectedValue = oAsset.GetStatus(intAsset, "status"); // Resource Dependencies AssetOrder oAssetOrder = new AssetOrder(0, dsn, dsnAsset, intEnvironment); Services oService = new Services(0, dsn); ServiceRequests oServiceRequest = new ServiceRequests(0, dsn); rptServiceRequests.DataSource = oAssetOrder.GetByAsset(intAsset, false); rptServiceRequests.DataBind(); trServiceRequests.Visible = (rptServiceRequests.Items.Count == 0); foreach (RepeaterItem ri in rptServiceRequests.Items) { Label lblServiceID = (Label)ri.FindControl("lblServiceID"); int intService = Int32.Parse(lblServiceID.Text); Label lblDetails = (Label)ri.FindControl("lblDetails"); Label lblProgress = (Label)ri.FindControl("lblProgress"); if (lblProgress.Text == "") { lblProgress.Text = "<i>Unavailable</i>"; } else { int intResource = Int32.Parse(lblProgress.Text); double dblAllocated = 0.00; double dblUsed = 0.00; int intStatus = 0; bool boolAssigned = false; DataSet dsResource = oDataPoint.GetServiceRequestResource(intResource); if (dsResource.Tables[0].Rows.Count > 0) { Int32.TryParse(dsResource.Tables[0].Rows[0]["status"].ToString(), out intStatus); } foreach (DataRow drResource in dsResource.Tables[1].Rows) { boolAssigned = true; dblAllocated += double.Parse(drResource["allocated"].ToString()); dblUsed += double.Parse(drResource["used"].ToString()); intStatus = Int32.Parse(drResource["status"].ToString()); } if (intStatus == (int)ResourceRequestStatus.Closed) { lblProgress.Text = oServiceRequest.GetStatusBar(100.00, "100", "12", true); } else if (intStatus == (int)ResourceRequestStatus.Cancelled) { lblProgress.Text = "Cancelled"; } else if (boolAssigned == false) { string strManager = ""; DataSet dsManager = oService.GetUser(intService, 1); // Managers foreach (DataRow drManager in dsManager.Tables[0].Rows) { if (strManager != "") { strManager += "\\n"; } int intManager = Int32.Parse(drManager["userid"].ToString()); strManager += " - " + oUser.GetFullName(intManager) + " [" + oUser.GetName(intManager) + "]"; } lblProgress.Text = "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"alert('This request is pending assignment by the following...\\n\\n" + strManager + "');\">Pending Assignment</a>"; } else if (dblAllocated > 0.00) { lblProgress.Text = oServiceRequest.GetStatusBar((dblUsed / dblAllocated) * 100.00, "100", "12", true); } else { lblProgress.Text = "<i>N / A</i>"; } lblDetails.Text = "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenNewWindowMenu('/datapoint/service/resource.aspx?id=" + oFunction.encryptQueryString(intResource.ToString()) + "', '800', '600');\">" + lblDetails.Text + "</a>"; } } // Provioning History rptHistory.DataSource = oAsset.GetProvisioningHistory(intAsset); rptHistory.DataBind(); lblHistory.Visible = (rptHistory.Items.Count == 0); // WWW rptWWW.DataSource = oAsset.GetHBA(intAsset); rptWWW.DataBind(); lblWWW.Visible = (rptWWW.Items.Count == 0); oDataPoint.LoadButton(btnWWW, intProfile, fldWWW, "PHYSICAL_WWW", "return OpenWindow('ASSET_DEPLOY_HBAs','" + intAsset.ToString() + "');"); } } else { if (Request.QueryString["t"] != null && Request.QueryString["q"] != null) { Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx?t=" + Request.QueryString["t"] + "&q=" + Request.QueryString["q"] + "&r=0"); } else { Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx"); } } } else { Response.Redirect("/datapoint/asset/datapoint_asset_search.aspx"); } btnClose.Attributes.Add("onclick", "window.close();return false;"); btnPrint.Attributes.Add("onclick", "window.print();return false;"); btnDeploy.Attributes.Add("onclick", oDataPoint.LoadValidation()); ddlPlatformClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlPlatformClass.ClientID + "','" + ddlPlatformEnvironment.ClientID + "',0);"); ddlPlatformEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlPlatformEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');"); } else { panDenied.Visible = true; } }
public void Fetch() { Models.Get <ILeaderboardsUIModel>().Fetch(); }
public override bool Start() { try { Log("Starting"); Log("Finding closest posistion"); m_Location = Location.GetClosestLocationInArray(Location.HomlessLocations, Game.LocalPlayer.Character.Position); if (Game.LocalPlayer.Character.Position.DistanceTo(Location.HomlessLocations[m_Location][0].Posistion) < 50) { Log("Distance check failed"); return(false); } Log("Location id: " + m_Location); Log("Adding small blip"); m_Blip = ResourceManager.CreatBlip(Location.HomlessLocations[m_Location][0].Posistion, 120.0f); m_Blip.Alpha = 0.5f; m_Blip.Color = System.Drawing.Color.Yellow; Log("Clearing area of peds and cars"); foreach (Vehicle v in World.GetAllVehicles()) { if (v.DistanceTo(Location.HomlessLocations[m_Location][0].Posistion) < 10 && v.Exists() && v != Game.LocalPlayer.LastVehicle) { v.Delete(); } } foreach (Ped p in World.GetAllPeds()) { if (p.DistanceTo(Location.HomlessLocations[m_Location][0].Posistion) < 10 && p.Exists()) { if (p != Game.LocalPlayer.Character) { p.Delete(); } } } Log("Spawning peds and animations"); int pedamount = Location.GetPedsCountInArray(Location.HomlessLocations[m_Location]); LocationItem[] pedlocations = Location.GetPedsInArray(Location.HomlessLocations[m_Location]); m_Peds = new Ped[pedamount]; for (int i = 0; i < pedamount; i++) { m_Peds[i] = ResourceManager.CreatePed(Models.GetRandomHomless(), pedlocations[i].Posistion, pedlocations[i].Rotation.Z); if (pedlocations[i].AnimName != "" && pedlocations[i].AnimDict != "") { m_Peds[i].Tasks.PlayAnimation(pedlocations[i].AnimDict, pedlocations[i].AnimName, 1, AnimationFlags.Loop); } if (pedlocations[i].Frozen == true) { m_Peds[i].IsPositionFrozen = true; } } Log("Setting ped items and personas"); foreach (Ped p in m_Peds) { Wrapper.SetPedItems(p, SearchItems.GetRandomItemsYellowPed()); } Log("Spawning vehicles"); int vehicleamount = Location.GetVehiclesCountInArray(Location.HomlessLocations[m_Location]); LocationItem[] vehicle = Location.GetVehiclesInArray(Location.HomlessLocations[m_Location]); m_Vehicles = new Vehicle[vehicleamount]; for (int i = 0; i < vehicleamount; i++) { m_Vehicles[i] = ResourceManager.CreateVehicle(vehicle[i].Model, vehicle[i].Posistion, vehicle[i].Rotation.Z); } Log("Setting up vehicles"); foreach (Vehicle v in m_Vehicles) { int loop = Random.Next(1, 5);// = 4// 0<4 1<4 2<4 3<4 for (int i = 0; i < loop; i++) { if (Random.Next(0, 2) == 1) { v.Windows[i].Smash(); } } NativeFunction.Natives.SET_VEHICLE_ALARM(v, true); v.AlarmTimeLeft = TimeSpan.FromHours(1) + TimeSpan.FromMilliseconds(Random.Next(0, 500)); } Log("Setting behaviour path"); //m_BehavPath = Random.Next(0, 3);//0,1,2 m_BehavPath = Random.Next(0, 3); Log("Setting behaviour specific"); Log("Done setting up"); if (Settings.DispatchNotify) { Log("Notify player"); Game.DisplayNotification("Dispatch: we have had multiple calls about car alarms going of in an area, the area is marked on your map"); } return(true); } catch (Exception e) { Game.LogTrivial("[ee] ERROR: " + e); Game.DisplayNotification("Epic events encounterd an error, please file a bug report with your ragepluginhook.log"); End(); return(false); } }
/// <summary> /// /// </summary> /// <param name="fileName"></param> public TritonLeSongMemory(string fileName) : base(fileName) { Model = Models.Find(Models.EOsVersion.EOsVersionTritonLe); }
public void Close() { Models.Get <ILeaderboardsUIModel>().SetActive(false); }
public void Reset(CameraInitialState camera) { Models.Clear(); Textures.Clear(); // Same as RayTracingInOneWeekend but using textures. camera.ModelView = Matrix4x4.CreateLookAt(new Vector3(13, 2, 3), new Vector3(0, 0, 0), new Vector3(0, 1, 0)); camera.FieldOfView = 20; camera.Aperture = 0.1f; camera.FocusDistance = 10.0f; camera.ControlSpeed = 5.0f; camera.GammaCorrection = true; camera.SkyColor1 = new Vector4(1); camera.SkyColor2 = new Vector4(.5f, .7f, 1f, 1f); const bool isProc = true; var random = new Random(42); Models.Add(Model.CreateSphere(new Vector3(0, -1000, 0), 1000, Material.Lambertian(new Vector3(0.5f, 0.5f, 0.5f)), isProc)); for (int a = -11; a < 11; ++a) { for (int b = -11; b < 11; ++b) { float chooseMat = (float)random.NextDouble(); var center = new Vector3(a + 0.9f * (float)random.NextDouble(), 0.2f, b + 0.9f * (float)random.NextDouble()); if ((center - new Vector3(4, 0.2f, 0)).Length() > 0.9) { if (chooseMat < 0.8f) // Diffuse { Models.Add(Model.CreateSphere(center, 0.2f, Material.Lambertian(new Vector3( (float)random.NextDouble() * (float)random.NextDouble(), (float)random.NextDouble() * (float)random.NextDouble(), (float)random.NextDouble() * (float)random.NextDouble())), isProc)); } else if (chooseMat < 0.95f) // Metal { Models.Add(Model.CreateSphere(center, 0.2f, Material.Metallic( new Vector3(0.5f * (1 + (float)random.NextDouble()), 0.5f * (1 + (float)random.NextDouble()), 0.5f * (1 + (float)random.NextDouble())), 0.5f * (float)random.NextDouble()), isProc)); } else // Glass { Models.Add(Model.CreateSphere(center, 0.2f, Material.Dielectric(1.5f), isProc)); } } } } Models.Add(Model.CreateSphere(new Vector3(0, 1, 0), 1.0f, Material.Metallic(new Vector3(1.0f), 0.1f, 2), isProc)); Models.Add(Model.CreateSphere(new Vector3(-4, 1, 0), 1.0f, Material.Lambertian(new Vector3(1.0f), 0), isProc)); Models.Add(Model.CreateSphere(new Vector3(4, 1, 0), 1.0f, Material.Metallic(new Vector3(1.0f), 0.0f, 1), isProc)); Textures.Add(Texture.LoadTexture("./assets/textures/2k_mars.jpg")); Textures.Add(Texture.LoadTexture("./assets/textures/2k_moon.jpg")); Textures.Add(Texture.LoadTexture("./assets/textures/land_ocean_ice_cloud_2048.png")); }
public ModelRepository(ILogger <ModelRepository <T> > logger, IMemoryCache cache, Models <T> models) { _logger = logger; _cache = cache; _models = models; }