Esempio n. 1
0
        static Int32 Main(string[] args)
        {
            if (args.Length < 1)
            {
                Console.WriteLine("Please supply a file or folder to upload.");
                return(1);
            }
            var            fullPath = args[0];
            FileSystemInfo toUpload;

            FileAttributes attributes = File.GetAttributes(fullPath);

            if (attributes.HasFlag(FileAttributes.Directory))
            {
                toUpload = new DirectoryInfo(fullPath);
            }
            else
            {
                toUpload = new FileInfo(fullPath);
            }

            if (!toUpload.Exists)
            {
                Console.WriteLine("The supplied file or folder does not exist.");
                return(2);
            }
            Settings config = Settings.LoadSettings();

            UsenetPoster poster = new UsenetPoster(config, config.GetWatchFolderSettings("Default"));

            poster.newUploadSpeedReport += poster_newUploadSpeedReport;
            poster.PostToUsenet(toUpload, null);

            return(0);
        }
Esempio n. 2
0
        static Int32 Main(string[] args)
        {
            if (args.Length < 1)
            {
                Console.WriteLine("Please supply a filename to upload.");
                return 1;
            }
            FileInfo file = new FileInfo(args[0]);
            if (!file.Exists)
            {
                Console.WriteLine("The supplied file does not exist.");
                return 2;
            }
            UsenetPosterConfig config = new UsenetPosterConfig();
            UsenetPoster poster = new UsenetPoster(config);
            poster.newUploadSpeedReport += poster_newUploadSpeedReport;
            poster.PostToUsenet(file);

            #if DEBUG       //VS does not halt after execution in debug mode.
            Console.WriteLine("Finished");
            Console.ReadKey();
            #endif

            return 0;
        }
Esempio n. 3
0
 public AutoPoster(AutoPosterConfig configuration)
 {
     this.configuration = configuration;
     posterConfiguration = new UsenetPosterConfig();
     poster = new UsenetPoster(posterConfiguration);
     StopRequested = false;
     MyTask = new Task(AutopostingTask, TaskCreationOptions.LongRunning);
 }
Esempio n. 4
0
        static Int32 Main(string[] args)
        {
            if (args.Length < 1)
            {
                Console.WriteLine("Please supply a file or folder to upload.");
                return 1;
            }

            var fullPath = args[0];
            if (!Directory.Exists(fullPath))
            {
                Console.WriteLine("The supplied file or folder does not exist.");
                return 2;
            }

            FileSystemInfo toUpload;

            FileAttributes attributes = File.GetAttributes(fullPath);
            if (attributes.HasFlag(FileAttributes.Directory))
            {
                toUpload = new DirectoryInfo(fullPath);
            }
            else
            {
                toUpload = new FileInfo(fullPath);
            }

            if (!toUpload.Exists)
            {
                Console.WriteLine("The supplied file or folder does not exist.");
                return 2;
            }
            Settings config = Settings.LoadSettings();

            UsenetPoster poster = new UsenetPoster(config, config.GetWatchFolderSettings("Default"));
            poster.newUploadSpeedReport += poster_newUploadSpeedReport;
            poster.PostToUsenet(toUpload, null);

            return 0;
        }