Example #1
0
        private void ChangeWallPaper(string imageFullFilePath, Wallpaper.Style style)
        {
            //String imageFullFilePath = "C:\\_Dev\\FyghtSoft_InfaBGInfo.bmp";

            if (imageFullFilePath == null)
            {
                return;
            }

            const int SPI_SETDESKWALLPAPER  = 20;
            const int SPIF_UPDATEINIFILE    = 0x01;
            const int SPIF_SENDWININICHANGE = 0x02;

            const int SM_CXSCREEN = 0;
            const int SM_CYSCREEN = 1;

            Bitmap img = new Bitmap(imageFullFilePath);

            Bitmap newImg = new Bitmap(img, GetSystemMetrics(SM_CXSCREEN),
                                       GetSystemMetrics(SM_CYSCREEN));


            newImg.Save(imageFullFilePath, System.Drawing.Imaging.ImageFormat.Bmp);

            SystemParametersInfo(SPI_SETDESKWALLPAPER, 0,
                                 imageFullFilePath,
                                 SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);
        }
Example #2
0
        public static void SetBackground(Uri newimage)
        {
            string s = "Stretched";

            Wallpaper.Style s2 = (Wallpaper.Style)Enum.Parse(typeof(Wallpaper.Style), s, false);
            Wallpaper.Set(newimage, s2);
        }
Example #3
0
        protected override void Apply()
        {
            if (this.item == null)
            {
                return;
            }

            Wallpaper.Style style = (rbtnCentered.Checked) ? Wallpaper.Style.Centered
                : (rBtnStretched.Checked) ? Wallpaper.Style.Stretched : Wallpaper.Style.Tiled;

            /* TODO		if (style == Wallpaper.Style.Stretched &&
             *              SystemInformation.PrimaryMonitorSize.Width/SystemInformation.PrimaryMonitorSize.Height != this.item..Width / this.imageSize.Height &&
             *              MessageBox.Show(this, "Image selected has a different shape than your Desktop, this means image will look deformed. Do you want to set it as wallpaper?\nRecommendation: Use 'Centered' so image is not deformed", Configuration.Instance.GetProperty(Configuration.APPLICATION_NAME, string.Empty).ToString(), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
             *          {
             *              return;
             *          } */

            Cursor cursor = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;
            try
            {
                Wallpaper.Set(new Uri(this.item.Path), style);
            }
            catch (Exception ex)
            {
                Console.Out.WriteLine(ex.Message + "\n" + ex.StackTrace);
            }
            finally
            {
                Cursor.Current = cursor;
            }
            this.Close();
        }
Example #4
0
        private void CheckTime()
        {
            try
            {
                Sun.SunTime     suntime = Sun.GetSunTime(lat, lng);
                DateTime        now     = DateTime.Now;
                string          path    = "";
                Wallpaper.Style style   = Wallpaper.Style.Centered;

                if (now > suntime.sunrise && now < suntime.sunset)
                {
                    path  = day_wallpaper;
                    style = day_style;
                }
                else
                {
                    path  = night_wallpaper;
                    style = night_style;
                }

                if (File.Exists(path))
                {
                    Wallpaper.Set(path, style);
                }
            }
            catch
            {
            }
        }
Example #5
0
 public DateEntry(DateTime xdate, string xfilename, Wallpaper.Style xstyle)
 {
     date      = xdate;
     fileName  = xfilename;
     style     = xstyle;
     errorList = new List <Tuple <DateTime, string> >();
 }
Example #6
0
        public static void Set(string imageFullFilePath, Wallpaper.Style style)
        {
            //System.IO.Stream s = new WebClient().OpenRead(uri.ToString());

            System.Drawing.Image img = Bitmap.FromFile(imageFullFilePath);
            img.Save(imageFullFilePath, System.Drawing.Imaging.ImageFormat.Bmp);

            RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop", true);

            if (style == Wallpaper.Style.Stretched)
            {
                key.SetValue(@"WallpaperStyle", 2.ToString());
                key.SetValue(@"TileWallpaper", 0.ToString());
            }

            if (style == Wallpaper.Style.Centered)
            {
                key.SetValue(@"WallpaperStyle", 1.ToString());
                key.SetValue(@"TileWallpaper", 0.ToString());
            }

            if (style == Wallpaper.Style.Tiled)
            {
                key.SetValue(@"WallpaperStyle", 1.ToString());
                key.SetValue(@"TileWallpaper", 1.ToString());
            }

            SystemParametersInfo(SPI_SETDESKWALLPAPER,
                                 0,
                                 imageFullFilePath,
                                 SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);
        }
