/// <summary> /// Initializes a new instance of the <see cref="Game"/> class. /// </summary> /// <param name="application">The photon application instance the game belongs to.</param> /// <param name="gameId">The game id.</param> /// <param name="roomCache">The room cache the game belongs to.</param> /// <param name="pluginManager">plugin creator</param> /// <param name="pluginName">Plugin name which client expects to be loaded</param> /// <param name="environment">different environment parameters</param> /// <param name="executionFiber">Fiber which will execute all rooms actions</param> public Game( GameApplication application, string gameId, Hive.Caching.RoomCacheBase roomCache = null, IPluginManager pluginManager = null, string pluginName = "", Dictionary<string, object> environment = null, ExtendedPoolFiber executionFiber = null ) : base(gameId, roomCache, null, GameServerSettings.Default.MaxEmptyRoomTTL, pluginManager, pluginName, environment, GameServerSettings.Default.LastTouchSecondsDisconnect * 1000, GameServerSettings.Default.LastTouchCheckIntervalSeconds * 1000, DefaultHttpRequestQueueOptions, executionFiber) { this.Application = application; if (this.Application.AppStatsPublisher != null) { this.Application.AppStatsPublisher.IncrementGameCount(); } this.HttpForwardedOperationsLimit = GameServerSettings.Default.HttpForwardLimit; }
public static int Get( Hive hive, string sRoot, string sPath, string sValueName, int iDefault ) { object o = GetObject( hive, sRoot, sPath, sValueName ); if ( o == null ) return iDefault; if ( ! ( o is int ) ) return iDefault; return (int) o; }
public static bool Get( Hive hive, string sRoot, string sPath, string sValueName, bool bDefault ) { object o = GetObject( hive, sRoot, sPath, sValueName ); if ( o == null ) return bDefault; if ( ! ( o is string ) ) return bDefault; return ( string.Compare( (string) o, "False", true, CultureInfo.InvariantCulture ) != 0 ); }
/// <summary> /// Removes a user from the membership data source. /// </summary> /// <param name="username">The name of the user to delete.</param> /// <param name="deleteAllRelatedData">true to delete data related to the user from the database; false to leave data related to the user in the database.</param> /// <returns> /// true if the user was successfully deleted; otherwise, false. /// </returns> public override bool DeleteUser(string username, bool deleteAllRelatedData) { using (var uow = Hive.Create()) { var user = GetRebelUser(uow, username, false); if (user == null) { return(false); } uow.Repositories.Delete <RebelMembershipUser>(user.Id); uow.Complete(); UpdateScopedCache(username, user, null); return(true); } }
static void Main(string[] args) { string userName = "******"; string password = "******"; var byteArray = Encoding.ASCII.GetBytes($"{userName}:{password}"); Dictionary <string, string> customHeaders = new Dictionary <string, string>(); customHeaders.Add("Authorization", $"Basic {Convert.ToBase64String(byteArray)}"); //Uri uri = new Uri("https://powerbiintrahdiiq.azurehdinsight.net/cliservice"); Uri uri = new Uri("http://localhost:10001/cliservice"); var transport = new THttpClientTransport(uri, customHeaders); System.Console.WriteLine("Open connection"); Hive hive = new Hive(transport); hive.OpenAsync().Wait(); System.Console.WriteLine("Get Cursor"); var cursor = hive.GetCursorAsync().Result; System.Console.WriteLine("Execute query"); cursor.ExecuteAsync("SHOW TABLES").Wait(); var result = cursor.FetchManyAsync(100).Result; if (!result.IsEmpty()) { System.Console.WriteLine("-----------Début-------------"); foreach (var row in result) { System.Console.Write("Row - "); var dict = row as IDictionary <string, object>; foreach (var key in dict.Keys) { System.Console.WriteLine($"{key} : {dict[key].ToString()}"); } } System.Console.WriteLine("-----------Fin-------------"); } else { System.Console.WriteLine("No result"); } System.Console.WriteLine("Finished"); }
public World(int mapWidth, int mapHeight, int hiveWidth = 3, int hiveHeight = 3) { this.MapHeight = mapHeight; this.MapWidth = mapWidth; hive = new Hive(hiveHeight, hiveWidth); int noOfObjects = 50; this.mapObjects = new MapObjects[noOfObjects]; for (int i = 0; i < noOfObjects; i++) { float x = Random.Range(-((MapWidth / 2) - 10), (MapWidth / 2) - 10); float z = Random.Range(-((MapHeight / 2) - 10), (MapHeight / 2) - 10); int type = System.Convert.ToInt32(Mathf.Floor(Random.Range(0, 3))); mapObjects[i] = new MapObjects(x, z, (MapObjects.ResourceType)type); } }
/// <summary> /// Return the installation status, this is based on all hive providers /// </summary> /// <returns></returns> public IEnumerable <InstallStatus> GetInstallStatus() { //TODO: Use this cache mechanism! But in order to do so , we need triggers working from Hive providers, currently they are not setup //return _installStatuses ?? (_installStatuses = Hive.GetAllReadWriteProviders() // .Select(x => x.ProviderContext.Bootstrapper.GetInstallStatus()) // .ToArray()); var allReadWriteProviders = Hive.GetAllReadWriteProviders(); var allBootstrappers = allReadWriteProviders.Select(x => new { Key = x.ProviderMetadata.Alias, x.Bootstrapper }). ToArray(); var installStatuses = allBootstrappers .Select(x => x.Bootstrapper.GetInstallStatus()) .ToArray(); return(installStatuses); }
public bool BuildHive() { if (numBees >= 400) { Vector3 newPosition; bool validSpawn = SwarmController.i.CheckMousePlacement(out newPosition); if (validSpawn) { Hive spawnedHive = Instantiate(newHive, newPosition, newHive.transform.rotation).GetComponent <Hive>(); int newNumBees = 200; numBees -= newNumBees; spawnedHive.numBees = newNumBees; return(true); } } return(false); }
public virtual ActionResult Hostname(HiveId?id) { if (id.IsNullValueOrEmpty()) { return(HttpNotFound()); } using (var uow = Hive.Create <IContentStore>()) { //get the typed/content entity for which to assign hostnames var entity = uow.Repositories.Get <TypedEntity>(id.Value); if (entity == null) { throw new ArgumentException("Could not find entity with id " + id); } //get the assigned hostnames var assignedHostnames = uow.Repositories.GetChildren <Hostname>(FixedRelationTypes.HostnameRelationType, id.Value); //get the hostname relations (so there's only one query) var hostnameRelations = uow.Repositories.GetChildRelations(id.Value, FixedRelationTypes.HostnameRelationType).ToArray(); return(View(new HostnamesModel { Id = id.Value, VirtualDirectory = HttpContext.Request.ApplicationPath.TrimEnd('/'), AssignedHostnames = assignedHostnames .Select(x => { //BUG: This should never be null but currently the call to GetRelations is doing some weird caching! var sortOrder = hostnameRelations.Where(r => r.DestinationId == x.Id).SingleOrDefault(); var h = new HostnameEntryModel { Id = x.Id, Hostname = x.Attribute <string>(HostnameSchema.HostnameAlias), SortOrder = sortOrder == null ? 0 : sortOrder.Ordinal }; return h; }) .ToList() })); } }
protected override void CustomizeFileNode(TreeNode n, FormCollection queryStrings) { n.AddEditorMenuItem <CreateItem>(this, "createUrl", "EditRule"); base.CustomizeFileNode(n, queryStrings); n.AddMenuItem <Reload>(); n.Icon = "tree-css"; using (var uow = Hive.CreateReadonly()) { var stylesheet = uow.Repositories.Get <File>(n.HiveId); var rules = StylesheetHelper.ParseRules(stylesheet); n.HasChildren = rules.Count() > 0; if (n.HasChildren) { n.JsonUrl = Url.GetTreeUrl(GetType(), n.HiveId, queryStrings); } } }
public void CreateHiveAndFlower(double width, double height) { Width = width; Height = height; CreateBoundaryWalls(); var hive = new Hive(new Vector2(10, 10), new Size2(30, 30)); hive.Behaviours.Add(new HiveBehaviour(_random)); hive.Behaviours.Add(new NectarCarrierBehaviour()); AddSimObject(hive); var flower = new Flower(new Vector2(Width - 60, Height - 60), new Size2(47, 44)); flower.Behaviours.Add(new FlowerBehaviour()); AddSimObject(flower); }
string MakeFileName(string dataName, string extension) { dataName = Hive.NormalizeDataName(dataName); if (dataName._IsEmpty()) { dataName = Options.DefaultDataName; } string ret = PathParser.Combine(Options.RootDirectoryPath, SafePathParser.MakeSafePathName(dataName), true); ret = PathParser.RemoveDangerousDirectoryTraversal(ret); ret = PathParser.NormalizeDirectorySeparatorIncludeWindowsBackslash(ret); ret += extension; return(ret); }
public override void Resolve(ResolveParams rp) { //spawn Hives ResolveParams resolveParamsHives = rp; int hiveCount = rp.rect.Width * rp.rect.Height / 1200; //Adjust as needed. Maybe run symbol multiple times in parent function. It was 800 at first IntVec3 loc; hiveCount = Math.Min(30, hiveCount); for (int i = 0; i < hiveCount; i++) { if (this.TryFindHivePos(rp.rect, out loc)) { Thing thingHive = ThingMaker.MakeThing(ThingDefOf.Hive, null); thingHive.SetFaction(Faction.OfInsects, null); Hive hive = (Hive)GenSpawn.Spawn(thingHive, loc, BaseGen.globalSettings.map, WipeMode.Vanish); hive.PawnSpawner.SpawnPawnsUntilPoints(Hive.InitialPawnsPoints); } } }
public IActionResult About(int id, int aId) { ViewBag.Title = "Информация об улье"; IEnumerable <Hive> hive = db.Hives.Where(i => i.Apiary.Id == aId && i.Apiary.User.Email == User.Identity.Name.ToString()).OrderBy(i => i.Id); Hive hiv = hive.FirstOrDefault(i => i.Id == id); if (hiv == null) { return(RedirectToAction("HiveView", "Apiary", new { id = aId })); } else { var ap = new HiveViewModel { Id = hiv.Id, Name = hiv.Name, Aid = aId, Desc = hiv.Desc, Force = hiv.Force, Mass = hiv.Mass, Frame = hiv.Frame, Wframe = hiv.Wframe, Hframe = hiv.Hframe, Porod = hiv.Porod, Heal = hiv.Heal, Heal1 = hiv.Heal1, Heal2 = hiv.Heal2, Heal3 = hiv.Heal3, Heal4 = hiv.Heal4, Heal5 = hiv.Heal5, Heal6 = hiv.Heal6, Heal7 = hiv.Heal7, Heal8 = hiv.Heal8, Heal9 = hiv.Heal9, Matka = hiv.Matka, DatePods = hiv.DatePods, Plod = hiv.Plod, Prois = hiv.Prois }; return(View(ap)); } }
protected virtual ActionResult ProcessCreate(TEditorModel model, bool isRevisional) { Mandate.ParameterNotNull(model, "model"); //persist the data using (var uow = Hive.Create <IContentStore>()) { //EnsureUniqueName(model); var entity = BackOfficeRequestContext.Application.FrameworkContext.TypeMappers.Map <TEditorModel, Revision <TypedEntity> >(model); var success = this.TryExecuteSecuredMethod(x => x.ProcessSave(model, entity), model.Id).Success; if (!success) { // Report unathorized NotifyForProcess(NotificationState.SaveUnauthorized, model); } if (success) { if (isRevisional) { uow.Repositories.Revisions.AddOrUpdate(entity); } else { uow.Repositories.AddOrUpdate(entity.Item); } uow.Complete(); //need to clear the URL cache for this entry BackOfficeRequestContext.RoutingEngine.ClearCache(clearGeneratedUrls: true, clearMappedUrls: true); //add path for entity for SupportsPathGeneration (tree syncing) to work GeneratePathsForCurrentEntity(uow.Repositories.GetEntityPaths <TypedEntity>(entity.Item.Id, FixedRelationTypes.DefaultRelationType)); return(RedirectToAction("Edit", new { id = entity.Item.Id })); } return(View("Edit", model)); } }
/// <summary> /// Validates the input /// </summary> /// <param name="validationContext"></param> /// <returns></returns> public override IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { //we need to validate if the user already exists if ((Id.IsNullValueOrEmpty())) { using (var uow = Hive.Create()) { //TODO: Fix the query context to support stuff like Any() without executing and returning all of the data. if (uow.Repositories.QueryContext.Query <User>().Where(x => x.Username == Username).ToArray().Any()) { yield return(new ValidationResult("A User with the specified Username already exists", new[] { "Username" })); } } } if (UserGroups == null || !UserGroups.Any()) { yield return(new ValidationResult("A user must belong to at least one user group", new[] { "UserGroups" })); } }
/// <summary> /// This adds some required elements to the ViewBag so that the Create view renders correctly /// </summary> protected virtual void EnsureCreateWizardViewBagData(HiveId parentId) { ViewBag.ControllerId = UmbracoController.GetControllerId <EditorAttribute>(GetType()); ViewBag.Title = CreateNewTitle; using (var uow = Hive.Create <IContentStore>()) { //get all the document types under the specified parent var schemas = uow.Repositories.Schemas.GetEntityByRelationType <EntitySchema>(FixedRelationTypes.DefaultRelationType, parentId); var docTypesInfo = schemas.Select(BackOfficeRequestContext.Application.FrameworkContext.TypeMappers.Map <EntitySchema, DocumentTypeInfo>); ViewBag.AvailableDocumentTypes = new[] { new DocumentTypeInfo() { Id = parentId, Name = "[None]" } }.Concat(docTypesInfo); //add the thumbnail path to the view bag ViewBag.DocTypeThumbnailBaseUrl = Url.Content(BackOfficeRequestContext.Application.Settings.UmbracoFolders.DocTypeThumbnailFolder); } }
public void TestHive() { TextBox b1 = new TextBox(); TextBox b2 = new TextBox(); Hive h = new Hive(b1, b2); h.addNectar(-10); Assert.AreEqual(b1.Text, (100 - 10).ToString()); h.addHoney(-100); Assert.AreEqual(b2.Text, (3000 - 100).ToString()); int nectar = 500; int honey = 5000; Hive h2 = new Hive(b1, b2, nectar, honey); h2.addNectar(-10); Assert.AreEqual(b1.Text, (nectar - 10).ToString()); h2.addHoney(-100); Assert.AreEqual(b2.Text, (honey - 100).ToString()); }
/// <summary> /// Displays the editor /// </summary> /// <param name="id"></param> /// <returns></returns> public override ActionResult Edit(HiveId?id) { if (id.IsNullValueOrEmpty()) { return(HttpNotFound()); } using (var uow = Hive.Create()) { var file = uow.Repositories.Get <File>(id.Value); if (file != null) { var model = BackOfficeRequestContext.Application.FrameworkContext.TypeMappers.Map <FileEditorModel>(file); EnsureViewData(model, file); return(View(model)); } } return(HttpNotFound()); }
protected override void Execute(CodeActivityContext context) { string hive = null; switch (Hive.Get(context)) { case Microsoft.Win32.RegistryHive.ClassesRoot: hive = "HKEY_CLASSES_ROOT"; break; case Microsoft.Win32.RegistryHive.CurrentConfig: hive = "HKEY_CURRENT_CONFIG"; break; case Microsoft.Win32.RegistryHive.CurrentUser: hive = "HKEY_CURRENT_USER"; break; case Microsoft.Win32.RegistryHive.DynData: hive = "HKEY_DYN_DATA"; break; case Microsoft.Win32.RegistryHive.LocalMachine: hive = "HKEY_LOCAL_MACHINE"; break; case Microsoft.Win32.RegistryHive.PerformanceData: hive = "HKEY_PERFORMANCE_DATA"; break; case Microsoft.Win32.RegistryHive.Users: hive = "HKEY_USERS"; break; } string keyName = string.Format("{0}\\{1}", hive, KeyPath.Get(context).TrimEnd('\\')); object returnValue = Microsoft.Win32.Registry.GetValue(keyName, ValueName.Get(context), DefaultValue.Get(context)); OutputValue.Set(context, returnValue); }
//[RebelAuthorize(Permissions = new[] { FixedPermissionIds.Sort })] public virtual JsonResult SortForm(SortModel model) { if (!TryValidateModel(model)) { return(ModelState.ToJsonErrors()); } EntityPathCollection path; using (var uow = Hive.Create <IContentStore>()) { var found = uow.Repositories.Get(model.ParentId); var exists = uow.Repositories.Exists <TypedEntity>(model.ParentId); if (!exists) { throw new ArgumentException(string.Format("No entity found for id: {0} on action Sort", model.ParentId)); } var childRelations = uow.Repositories.GetChildRelations(model.ParentId, FixedRelationTypes.DefaultRelationType); foreach (var item in model.Items) { var relation = childRelations.Single(x => x.DestinationId.EqualsIgnoringProviderId(item.Id)); uow.Repositories.ChangeRelation(relation, relation.SourceId, relation.DestinationId, item.SortIndex); } path = uow.Repositories.GetEntityPaths(model.ParentId, FixedRelationTypes.DefaultRelationType); uow.Complete(); } Notifications.Add(new NotificationMessage( "Sort.Success.Message".Localize(this), "Sort.Title".Localize(this), NotificationType.Success)); return(new CustomJsonResult(new { success = true, notifications = Notifications, msg = "Sort.Success.Message".Localize(this), path = path.ToJson() }.ToJsonString)); }
public virtual ActionResult CreateNewForm(CreateContentModel createModel) { Mandate.ParameterNotNull(createModel, "createModel"); Mandate.That <NullReferenceException>(!createModel.ParentId.IsNullValueOrEmpty()); Mandate.That <NullReferenceException>(!createModel.SelectedDocumentTypeId.IsNullValueOrEmpty()); //validate the model TryUpdateModel(createModel); //get the create new result view which will validate that the selected doc type id is in fact allowed var result = CreateNewView(createModel); //if at this point the model state is invalid, return the result which is the CreateNew view if (!ModelState.IsValid) { return(result); } using (var uow = Hive.Create <IContentStore>()) { var schema = uow.Repositories.Schemas.Get <EntitySchema>(createModel.SelectedDocumentTypeId); if (schema == null) { throw new ArgumentException(string.Format("No schema found for id: {0} on action Create", createModel.SelectedDocumentTypeId)); } //create the empty content item var contentViewModel = CreateNewContentEntity(schema, createModel.Name, createModel.ParentId); //map the Ids correctly to the model so it binds ReconstructModelPropertyIds(contentViewModel); return(ProcessCreate(contentViewModel, true)); } //everything is valid, now we need to render out the editor for this document type without any data //return RedirectToAction("Create", new //{ // docTypeId = createModel.SelectedDocumentTypeId, // name = createModel.Name, // parentId = createModel.ParentId //}); }
public IActionResult Index(int aid, int hid) { ViewBag.Title = "Статистика улья"; IEnumerable <Inspect> insp = db.Inspects.Where(i => i.Hive.Apiary.User.Email.Equals(User.Identity.Name) && i.Hive.Apiary.Id == aid && i.Hive.Id == hid).OrderByDescending(i => i.Date); Hive hiv = db.Hives.FirstOrDefault(i => i.Apiary.User.Email.Equals(User.Identity.Name) && i.Apiary.Id == aid && i.Id == hid); if (hiv == null) { return(RedirectToAction("HiveView", "Apiary", new { id = aid })); } var ins = new InspectViewModel { HiveName = hiv.Name, Inspects = insp, Aid = aid, Hid = hid, }; return(View(ins)); }
public static async Task <Hive> Create() { Caption.Title("Add Hive"); List <Queen> queens = await Context.Get.Queens.ToListAsync(); if (queens.Count == 0) { Console.WriteLine("You cannot create a hive without a queen!"); return(null); } ListView.Print(queens); var hive = new Hive(); var queenID = Ask.Value("Queen ID"); hive.Queen = Context.Get.Queens.Find(queenID); hive.Name = Ask.String("Name"); return(hive); }
public void Parse_SpecifyHiveLoc_CreatesCorrespondingAdd(string tok, Hive hive, EditItem.Location loc) { // Arrange Parser sut = new Parser(); const string Item = "TestItem"; string[] items = { $"[{tok}]", $"+{Item}" }; // Act IEnumerable <EditItem> enumerable = sut.Parse(items); var actual = enumerable.First(); // Assert var expected = new EditItem(Item, EditItem.Action.Add, hive, loc); Assert.That(actual, Is.EqualTo(expected)); }
public virtual JsonResult EmptyBin() { using (var uow = Hive.Create <IContentStore>()) { var items = uow.Repositories.GetChildren <TypedEntity>(FixedRelationTypes.DefaultRelationType, RecycleBinId); foreach (var i in items) { // Delete hostnames var hostnameRelations = i.RelationProxies.GetChildRelations(FixedRelationTypes.HostnameRelationType); foreach (var hostnameRelation in hostnameRelations) { uow.Repositories.Delete <TypedEntity>(hostnameRelation.Item.DestinationId); } uow.Repositories.Delete <TypedEntity>(i.Id); } uow.Complete(); } return(Json(new { success = true, message = "Success" })); }
public void DoScout(Hive hive, int index) { Matrix trial; double trialScore; GenerateTempScoutingMatrix(hive, out trial, out trialScore); // let's see if we have an announcement to make if (random.NextDouble() < hive._probMistake * 5 || trialScore < _memoryScore) { // keep the trial trial.CopyMatrixTo(_memoryMatrix); _memoryScore = trialScore; // if we have a new best score save it hive.TestNewBest(_memoryMatrix, _memoryScore); // tell everyone the good news hive.Waggle(this); } }
public async Task AddHive(string userId, Hive hive) { await Policy.Handle <HttpRequestException>(ex => { Debug.WriteLine($"{ex.Message}"); return(true); }) .WaitAndRetryAsync( retryCount: 5, sleepDurationProvider: retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)), onRetry: (ex, time) => { Console.WriteLine($"Something went wrong: {ex.Message}, retrying..."); } ).ExecuteAsync(async() => await firebase.Child($"BeeHives/{userId}") .PostAsync(new Hive() { HiveName = hive.HiveName, HiveLocation = hive.HiveLocation })); }
public IActionResult Index(int aid, int hid) { ViewBag.Title = "Сбор продуктов"; IEnumerable <Honey> hone = db.Honey.Where(i => i.Hive.Apiary.User.Email.Equals(User.Identity.Name) && i.Hive.Apiary.Id == aid && i.Hive.Id == hid).OrderByDescending(i => i.Date); Hive hiv = db.Hives.FirstOrDefault(i => i.Apiary.User.Email.Equals(User.Identity.Name) && i.Apiary.Id == aid && i.Id == hid); if (hiv == null) { return(RedirectToAction("HiveView", "Apiary", new { id = aid })); } var hon = new HoneyViewModel { HiveName = hiv.Name, Honeys = hone, Aid = aid, Hid = hid, }; return(View(hon)); }
public static string [] GetSubKeyNames(string path, Hive hive) { RegistryKey hkey; if (hive == Hive.CurrentUser) { hkey = Registry.CurrentUser; hkey = hkey.OpenSubKey(path, false); if (hkey == null) { return(null); } else { return(hkey.GetSubKeyNames()); } } else if (hive == Hive.LocalMachine) { hkey = Registry.LocalMachine; using (var hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64)) { hkey = hklm.OpenSubKey(path); } //hkey = hkey.OpenSubKey(path, false); if (hkey == null) { return(null); } else { return(hkey.GetSubKeyNames()); } } else { return(null); } }
public virtual ActionResult Rollback(HiveId id) { var model = new RollbackModel { Id = id }; using (var uow = Hive.Create <IContentStore>()) { var entity = uow.Repositories.Revisions.GetLatestRevision <TypedEntity>(model.Id); if (entity == null) { throw new NullReferenceException("Could not find entity with id " + model.Id); } model.LastRevision = entity; var nameAttr = model.LastRevision.Item.Attributes.FirstOrDefault(x => x.AttributeDefinition.Alias == NodeNameAttributeDefinition.AliasValue); model.Name = nameAttr != null?nameAttr.GetValueAsString("Name") : "Unknown"; model.CreateDate = model.LastRevision.Item.UtcStatusChanged.DateTime; var revisions = uow.Repositories.Revisions.GetAll <TypedEntity>(model.LastRevision.Item.Id); model.Versions = revisions .OrderByDescending(x => x.MetaData.UtcStatusChanged) .Skip(1) // Skip current revision .Select(x => { var name = x.MetaData.StatusType.Name.IfNull(y => new LocalizedString(x.MetaData.StatusType.Alias)); return(new SelectListItem { Text = x.MetaData.UtcCreated.DateTime.ToShortDateString() + " " + x.MetaData.UtcCreated.DateTime.ToShortTimeString() + " - '" + name + "'", Value = x.MetaData.Id.ToString() }); }); } return(View(model)); }
private void OnRenderBatch(int browserRendererId, int batchId, byte[] batchData) { try { RenderBatchReceived?.Invoke(browserRendererId, batchId, batchData); var batch = RenderBatchReader.Read(batchData); Hive.Update(batch); if (ConfirmRenderBatch) { _ = ConfirmBatch(batchId); } NextBatchReceived?.Completion?.TrySetResult(null); } catch (Exception e) { NextBatchReceived?.Completion?.TrySetResult(e); } }
public ActionResult Publish(HiveId?id) { if (id.IsNullValueOrEmpty()) { return(HttpNotFound()); } using (var uow = Hive.Create <IContentStore>()) { var contentEntity = uow.Repositories.Revisions.GetLatestRevision <TypedEntity>(id.Value); if (contentEntity == null) { throw new ArgumentException(string.Format("No entity found for id: {0} on action Publish", id)); } return(View(new PublishModel { Id = contentEntity.Item.Id, Name = contentEntity.Item.GetAttributeValueAsString(NodeNameAttributeDefinition.AliasValue, "UrlName") })); } }
public Setting( Hive hive, string name, object defaultValue ) { _Hive = hive; _Name = name; _Default = defaultValue; }
//Constructor public LifeObject(Hive h, NodalNetwork nn) { //Set Energies //this._interalEnergy = new Energy(Energy.State.Entropy, nn.EnergyCost); //Handle Hive Creation/Setting if (h == null) this._myHive = new Hive(); else this._myHive = h; //Add TO Hive //this._myHive.AddLifeObject(this); this._myID = this._myHive.NextID(); //Set Neural Netowrk this._myNetwork = nn; }
RegistryComparison(string HiveFileA, string HiveFileB) { hiveA = new Hive(HiveFileA); hiveB = new Hive(HiveFileB); }
public static string Get( Hive hive, string sRoot, string sPath, string sValueName, string sDefault ) { object o = GetObject( hive, sRoot, sPath, sValueName ); if ( o == null ) return sDefault; if ( ! ( o is string ) ) return sDefault; return (string) o; }
public static object GetObject( Hive hive, string sRoot, string sPath, string sValueName ) { string s = DefaultRegistrySettingsPath; if ( sRoot != null && sRoot.Length > 0 ) s = sRoot; if ( sPath != null && sPath.Length > 0 ) s += "\\" + sPath; RegistryKey key; switch ( hive ) { case Hive.HKCU : key = Registry.CurrentUser .OpenSubKey( s ); break; case Hive.HKLM : key = Registry.LocalMachine.OpenSubKey( s ); break; default: throw new ArgumentException( "Unknown hive" ); } if ( key == null ) return null; object o = key.GetValue( sValueName ); key.Close(); return o; }
// Use this for initialization void Start() { newUnitStats = GetComponent<UnitStats>(); hive = GetComponent<Hive> (); }