Exemplo n.º 1
0
        public static DeleteSet Read(IDSDecoder decoder)
        {
            var ds = new DeleteSet();

            var numClients = (int)decoder.Reader.ReadVarUint();

            Debug.Assert(numClients >= 0);

            for (int i = 0; i < numClients; i++)
            {
                decoder.ResetDsCurVal();

                var client          = (int)decoder.Reader.ReadVarUint();
                var numberOfDeletes = (int)decoder.Reader.ReadVarUint();

                if (numberOfDeletes > 0)
                {
                    if (!ds.Clients.TryGetValue(client, out var dsField))
                    {
                        dsField            = new List <DeleteItem>(numberOfDeletes);
                        ds.Clients[client] = dsField;
                    }

                    for (int j = 0; j < numberOfDeletes; j++)
                    {
                        var deleteItem = new DeleteItem(decoder.ReadDsClock(), decoder.ReadDsLength());
                        dsField.Add(deleteItem);
                    }
                }
            }

            return(ds);
        }
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DeleteItem deleteItemForm = new DeleteItem();

            deleteItemForm.DeleteItemEvent += new EventHandler <DeleteItemEventArgs>(this.OnDeleteItemEvent);
            deleteItemForm.Show();
        }
Exemplo n.º 3
0
        public void Delete_ReadOnly_Ignored()
        {
            var selectorStorage = new FakeSelectorStorage(new FakeIStorage(new List <string> {
                "/"
            },
                                                                           new List <string> {
                "/readonly/test.jpg"
            }, new List <byte[]> {
                FakeCreateAn.CreateAnImage.Bytes
            }));

            var fakeQuery =
                new FakeIQuery(new List <FileIndexItem> {
                new FileIndexItem("/readonly/test.jpg")
            });
            var deleteItem = new DeleteItem(fakeQuery, new AppSettings {
                ReadOnlyFolders = new List <string> {
                    "/readonly"
                }
            }, selectorStorage);
            var result = deleteItem.Delete("/readonly/test.jpg", true);

            Assert.AreEqual(FileIndexItem.ExifStatus.ReadOnly,
                            result.FirstOrDefault().Status);
        }
Exemplo n.º 4
0
        public void OnGetItem(string senderId, GetItemPayload getItemPayload)
        {
            Console.WriteLine(">> GetItem");

            var itemId = getItemPayload.ItemId;

            if (items.ContainsKey(itemId))
            {
                items.Remove(itemId);
                players[getItemPayload.PlayerId].Scale += 0.3f;

                // スケールの変更
                if (players[getItemPayload.PlayerId].Scale >= 3.0f)
                {
                    players[getItemPayload.PlayerId].Scale = 3.0f;
                }

                var deleteItemRpc  = new DeleteItem(new DeleteItemPayload(itemId));
                var deleteItemJson = JsonConvert.SerializeObject(deleteItemRpc);
                broadcast(deleteItemJson);
            }
            else
            {
                Console.WriteLine("Not found ItemId: " + itemId);
            }
        }
Exemplo n.º 5
0
        public frmMain()
        {
            InitializeComponent();

            PipelineHelper.DefaultInit();

            builder = new ContentBuilder(null);
            builder.BuildStatusChanged += Builder_BuildStatusChanged;
            builder.ItemProgress       += Builder_ItemProgress;
            builder.BuildMessage       += Builder_BuildMessage;
            treeMap = new Dictionary <ContentItem, TreeNode>();

            treeContentFiles.NodeMouseClick += TreeContentFilesOnNodeMouseClick;

            this.newFolderMenuItem.Click        += (o, e) => AddNewFolder.Execute(GetSelectedItem(), CurrentProject.File);
            this.existingFolderMenuItem.Click   += (o, e) => AddExistingFolder.Execute(GetSelectedItem(), CurrentProject.File);
            this.existingItemMenuItem.Click     += (o, e) => AddExistingItem.Execute(GetSelectedItem(), CurrentProject.File);
            this.deleteMenuItem.Click           += (o, e) => DeleteItem.Execute(GetSelectedItem());
            this.deleteToolStripMenuItem.Click  += (o, e) => DeleteItem.Execute(GetSelectedItem());
            this.deleteToolStripMenuItem1.Click += (o, e) => DeleteItem.Execute(GetSelectedItem());
            this.renameMenuItem.Click           += (o, e) => RenameItem.Execute(GetSelectedItem(), treeMap);
            this.renameToolStripMenuItem.Click  += (o, e) => RenameItem.Execute(GetSelectedItem(), treeMap);
            this.renameToolStripMenuItem1.Click += (o, e) => RenameItem.Execute(GetSelectedItem(), treeMap);
            this.buildToolStripMenuItem.Click   += (o, e) => BuildItem.Execute(GetSelectedItem(), builder);
            this.buildToolStripMenuItem1.Click  += (o, e) => BuildItem.Execute(GetSelectedItem(), builder);
            this.buildToolStripMenuItem2.Click  += (o, e) => BuildItem.Execute(GetSelectedItem(), builder);
        }