Example #7
0
        public static bool Set(Image image, Wallpaper.Style style)
        {
            bool result = false;

            try
            {
                string text = Path.Combine(Path.GetTempPath(), "wallpaper.bmp");
                image.Save(text, ImageFormat.Bmp);
                RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("Control Panel\\Desktop", true);
                switch (style)
                {
                case Wallpaper.Style.Centered:
                    registryKey.SetValue("WallpaperStyle", 1.ToString());
                    registryKey.SetValue("TileWallpaper", 0.ToString());
                    goto IL_BF;

                case Wallpaper.Style.Stretched:
                    registryKey.SetValue("WallpaperStyle", 2.ToString());
                    registryKey.SetValue("TileWallpaper", 0.ToString());
                    goto IL_BF;
                }
                registryKey.SetValue("WallpaperStyle", 1.ToString());
                registryKey.SetValue("TileWallpaper", 1.ToString());
IL_BF:
                Wallpaper.SystemParametersInfo(Wallpaper.SPI_SETDESKWALLPAPER, 0u, text, Wallpaper.SPIF_UPDATEINIFILE | Wallpaper.SPIF_SENDWININICHANGE);
                result = true;
            }
            catch
            {
            }
            return(result);
        }
Example #8
0
        //using Dragonfruit model https://github.com/dotnet/command-line-api/wiki/Your-first-app-with-System.CommandLine.DragonFruit
        /// <summary>
        /// My example app
        /// </summary>
        /// <param name="filename">Give the absolute filepath to an image</param>
        /// <param name="style">Give one of the style of the wallpaper { tile, center, stretch, fill, fit, span }</param>
        static void Main(string filename = @"F:\Abhi\shop\deadly\deadly\Sample.png", string style = "Center")
        {
            string path = filename;

            Wallpaper.Style sty = Wallpaper.Style.Center;

            switch (style)
            {
            case "center": sty = Wallpaper.Style.Center; break;

            case "tile": sty = Wallpaper.Style.Tile; break;

            case "strech": sty = Wallpaper.Style.Stretch; break;

            case "fill": sty = Wallpaper.Style.Fill; break;

            case "fit": sty = Wallpaper.Style.Fit; break;

            case "span": sty = Wallpaper.Style.Span; break;
            }

            if (File.Exists(path))
            {
                SetWallpaper(path, sty);
            }
            else
            {
                Console.WriteLine("File doesn't exist");
            }
        }
Example #9
0
        static void Main(string[] args)
        {
            String config_path;
            int    config_interval;

            Wallpaper.Style mystyle = Wallpaper.Style.Stretched;
            while (true)
            {
                ConfigurationManager.RefreshSection("appSettings");
                config_path = ConfigurationManager.AppSettings["file_path"];
                String[] fileEntries = Directory.GetFiles(@config_path, "*.jpg");

                DateTime      today     = DateTime.Today;
                int           number    = Int32.Parse(today.ToString("yyyyMMdd"));
                List <String> path_list = new List <string>();
                foreach (String path in fileEntries)
                {
                    var regex    = new Regex("[eE]xpire(.+?)_");
                    int pic_date = Int32.Parse(regex.Match(path).Groups[1].Value);
                    if (pic_date >= number)
                    {
                        path_list.Add(path);
                    }
                }
                config_interval = Int32.Parse(ConfigurationManager.AppSettings["interval"]);
                foreach (String mypath in path_list)
                {
                    Wallpaper.Set(mypath, mystyle);
                    Thread.Sleep(config_interval);
                }
            }
        }
 /// <summary>
 /// Creates a new wallpaper object.
 /// </summary>
 /// <param name="path">The absolute path to the image.</param>
 /// <param name="zoomStyle">
 /// Defines how the image is zoomed if it doesn't fit to the screen size.
 /// </param>
 /// <param name="title">The title of the wallpaper.</param>
 /// <exception cref="ImageFormatException">Thrown if the image file is not supported.</exception>
 /// <exception cref="WallpaperFileException">Thrown if path is invalid.</exception>
 public Wallpaper(string path, Wallpaper.Style zoomStyle, string title)
 {
     // Check that path param is valid
     if (String.IsNullOrEmpty(path) && File.Exists(path))
     {
         // Check if image file is supported
         if (isImageSupported(System.IO.Path.GetExtension(path)))
         {
             // Apply path
             this.Path = path;
             // Apply zoom style
             this.ZoomStyle = zoomStyle;
             // Apply title
             this.Title = title;
             // Get image format
             Image img = Image.FromFile(path);
             // Apply image format
             this.Format = img.RawFormat;
         }
         else
         {
             throw new ImageFormatException("The specified image is not supported!");
         }
     }
     else
     {
         throw new WallpaperFileException("Unable to file access specified path!");
     }
 }
