Esempio n. 1
0
 private void _ThreadMethod()
 {
     for (int i = 0; i < _IDs.Count && _IsRunning; i++)
     {
         using (BooruImage image = _UseImages ? _Booru.GetImage(_IDs[i]) : _Booru.GetThumbnail(_IDs[i]))
         {
             try
             {
                 Texture2D texture = CreateTexture(image);
                 lock (_Textures)
                     _Textures.Add(texture);
                 if (NewTextureLoaded != null)
                 {
                     NewTextureLoaded();
                 }
             }
             catch (Exception ex)
             {
                 if (_IsRunning)
                 {
                     ScreensaverHelper.HandleException(ex);
                 }
             }
         }
     }
     if (LoadingFinished != null && _IDs.Count == _Textures.Count)
     {
         LoadingFinished();
     }
 }
Esempio n. 2
0
        public static int Main(string[] args)
        {
            BooruSCR game = null;

            try
            {
                if (Helper.IsWindows() || Helper.IsUnix())
                {
                    Options options = new Options();
                    if (Parser.Default.ParseArguments(args, options))
                    {
                        game = new BooruSCR(options);
                        game.Run();
                        return(0);
                    }
                    else
                    {
                        throw new Exception("Error while parsing arguments");
                    }
                }
                else
                {
                    throw new PlatformNotSupportedException();
                }
            }
            catch (Exception ex)
            {
                ScreensaverHelper.HandleException(ex);
                return(1);
            }
            finally
            {
                if (game != null)
                {
                    game.Dispose();
                }
            }
        }