Exemplo n.º 6
0
        public DeleteResponse DeleteMenu(DeleteItem item)
        {
            var response = new DeleteResponse {
                ItemId = item.SlideId
            };


            try
            {
                var query = $"delete from menus where id='{item.Id}'";

                var record = this.ExecuteNonQuery(query);

                if (record == 1)
                {
                    this._timeStampRepository.UpdateTimeStamp(item.SlideId);
                    response.Success = true;
                }
            }
            catch (Exception e)
            {
                //Console.WriteLine(e);
                //throw;
            }

            return(response);
        }
Exemplo n.º 7
0
        public void Delete_IsFileRemoved()
        {
            var storage = new FakeIStorage(new List <string> {
                "/"
            },
                                           new List <string> {
                "/test.jpg"
            },
                                           new List <byte[]> {
                FakeCreateAn.CreateAnImage.Bytes
            });
            var selectorStorage = new FakeSelectorStorage(storage);

            var fakeQuery =
                new FakeIQuery(new List <FileIndexItem> {
                new FileIndexItem("/test.jpg")
                {
                    Tags = "!delete!"
                }
            });
            var deleteItem = new DeleteItem(fakeQuery, new AppSettings(), selectorStorage);
            var result     = deleteItem.Delete("/test.jpg", true);

            Assert.AreEqual(FileIndexItem.ExifStatus.Ok,
                            result.FirstOrDefault().Status);

            Assert.IsNull(fakeQuery.GetObjectByFilePath("/test.jpg"));
            Assert.IsFalse(storage.ExistFile("/test.jpg"));
        }
Exemplo n.º 8
0
        public void ApiController_Delete_API_RemoveNotAllowedFile_Test()
        {
            // re add data
            var createAnImage = InsertSearchData();

            // Clean existing items to avoid errors
            var itemByHash = _query.SingleItem(createAnImage.FilePath);

            itemByHash.FileIndexItem.Tags = string.Empty;
            _query.UpdateItem(itemByHash.FileIndexItem);

            _appSettings.DatabaseType = AppSettings.DatabaseTypeList.InMemoryDatabase;

            var selectorStorage =
                new FakeSelectorStorage(new StorageSubPathFilesystem(_appSettings, new FakeIWebLogger()));

            var deleteItem = new DeleteItem(_query, _appSettings, selectorStorage);
            var controller = new DeleteController(deleteItem);

            var notFoundResult = controller.Delete(createAnImage.FilePath) as NotFoundObjectResult;

            Assert.AreEqual(404, notFoundResult.StatusCode);
            var jsonCollection = notFoundResult.Value as List <FileIndexItem>;

            Assert.AreEqual(FileIndexItem.ExifStatus.OperationNotSupported,
                            jsonCollection.FirstOrDefault().Status);

            _query.RemoveItem(_query.SingleItem(createAnImage.FilePath).FileIndexItem);
        }
Exemplo n.º 9
0
        public void ApiController_Delete_API_HappyFlow_Test()
        {
            var createAnImage = InsertSearchData(true);

            _appSettings.DatabaseType = AppSettings.DatabaseTypeList.InMemoryDatabase;

            // RealFs Storage
            var selectorStorage = new FakeSelectorStorage(new StorageSubPathFilesystem(_appSettings, new FakeIWebLogger()));

            var deleteItem = new DeleteItem(_query, _appSettings, selectorStorage);
            var controller = new DeleteController(deleteItem);

            Console.WriteLine("createAnImage.FilePath");
            Console.WriteLine(createAnImage.FilePath);

            new CreateAnImage();

            var actionResult = controller.Delete(createAnImage.FilePath) as JsonResult;

            Assert.AreNotEqual(actionResult, null);
            var jsonCollection = actionResult.Value as List <FileIndexItem>;

            Assert.AreEqual(createAnImage.FilePath, jsonCollection.FirstOrDefault().FilePath);
            new CreateAnImage();             //restore afterwards
        }