Example #11
0
        private void GetMenuChecked()
        {
            if (dayCenteredToolStripMenuItem.Checked)
            {
                day_style = Wallpaper.Style.Centered;
            }
            else if (dayTiledToolStripMenuItem.Checked)
            {
                day_style = Wallpaper.Style.Tiled;
            }
            else
            {
                day_style = Wallpaper.Style.Stretched;
            }

            if (nightCenteredToolStripMenuItem.Checked)
            {
                night_style = Wallpaper.Style.Centered;
            }
            else if (nightTiledToolStripMenuItem.Checked)
            {
                night_style = Wallpaper.Style.Tiled;
            }
            else
            {
                night_style = Wallpaper.Style.Stretched;
            }
        }
Example #12
0
        private void rad_CheckedChanged(object sender, EventArgs e)
        {
            RadioButton rad = (RadioButton)sender;

            if (rad.Checked)
            {
                switch (rad.Name)
                {
                case "radTile":
                    m_wallpaperStyle = Wallpaper.Style.Tile;
                    break;

                case "radCenter":
                    m_wallpaperStyle = Wallpaper.Style.Center;
                    break;

                case "radStretch":
                    m_wallpaperStyle = Wallpaper.Style.Stretch;
                    break;

                case "radFit":
                    m_wallpaperStyle = Wallpaper.Style.Fit;
                    break;

                case "radFill":
                    m_wallpaperStyle = Wallpaper.Style.Fill;
                    break;
                }
            }
        }
Example #13
0
 internal WallpaperReceivedArgs(byte[] pImage, Wallpaper.Style pStyle)
 {
     using (MemoryStream mStream = new MemoryStream(pImage))
     {
         m_image = Image.FromStream(mStream);
     }
     m_style = pStyle;
 }
Example #14
0
        public SetWallpaperCommand(byte[] pData)
            : base(CommandType.SetWallpaper)
        {
            m_style = (Wallpaper.Style)pData[1];

            byte[] imageArr = new byte[pData.Length - 2];
            Buffer.BlockCopy(pData, 2, imageArr, 0, pData.Length - 2);
            m_image = (Bitmap)((new ImageConverter()).ConvertFrom(imageArr));
        }
Example #15
0
 public Form1()
 {
     InitializeComponent();
     UpdateUIState();
     Statut            = "Not connected";
     m_wallpaperStyle  = Wallpaper.Style.Center;
     radCenter.Checked = true;
     logViewer.Document.Body.DragOver += Body_DragOver;
 }
Example #16
0
        public void SendImage(Image image, Wallpaper.Style style)
        {
            ImageConverter imgCon = new ImageConverter();

            byte[] imageArr = (byte[])imgCon.ConvertTo(image, typeof(byte[]));
            byte[] data     = new byte[imageArr.Length + 1];
            data[0] = (byte)style;
            Array.Copy(imageArr, 0, data, 1, imageArr.Length);

            m_client.Send(Command.PrefixCommand(CommandType.Wallpaper, data));
        }
Example #17
0
 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}");
     }
 }
Example #18
0
        public static bool Set(string filePath, Wallpaper.Style style)
        {
            bool result = false;

            try
            {
                Wallpaper.Set(Image.FromFile(Path.GetFullPath(filePath)), style);
                result = true;
            }
            catch
            {
            }
            return(result);
        }
        public void SetStyle(string style)
        {
            switch (style)
            {
                case "Stretched":
                    styleSelected = Wallpaper.Style.Stretched;
                    break;
                case "Tiled":
                    styleSelected = Wallpaper.Style.Tiled;
                    break;
                default:
                    styleSelected = Wallpaper.Style.Centered;
                    break;

            }
        }
