public Task MoveToAsync(IDirectoryInfo destFolder, string destFileName, bool overwrite = true) { var nativeFolder = (destFolder as NativeItemWrapper <System.IO.DirectoryInfo>).NativeItem; var newPath = Path.Combine(destFolder.FullName, destFileName); return(Task.Run(() => NativeItem.MoveTo(newPath))); }
public new void Add(int position, NativeItem nativeItem) { nativeItem.Activated += NativeItem_Activated; nativeItem.Selected += NativeItem_Selected; base.Add(position, nativeItem); }
public new void Add(NativeItem nativeItem) { nativeItem.Activated += NativeItem_Activated; nativeItem.Selected += NativeItem_Selected; base.Add(nativeItem); }
public async Task <IFileInfo> CopyToAsync(IDirectoryInfo destFolder, string destFileName, bool overwrite = true) { var nativeFolder = (destFolder as NativeItemWrapper <StorageFolder>).NativeItem; var newFile = await NativeItem.CopyAsync(nativeFolder, destFileName, overwrite?NameCollisionOption.ReplaceExisting : NameCollisionOption.FailIfExists); return(new FileInfo(newFile)); }
public async Task <IFileInfo> CopyToAsync(IDirectoryInfo destFolder, string destFileName, bool overwrite = true) { var nativeFolder = (destFolder as NativeItemWrapper <System.IO.DirectoryInfo>).NativeItem; var newPath = Path.Combine(destFolder.FullName, destFileName); var newFile = await Task.Run(() => NativeItem.CopyTo(newPath, overwrite)); return(new FileInfo(newFile)); }
public async Task <IEnumerable <IDirectoryInfo> > EnumerateDirectoriesAsync() { var folders = await Task.Run(() => NativeItem.GetDirectories()); var output = folders.Select(d => new DirectoryInfo(d)); return(output); }
public async Task <IEnumerable <IFileInfo> > EnumerateFilesAsync() { var files = await Task.Run(() => NativeItem.GetFiles()); var output = files.Select(d => new FileInfo(d)); return(output); }
internal static NativeItem GenerateWeaponSellerItem(string displayName, string description, int price) { Game.LogTrivial("Creating weapon sell item for: " + displayName + " at price " + price); var result = new NativeItem(displayName, description); result.AltTitle = "$" + price; Game.LogTrivial("Created weapon sell item for: " + displayName); return(result); }
internal static NativeItem GenerateWeaponSellerItem(string displayName, string description, int price) { logger.Trace("Creating weapon sell item for: " + displayName + " at price " + price); NativeItem result = new NativeItem(displayName, description); result.AltTitle = "$" + price; logger.Trace("Created weapon sell item for: " + displayName); return(result); }
private void MainMenu_OnItemActivated(NativeItem sender, EventArgs e) { if (sender == spawnHerbie) { HerbieHandler.CreateHerbie(Utils.PlayerPed.Position, Utils.PlayerPed.Heading, true); } Close(); }
/// <summary> /// Adds a new <see cref="NativeItem"/> at <paramref name="pos"/> using text localization system. /// </summary> /// <param name="pos">Position of the new item.</param> /// <param name="itemName">Item name.</param> /// <returns>New instance of <see cref="NativeItem"/>.</returns> public NativeItem NewItem(int pos, string itemName) { NativeItem item; Add(pos, item = new NativeItem(GetItemTitle(itemName), GetItemDescription(itemName))); item.Tag = itemName; return(item); }
internal static NativeItem CreateFoodSellerItem(string context, Foods food, int price) { NativeItem result = new NativeItem(context); result.AltTitle = "$" + price.ToString(); result.Activated += (s, i) => { SellFood(food, price); }; return(result); }
public async Task <IDirectoryInfo> GetDirectoryAsync(string name) { try { var folder = await NativeItem.GetFolderAsync(name); return(new DirectoryInfo(folder)); } catch (FileNotFoundException) { return(null); } }
public async Task <IFileInfo> GetFileAsync(string name) { try { var file = await NativeItem.GetFileAsync(name); return(new FileInfo(file)); } catch (FileNotFoundException) { return(null); } }
internal static NativeItem GenerateWaterSellItem(string context, int price) { NativeItem result = new NativeItem(context); result.AltTitle = "$" + price.ToString(); result.Activated += (s, i) => { if (!Common.Cost(price)) { return; } Companion.Inventories.Current.Add(new WaterItem()); }; return(result); }
internal static void Loop() { LoadShopManager(); LoadShops(); shopMenu = new NativeMenu("Food Store", "FOOD STORES"); MenuManager.Pool.Add(shopMenu); while (Common.InstanceRunning) { GameFiber.Yield(); foreach (var shop in shops) { if (Game.LocalPlayer.Character.DistanceTo(shop.Position.GeneratedVector3) < 3.5f) { if (!alreadySetCurrentItems) { currentItems = shop.Items; shopMenu.Clear(); foreach (var item in currentItems) { var shopItem = new NativeItem(item.Name, "Buys the food."); shopItem.Activated += (sender, selectedItem) => { if (Functions.CostMoney(item.Price)) { Functions.IncreaseHungry(item.Amount); } }; shopMenu.Add(shopItem); } alreadySetCurrentItems = true; } Game.DisplayHelp("Press ~INPUT_CONTEXT~ to open the shop menu."); if (Game.IsControlPressed(0, GameControl.Context)) { shopMenu.Visible = !shopMenu.Visible; } break; } else { alreadySetCurrentItems = false; } } } }
internal static void CreateVehicleManagementMenu() { vehicleCheckItem = new NativeItem("Request Status Check", "Requests the dispatch to check the status of the nearest vehicle."); ManagementMenu.Add(vehicleCheckItem); vehicleCheckItem.Activated += VehicleCheckItem_Activated; callForTowTruckItem = new NativeItem("Request Tow Service", "Requests a tow truck from dispatch."); ManagementMenu.Add(callForTowTruckItem); callForTowTruckItem.Activated += CallForTowTruckItem_Activated; callForInsuranceItem = new NativeItem("Request Insurance Pick-up", "Requests insurance service to pick up the nearest vehicle."); ManagementMenu.Add(callForInsuranceItem); callForInsuranceItem.Activated += CallForInsuranceItem_Activated; ManagementMenu.UseMouse = false; ManagementMenu.RotateCamera = true; }
public static void CreatePedManagementMenu() { itemCheckId = new NativeItem("Request Status Check", "Requests status check of the nearest ped from dispatch."); itemFollow = new NativeItem("Ask to Follow", "Asks the nearest ped to follow the player."); itemGrab = new NativeItem("Grab Nearest Ped", "Grabs the nearest ped."); itemCallTaxi = new NativeItem("Request Taxi Escort", "Requests a taxi to pick up the target."); itemRequestCoroner = new NativeItem("Request Coroner Unit", "Calls a coroner to deal with all nearby dead people."); ManagementMenu.Add(itemCheckId); ManagementMenu.Add(itemCallTaxi); ManagementMenu.Add(itemRequestCoroner); ManagementMenu.Add(itemGrab); ManagementMenu.Add(itemFollow); itemCheckId.Activated += ItemCheckId_Activated; itemCallTaxi.Activated += ItemCallTaxi_Activated; itemRequestCoroner.Activated += ItemRequestCoroner_Activated; itemGrab.Activated += ItemGrab_Activated; itemFollow.Activated += ItemFollow_Activated; }
/// <summary> /// Removes <paramref name="nativeItem"/> from this menu. /// </summary> /// <param name="nativeItem"><see cref="NativeItem"/> to be removed.</param> public new void Remove(NativeItem nativeItem) { nativeItem.Activated -= NativeItem_Activated; nativeItem.Selected -= NativeItem_Selected; try { ((NativeSliderItem)nativeItem).ValueChanged -= NativeSliderItem_ValueChanged; } catch { } try { ((NativeCheckboxItem)nativeItem).CheckboxChanged -= NativeCheckboxItem_CheckboxChanged; } catch { } base.Remove(nativeItem); }
public Task DeleteAsync() { return(Task.Run(() => NativeItem.Delete(true))); }
public async Task <DateTimeOffset> GetLastModifiedAsync() { var properties = await NativeItem.GetBasicPropertiesAsync(); return(properties.DateModified); }
/// <summary> /// Initialize all of the menus /// </summary> public static void Init() { WeaponsMenu.AddSubMenu(PrimaryWep); WeaponsMenu.AddSubMenu(SideWep); WeaponsMenu.AddSubMenu(HeavyWep); CivilianMenu.AddSubMenu(CivAir); CivilianMenu.AddSubMenu(CivLand); CivilianMenu.AddSubMenu(CivSea); MilitaryMenu.AddSubMenu(MilAir); MilitaryMenu.AddSubMenu(MilLand); MilitaryMenu.AddSubMenu(MilSea); VehicleMenu.AddSubMenu(CivilianMenu); VehicleMenu.AddSubMenu(MilitaryMenu); MainMenu.AddSubMenu(VehicleMenu); MainMenu.AddSubMenu(WeaponsMenu); MainPool.Add(PrimaryWep); MainPool.Add(SideWep); MainPool.Add(HeavyWep); MainPool.Add(CivAir); MainPool.Add(CivLand); MainPool.Add(CivSea); MainPool.Add(MilAir); MainPool.Add(MilLand); MainPool.Add(MilSea); MainPool.Add(CivilianMenu); MainPool.Add(MilitaryMenu); MainPool.Add(VehicleMenu); MainPool.Add(WeaponsMenu); MainPool.Add(MainMenu); // Heavy weapons foreach (JustCauseRebelDrops.Classes.Weapon wep in Main.WepConfig.HeavyWeapons) { var WeaponItem = new NativeItem(wep.DisplayName); WeaponItem.Activated += (sender, e) => DropWeapon(wep.Hash); HeavyWep.Add(WeaponItem); } // Primary weapons foreach (JustCauseRebelDrops.Classes.Weapon wep in Main.WepConfig.PrimaryWeapons) { var WeaponItem = new NativeItem(wep.DisplayName); WeaponItem.Activated += (sender, e) => DropWeapon(wep.Hash); PrimaryWep.Add(WeaponItem); } // Side weapons foreach (JustCauseRebelDrops.Classes.Weapon wep in Main.WepConfig.SideWeapons) { var WeaponItem = new NativeItem(wep.DisplayName); WeaponItem.Activated += (sender, e) => DropWeapon(wep.Hash); SideWep.Add(WeaponItem); } // Custom weapons foreach (CustomWeaponConfig CustomWepConfig in Main.CustomWeaponConfigs) { NativeMenu CustomMenu = new NativeMenu(CustomWepConfig.CategoryName, CustomWepConfig.CategoryName); WeaponsMenu.AddSubMenu(CustomMenu); foreach (Classes.Weapon wep in CustomWepConfig.Weapons) { var WeaponItem = new NativeItem(wep.DisplayName); WeaponItem.Activated += (sender, e) => DropWeapon(wep.Hash); CustomMenu.Add(WeaponItem); } MainPool.Add(CustomMenu); } // Civilian vehicles foreach (DropVehicle veh in Main.VehConfig.CivilianVehicles) { switch (veh.Type) { case VehicleType.Heli: case VehicleType.Plane: var VehicleItem = new NativeItem(veh.DisplayName); VehicleItem.Activated += (sender, e) => DropVehicle(veh.ModelName); CivAir.Add(VehicleItem); break; case VehicleType.Land: var LandVehicleItem = new NativeItem(veh.DisplayName); LandVehicleItem.Activated += (sender, e) => DropVehicle(veh.ModelName); CivLand.Add(LandVehicleItem); break; case VehicleType.Sea: var SeaVehicleItem = new NativeItem(veh.DisplayName); SeaVehicleItem.Activated += (sender, e) => DropVehicle(veh.ModelName); CivSea.Add(SeaVehicleItem); break; } } // Military vehicles foreach (DropVehicle veh in Main.VehConfig.MilitaryVehicles) { switch (veh.Type) { case VehicleType.Heli: case VehicleType.Plane: var VehicleItem = new NativeItem(veh.DisplayName); VehicleItem.Activated += (sender, e) => DropVehicle(veh.ModelName); MilAir.Add(VehicleItem); break; case VehicleType.Land: var LandVehicleItem = new NativeItem(veh.DisplayName); LandVehicleItem.Activated += (sender, e) => DropVehicle(veh.ModelName); MilLand.Add(LandVehicleItem); break; case VehicleType.Sea: var SeaVehicleItem = new NativeItem(veh.DisplayName); SeaVehicleItem.Activated += (sender, e) => DropVehicle(veh.ModelName); MilSea.Add(SeaVehicleItem); break; } } // Custom vehicles foreach (CustomVehicleConfig CustomVehConfig in Main.CustomVehicleConfigs) { NativeMenu CustomMenu = new NativeMenu(CustomVehConfig.CategoryName, CustomVehConfig.CategoryName); VehicleMenu.AddSubMenu(CustomMenu); foreach (DropVehicle veh in CustomVehConfig.Vehicles) { switch (veh.Type) { case VehicleType.Heli: case VehicleType.Plane: var VehicleItem = new NativeItem(veh.DisplayName); VehicleItem.Activated += (sender, e) => DropVehicle(veh.ModelName); CustomMenu.Add(VehicleItem); break; case VehicleType.Land: var LandVehicleItem = new NativeItem(veh.DisplayName); LandVehicleItem.Activated += (sender, e) => DropVehicle(veh.ModelName); CustomMenu.Add(LandVehicleItem); break; case VehicleType.Sea: var SeaVehicleItem = new NativeItem(veh.DisplayName); SeaVehicleItem.Activated += (sender, e) => DropVehicle(veh.ModelName); CustomMenu.Add(SeaVehicleItem); break; } CustomVehicles.Add(veh); } MainPool.Add(CustomMenu); } }
public async Task <IEnumerable <IFileInfo> > EnumerateFilesAsync() { var files = await NativeItem.GetFilesAsync(CommonFileQuery.DefaultQuery); return(files.Select(d => new FileInfo(d)).ToArray()); }
public Task DeleteAsync() { return(NativeItem.DeleteAsync().AsTask()); }
public async Task <IEnumerable <IDirectoryInfo> > EnumerateDirectoriesAsync() { var folders = await NativeItem.GetFoldersAsync(CommonFolderQuery.DefaultQuery); return(folders.Select(d => new DirectoryInfo(d)).ToArray()); }
public async Task <IFileInfo> CreateFileAsync(string name) { var newFile = await NativeItem.CreateFileAsync(name); return(new FileInfo(newFile)); }
public async Task <IDirectoryInfo> CreateDirectoryAsync(string name) { var newFolder = await NativeItem.CreateFolderAsync(name); return(new DirectoryInfo(newFolder)); }
public Task RenameAsync(string name) { return(NativeItem.RenameAsync(name).AsTask()); }
public async Task <IDirectoryInfo> GetParentAsync() { var parent = await NativeItem.GetParentAsync(); return(new DirectoryInfo(parent)); }
public MainMenu() : base("HerbieV") { Add(spawnHerbie = new NativeItem("Spawn Herbie")); OnItemActivated += MainMenu_OnItemActivated; }