Exemplo n.º 10
0
        public void Delete_DirectoryWithChildItems_CollectionsOff()
        {
            var storage = new FakeIStorage(new List <string> {
                "/test", "/"
            },
                                           new List <string> {
                "/test/image.jpg", "/test/image.dng"
            },
                                           new List <byte[]> {
                FakeCreateAn.CreateAnImage.Bytes,
                FakeCreateAn.CreateAnImage.Bytes
            });
            var selectorStorage = new FakeSelectorStorage(storage);

            var fakeQuery =
                new FakeIQuery(new List <FileIndexItem> {
                new FileIndexItem("/test")
                {
                    IsDirectory = true, Tags = "!delete!"
                }, new FileIndexItem("/test/image.jpg"),
                new FileIndexItem("/test/image.dng")
            });

            var deleteItem = new DeleteItem(fakeQuery, new AppSettings(), selectorStorage);
            var result     = deleteItem.Delete("/test", false);

            Assert.AreEqual(3, result.Count);
            Assert.AreEqual("/test", result[0].FilePath);
            Assert.AreEqual("/test/image.jpg", result[1].FilePath);
            Assert.AreEqual("/test/image.dng", result[2].FilePath);

            Assert.AreEqual(0, storage.GetAllFilesInDirectoryRecursive("/").Count());
            Assert.AreEqual(0, fakeQuery.GetAllRecursive("/").Count);
        }
Exemplo n.º 11
0
        public void Delete_ChildDirectories()
        {
            var storage = new FakeIStorage(new List <string> {
                "/test", "/", "/test/child", "/test/child/child"
            },
                                           new List <string> (),
                                           new List <byte[]>());
            var selectorStorage = new FakeSelectorStorage(storage);

            var fakeQuery =
                new FakeIQuery(new List <FileIndexItem> {
                new FileIndexItem("/test")
                {
                    IsDirectory = true, Tags = "!delete!"
                },
                new FileIndexItem("/test/child")
                {
                    IsDirectory = true
                },
                new FileIndexItem("/test/child/child")
                {
                    IsDirectory = true
                },
            });

            var deleteItem = new DeleteItem(fakeQuery, new AppSettings(), selectorStorage);
            var result     = deleteItem.Delete("/test", false);

            Assert.AreEqual(3, result.Count);
            Assert.AreEqual("/test", result[0].FilePath);
            Assert.AreEqual("/test/child", result[1].FilePath);
            Assert.AreEqual("/test/child/child", result[2].FilePath);
        }
 private void Button2_Click(object sender, EventArgs e)
 {
     listBox4.Items.Clear();
     listBox5.Items.Clear();
     listBox6.Items.Clear();
     DeleteItem.Show();
     DeleteItem.BringToFront();
     Admin.ReadFabricInfo(listBox6, listBox5, listBox4, listBox8);
 }
Exemplo n.º 13
0
        public void Delete_FileNotFound_Ignore()
        {
            var selectorStorage = new FakeSelectorStorage(new FakeIStorage());
            var deleteItem      = new DeleteItem(new FakeIQuery(), new AppSettings(), selectorStorage);
            var result          = deleteItem.Delete("/not-found", true);

            Assert.AreEqual(FileIndexItem.ExifStatus.NotFoundNotInIndex,
                            result.FirstOrDefault().Status);
        }
Exemplo n.º 14
0
        public void Should_throw_error_when_Item_id_is_invalid(int id)
        {
            var cmd = new DeleteItem {
                ItemId = id
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message.EqualTo("ItemId must be greater than 0"));
        }
Exemplo n.º 15
0
        /// <summary>
        /// </summary>
        /// <param name="client">
        /// </param>
        /// <param name="quality">
        /// </param>
        public static void TradeSkillBuildPressed(ZoneClient client, int quality)
        {
            TradeSkillInfo source = client.Character.TradeSkillSource;
            TradeSkillInfo target = client.Character.TradeSkillTarget;

            Item sourceItem = client.Character.BaseInventory.GetItemInContainer(source.Container, source.Placement);
            Item targetItem = client.Character.BaseInventory.GetItemInContainer(target.Container, target.Placement);

            TradeSkillEntry ts = TradeSkill.Instance.GetTradeSkillEntry(sourceItem.HighID, targetItem.HighID);

            quality = Math.Min(quality, ItemLoader.ItemList[ts.ResultHighId].Quality);
            if (ts != null)
            {
                if (WindowBuild(client, quality, ts, sourceItem, targetItem))
                {
                    Item           newItem        = new Item(quality, ts.ResultLowId, ts.ResultHighId);
                    InventoryError inventoryError = client.Character.BaseInventory.TryAdd(newItem);
                    if (inventoryError == InventoryError.OK)
                    {
                        AddTemplate.Send(client, newItem);

                        // Delete source?
                        if ((ts.DeleteFlag & 1) == 1)
                        {
                            client.Character.BaseInventory.RemoveItem(source.Container, source.Placement);
                            DeleteItem.Send(client, source.Container, source.Placement);
                        }

                        // Delete target?
                        if ((ts.DeleteFlag & 2) == 2)
                        {
                            client.Character.BaseInventory.RemoveItem(target.Container, target.Placement);
                            DeleteItem.Send(client, target.Container, target.Placement);
                        }

                        client.Character.Playfield.Publish(
                            ChatText.CreateIM(
                                client.Character,
                                SuccessMessage(
                                    sourceItem,
                                    targetItem,
                                    new Item(quality, ts.ResultLowId, ts.ResultHighId))));

                        client.Character.Stats[StatIds.xp].Value += CalculateXP(quality, ts);
                    }
                }
            }
            else
            {
                client.Character.Playfield.Publish(
                    ChatText.CreateIM(
                        client.Character,
                        "It is not possible to assemble those two items. Maybe the order was wrong?"));
                client.Character.Playfield.Publish(ChatText.CreateIM(client.Character, "No combination found!"));
            }
        }