Example #20
0
 private Settings GetCurrentSettings()
 {
     Wallpaper.Style style = Wallpaper.Style.Stretched;
     if (centeredRB.Checked)
     {
         style = Wallpaper.Style.Centered;
     }
     else if (tiledRB.Checked)
     {
         style = Wallpaper.Style.Tiled;
     }
     else if (stretchedRB.Checked)
     {
         style = Wallpaper.Style.Stretched;
     }
     return(new Settings(textBox1.Text, style));
 }
Example #21
0
        private void GetSettings()
        {
            day_wallpaper   = (settings.GetValue("Day Wallpaper") ?? "").ToString();
            night_wallpaper = (settings.GetValue("Night Wallpaper") ?? "").ToString();
            dayImageToolStripMenuItem.Text   = day_wallpaper.Split('\\').Last();
            nightImageToolStripMenuItem.Text = night_wallpaper.Split('\\').Last();
            switch ((settings.GetValue("Day Wallpaper Style") ?? "").ToString())
            {
            case "Centered":
                day_style = Wallpaper.Style.Centered;
                break;

            case "Tiled":
                day_style = Wallpaper.Style.Tiled;
                break;

            case "Stretched":
                day_style = Wallpaper.Style.Stretched;
                break;

            default:
                day_style = Wallpaper.Style.Centered;
                break;
            }
            switch ((settings.GetValue("Night Wallpaper Style") ?? "").ToString())
            {
            case "Centered":
                night_style = Wallpaper.Style.Centered;
                break;

            case "Tiled":
                night_style = Wallpaper.Style.Tiled;
                break;

            case "Stretched":
                night_style = Wallpaper.Style.Stretched;
                break;

            default:
                night_style = Wallpaper.Style.Centered;
                break;
            }
            lat = Convert.ToDouble(settings.GetValue("Latitude") ?? 37.532600);
            lng = Convert.ToDouble(settings.GetValue("Longitude") ?? 127.024612);
        }
        public static void SetWallpaper(string path, Wallpaper.Style style)
        {
            SystemParametersInfo(SetDesktopWallpaper, 0, path, UpdateIniFile | SendWinIniChange);
            RegistryKey key = Registry.CurrentUser.OpenSubKey("Control Panel\\Desktop", true);

            switch (style)
            {
            case Style.Stretch:
                key.SetValue(@"WallpaperStyle", "2");
                key.SetValue(@"TileWallpaper", "0");
                break;

            case Style.Center:
                key.SetValue(@"WallpaperStyle", "1");
                key.SetValue(@"TileWallpaper", "0");
                break;
            }
            key.Close();
        }
Example #23
0
        /// <summary>
        /// Sets the windows wallpaper.
        /// </summary>
        /// <param name="path">The path to the image file.</param>
        /// <param name="style">The syle how the wallpaper should be displayed if it doesn't fit the screen.</param>
        /// <exception cref="System.IO.FileNotFoundException">Thrown if the specified file is not existing.</exception>
        /// <exception cref="System.ArgumentNullException">Thrown if the param 'path' is null or an empty string.</exception>
        public static void SetWallpaper(string imageFullFilePath, Wallpaper.Style style)
        {
            // Make sure the path is set
            if (imageFullFilePath == null || imageFullFilePath.Length == 0)
            {
                throw new ArgumentNullException("path", "The path to the wallpaper is not set!");
            }

            // Check if the specified file exists
            if (File.Exists(imageFullFilePath))
            {
                RegistryKey key = Registry.CurrentUser.OpenSubKey("Control Panel\\Desktop", true);

                // Determin the zoom style of the wallpaper and save it to registry
                switch (style)
                {
                case Wallpaper.Style.Stretched:
                    key.SetValue(@"WallpaperStyle", "2");
                    key.SetValue(@"TileWallpaper", "0");
                    break;

                case Wallpaper.Style.Centered:
                    key.SetValue(@"WallpaperStyle", "1");
                    key.SetValue(@"TileWallpaper", "0");
                    break;

                case Wallpaper.Style.Tiled:
                    key.SetValue(@"WallpaperStyle", "1");
                    key.SetValue(@"TileWallpaper", "1");
                    break;
                }
                // Change wallpaper with SystemParametersInfo from Win API
                SafeNativeMethods.SystemParametersInfo(SPI_SETDESKWALLPAPER
                                                       , 0, imageFullFilePath, SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);
            }
            else
            {
                throw new FileNotFoundException();
            }
        }