Exemplo n.º 16
0
        public object Delete(DeleteItem request)
        {
            var entity = request.ConvertTo <Item>();

            return(InTransaction(db =>
            {
                Logic.Remove(entity);
                return new CommonResponse();
            }));
        }
Exemplo n.º 17
0
        public void Should_throw_error_when_Item_id_is_not_found()
        {
            const int id  = 1;
            var       cmd = new DeleteItem {
                ItemId = id
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message.EqualTo($"Item with ID {id} was not found"));
        }
Exemplo n.º 18
0
 void удалитьToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (DeleteItem != null)
     {
         if (dataGridView_db.RowCount > 0 && dataGridView_db.SelectedRows.Count > 0)
         {
             DeleteItem.Invoke(dataGridView_db.SelectedRows[0].Cells[0].Value);
         }
     }
 }
Exemplo n.º 19
0
        private void ChannelPopupDelete(object sender, RoutedEventArgs e)
        {
            var treeComponent = (e.OriginalSource as MenuItem)?.DataContext as TreeComponent;

            if (treeComponent == null)
            {
                return;
            }

            DeleteItem?.Invoke(treeComponent);
        }
Exemplo n.º 20
0
        public DeleteResponse DeleteMenu(DeleteItem item)
        {
            var response = this._menuRepository.DeleteMenu(item);

            if (response.Success)
            {
                var ticks = DateTime.Now.Ticks.ToString();
                //this._menuRepository.SetDateTimeStamp(slideId, string.Format("dt{0}dt", ticks));
            }
            return(response);
        }
Exemplo n.º 21
0
    // Start is called before the first frame update
    void Start()
    {
        rb = GetComponent <Rigidbody>();
        di = GetComponent <DeleteItem>();

        encumbrance = 5; //defaults to half-full on game start
        PowerUp1    = true;

        sourceGameBGM.Play();
        sourceFootstep.Play(); //** TEMPORARY **; will need to move this somewhere else if/when we make a title screen
        PupActive = true;
    }
Exemplo n.º 22
0
        /// <summary>
        /// Deletes given product from recombee database.
        /// </summary>
        /// <param name="user">Product to delete.</param>
        public void Delete(SKUTreeNode productPage)
        {
            var deleteRequest = new DeleteItem(productPage.DocumentGUID.ToString());

            try
            {
                client.Send(deleteRequest);
            }
            catch (Exception ex)
            {
                Service.Resolve <IEventLogService>().LogException("RecombeeAdminModule", "ON_PRODUCT_DELETE", ex);
            }
        }
Exemplo n.º 23
0
        public void Should_delete_Item()
        {
            new ItemBuilder().With(cr => cr.Id, 7)
            .BuildAndSave();

            var cmd = new DeleteItem {
                ItemId = 7
            };

            Assert.That(() => Repository.Execute(cmd), Throws.Nothing);

            Assert.That(DataContext.AsQueryable <Item>(), Is.Empty);
        }
Exemplo n.º 24
0
        public void Delete_NotFoundOnDisk_Ignore()
        {
            var selectorStorage = new FakeSelectorStorage(new FakeIStorage());
            var fakeQuery       =
                new FakeIQuery(new List <FileIndexItem> {
                new FileIndexItem("/exist-in-db.jpg")
            });
            var deleteItem = new DeleteItem(fakeQuery, new AppSettings(), selectorStorage);
            var result     = deleteItem.Delete("/exist-in-db.jpg", true);

            Assert.AreEqual(FileIndexItem.ExifStatus.NotFoundSourceMissing,
                            result.FirstOrDefault().Status);
        }