Example #24
0
        void btnDesktop_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string       strTempPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "tempImage.jpg");
                MemoryStream mms         = new MemoryStream(lstImage[curImg]);

                Bitmap img = (Bitmap)System.Drawing.Image.FromStream(mms);
                img.Save(strTempPath, System.Drawing.Imaging.ImageFormat.Jpeg);

                mms.Close();
                img.Dispose();

                string          s  = "Stretched";
                Wallpaper.Style s2 = (Wallpaper.Style)Enum.Parse(typeof(Wallpaper.Style), s, false);
                Wallpaper.Set(new Uri(strTempPath), s2);

                MessageBox.Show("Image Has Been Set As Your Desktop", "VMukti Says:- ImageSharing");
            }
            catch (Exception ex)
            {
                VMuktiHelper.ExceptionHandler(ex, "btnDesktop_Click", "ctlImageSharing.xaml.cs");
            }
        }
Example #25
0
 public void SetWallpaper(string file, Wallpaper.Style style)
 {
     Wallpaper.Set(new Uri(file), style);
 }
Example #26
0
 internal WallpaperReceivedArgs(Image pImage, Wallpaper.Style pStyle)
 {
     m_image = pImage;
     m_style = pStyle;
 }
Example #27
0
 public SetWallpaperCommand(Image pImage, Wallpaper.Style pStyle)
     : base(CommandType.SetWallpaper)
 {
     m_image = pImage;
     m_style = pStyle;
 }