Exemplo n.º 25
0
 /// <summary>
 /// Deletes all the items produced by actions in the provided outdated action dictionary.
 /// </summary>
 /// <param name="OutdatedActions">List of outdated actions</param>
 public static void DeleteOutdatedProducedItems(List <Action> OutdatedActions)
 {
     foreach (Action OutdatedAction in OutdatedActions)
     {
         foreach (FileItem DeleteItem in OutdatedAction.DeleteItems)
         {
             if (DeleteItem.Exists)
             {
                 Log.TraceLog("Deleting outdated item: {0}", DeleteItem.AbsolutePath);
                 DeleteItem.Delete();
             }
         }
     }
 }
Exemplo n.º 26
0
        public async Task Execute_CallDelete(UniverseSources source)
        {
            var dataUniverse = new TestDataUniverse(Universe(source));

            var asyncPlanetProperty = new AsyncPlanetProperty(dataUniverse.Planets().First().Properties().First());
            var deleteItem          = new DeleteItem(asyncPlanetProperty);
            var invoked             = false;

            asyncPlanetProperty.Deleted += (sender, args) => invoked = true;

            await deleteItem.ExecuteAsync(null);

            Assert.IsTrue(invoked);
        }
Exemplo n.º 27
0
        public bool Delete([FromBody] DeleteItem item)
        {
            SqlConnection conn = new SqlConnection("Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=Tasks;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False");

            conn.Open();

            string     sqlcmd = "DELETE FROM TaskList WHERE Id=" + item.Id;
            SqlCommand comm   = conn.CreateCommand();

            comm.CommandText = sqlcmd;

            comm.ExecuteReader();
            return(true);
        }
Exemplo n.º 28
0
        public async Task DeleteDataByLinqConditionUsingSubMethodInAnotherClassAsync()
        {
            using (var korm = CreateDatabase(CreateTable_TestTable, InsertDataScript))
            {
                var dbSet = korm.Query <Person>().AsDbSet();
                var item  = new DeleteItem();
                dbSet.Delete(p => p.Id == item.Sub1.Sub2.GetId(0, item.Sub1.Sub2.GetId()));

                await dbSet.CommitChangesAsync();

                korm.Query <Person>()
                .Should()
                .NotContain(p => p.Id == 1);
            }
        }
Exemplo n.º 29
0
        private static async Task DeleteDatabase(NpgsqlConnection conn, DeleteItem delete)
        {
            Log.Information("Deleting database {Database}", delete.Database);

            using (var cmd = conn.CreateCommand())
            {
                Log.Verbose("Revoking access to {Database}", delete.Database);

                cmd.CommandText = $"REVOKE CONNECT ON DATABASE \"{delete.Database}\" FROM public";

                await cmd.ExecuteNonQueryAsync().ConfigureAwait(false);

                Log.Verbose("Disconnecting existing connections to {Database}", delete.Database);

                cmd.CommandText = $"SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '{delete.Database}'";

                using (var reader = await cmd.ExecuteReaderAsync().ConfigureAwait(false))
                {
                    var count = 0;

                    while (await reader.ReadAsync().ConfigureAwait(false))
                    {
                        count++;
                    }

                    Log.Verbose("Disconnected {Count} connection(s)", count);
                }

                Log.Verbose("Dropping database {Database}", delete.Database);

                cmd.CommandText = $"DROP DATABASE \"{delete.Database}\"";

                await cmd.ExecuteNonQueryAsync().ConfigureAwait(false);

                try
                {
                    Log.Verbose("Dropping owner role {Owner}", delete.Owner);

                    cmd.CommandText = $"DROP ROLE \"{delete.Owner}\"";

                    await cmd.ExecuteNonQueryAsync().ConfigureAwait(false);
                }
                catch (Exception ex)
                {
                    Log.Warning("Unable to drop database owner {Owner}, {Message}", delete.Owner, ex.Message);
                }
            }
        }
Exemplo n.º 30
0
        public async Task DeleteDataByLinqConditionUsingNestedPropertyAsync()
        {
            using (var korm = CreateDatabase(CreateTable_TestTable, InsertDataScript))
            {
                var dbSet = korm.Query <Person>().AsDbSet();
                var item  = new DeleteItem();
                item.Sub1.Sub2.Value = 1;
                dbSet.Delete(p => p.Id == item.Sub1.Sub2.Value);

                await dbSet.CommitChangesAsync();

                korm.Query <Person>()
                .Should()
                .NotContain(p => p.Id == 1);
            }
        }