Example #28
0
 // Pass in a relative path to a file inside the local appdata folder
 static void SetWallpaper(string filePath, Wallpaper.Style style)
 {
     Wallpaper.SetStyle(style);
     Wallpaper.SetImage(filePath);
 }
        static void Main(string[] args)
        {
            Refrence Ref = new Refrence();
            Wallpaper WP = new Wallpaper();
            //Check for Help Conditions or argument overload.  If any of these conditions evaluation to yes and proceed with their execution, the end result will be the programming closing.
            if (args.Length ==0)
            {
                Ref.Help();
                //The following exit command is only used as a fallback in case the help menu returns without exiting.  This should never happen.
                Environment.Exit(0);
            }
            else if (args.Length == 1)
            {
                foreach (string arg in args)
                {
                    switch (arg.ToUpper())
                    {
                        case "/H":
                        case "-H":
                        case "/?":
                        case "-?":
                        case "/HELP":
                        case "-HELP":
                            Ref.Help();
                            //The following exit command is only used as a fallback in case the help menu returns without exiting.  This should never happen.
                            Environment.Exit(0);
                            break;
                    }
                }
            }
            else if (args.Length > 1)
            {
                if (args.Length > 2)
                {
                    Console.WriteLine("");
                    Console.WriteLine(@"Too many arguments passsed, or arguments not passed in the proper format.  Please check the help options (-h, -help, -?) for more information.");
                    Console.WriteLine("");
                    Environment.Exit(1);
                }
                else
                {
                    foreach (string arg in args)
                    {
                        switch (arg.ToUpper())
                        {
                            case "/H":
                            case "-H":
                            case "/?":
                            case "-?":
                            case "/HELP":
                            case "-HELP":
                                Console.WriteLine("");
                                Console.WriteLine("Please do not pass help switches with other switches.");
                                Console.WriteLine("");
                                Environment.Exit(1);
                                break;
                        }
                    }
                }
            }

            //If the previous checks pass, begin the primary work of the program.
            //This first "if" block sets the variables from the switches supplied in the command line.  If an incorrect switch is detected in this section, the program will detect this and exit.
            if (args.Length >= 1 && args.Length <= 2)
            {
                Wallpaper.Style style = new Wallpaper.Style();
                style = Wallpaper.Style.Fill;
                string FilePath = "";
                foreach (string arg in args)
                {
                    string s = arg.Substring(3).ToLower();
                    switch(arg.Substring(0,3).ToUpper())
                    {
                        case "/S:":case "-S:":
                            if(s == "tiled")
                            {
                                style = Wallpaper.Style.Tiled;
                            }
                            else if (s == "tile")
                            {
                                style = Wallpaper.Style.Tiled;
                            }
                            else if(s == "centered")
                            {
                                style = Wallpaper.Style.Centered;
                            }
                            else if (s == "center")
                            {
                                style = Wallpaper.Style.Centered;
                            }
                            else if(s == "stretched")
                            {
                                style = Wallpaper.Style.Stretched;
                            }
                            else if (s == "stretch")
                            {
                                style = Wallpaper.Style.Stretched;
                            }
                            else if(s == "fit")
                            {
                                style = Wallpaper.Style.Fit;
                            }
                        else if(s == "fill")
                            {
                                style = Wallpaper.Style.Fill;
                            }
                        else if(s == "span")
                            {
                                if(Version.Parse(Environment.OSVersion.Version.ToString()) >= Version.Parse("6.2.9200.0"))
                                {
                                    style = Wallpaper.Style.Span;
                                }
                                else
                                {
                                    Console.WriteLine("");
                                    Console.WriteLine("Span style is not supported on Windows 7.  Defaulting to Fill style.");
                                    Console.WriteLine("");
                                    style = Wallpaper.Style.Fill;
                                }
                            }
                        else
                            {
                                style = Wallpaper.Style.Fill;
                                Console.WriteLine("");
                                Console.WriteLine("An incorrect value for style was supplied.  The default of Fill will be used.");
                                Console.WriteLine("");
                            }
                            break;
                        case "/P:":case "-P:":
                            FilePath = arg.Substring(3);
                            break;
                        default:
                            Console.WriteLine("");
                            Console.WriteLine("An incorect switch was detected.  Please make sure you are passing the proper switches in the proper format.");
                            Console.WriteLine("You may run this program with no switches/parameters to see help options, or use /h , -help , or /? to show help text.");
                            Console.WriteLine("");
                            Environment.Exit(1);
                        break;
                    }
                }

                //If all switches are set properly, begin this section, which sets the wallpaper and style.
                if (!string.IsNullOrEmpty(FilePath))
                {
                    Console.WriteLine("");
                    Console.WriteLine("Changing wallpaper to " + FilePath);
                    Console.WriteLine("Selected style is " + "\"" +style.ToString() + "\"");
                    Console.WriteLine("");
                    WP.Set(FilePath, style);
                    Console.WriteLine("No execution errors detected. Please check your desktop to verify results.");
                    Console.WriteLine("");
                    Environment.Exit(0);
                }
                else
                {
                    char[] c = { '\'' };
                    string DefaultWallpaper = "";
                    if (File.Exists(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location.ToString()).TrimEnd(c) + @"\wallpaper.bmp"))
                    {
                        DefaultWallpaper = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location.ToString()).TrimEnd(c) + @"\wallpaper.bmp";
                        Console.WriteLine("");
                        Console.WriteLine("Changing wallpaper to " + DefaultWallpaper);
                        Console.WriteLine("Selected style is " + "\"" + style.ToString() + "\"");
                        Console.WriteLine("");
                        WP.Set(DefaultWallpaper, style);
                        Console.WriteLine("No execution errors detected. Please check your desktop to verify results.");
                        Console.WriteLine("");
                        Environment.Exit(0);
                    }
                    else if(File.Exists(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location.ToString()).TrimEnd(c) + @"\wallpaper.jpg"))
                    {
                        DefaultWallpaper = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location.ToString()).TrimEnd(c) + @"\wallpaper.jpg";
                        Console.WriteLine("");
                        Console.WriteLine("Changing wallpaper to " + DefaultWallpaper);
                        Console.WriteLine("Selected style is " + "\"" + style.ToString() + "\"");
                        Console.WriteLine("");
                        WP.Set(DefaultWallpaper, style);
                        Console.WriteLine("No execution errors detected. Please check your desktop to verify results.");
                        Console.WriteLine("");
                        Environment.Exit(0);
                    }
                    else
                    {
                        Console.WriteLine("");
                        Console.WriteLine("No wallpaper path was specified and wallpaper.bmp/jpg could not be found in the same directory. Failed to change wallpaper.");
                        Console.WriteLine("");
                        Environment.Exit(1);
                    }
                }
            }
        }
Example #30
0
 public Settings()
 {
     file  = "";
     style = Wallpaper.Style.Stretched;
 }
Example #31
0
 public Settings(string file, Wallpaper.Style style)
 {
     this.file  = file;
     this.style = style;
 }