コード例 #1
0
        static void Main(string[] args)
        {
            try
            {
                using (var uploader = new ContentUploadService())
                {
                    var directory = @"c:\temp\contentgate-uploads";
                    var watch     = new ContentWatcher(directory);

                    uploader.StartUpload(watch);

                    Console.WriteLine("Press enter to stop watching ...");
                    Console.ReadLine();

                    uploader.StopUpload();
                }
            }
            catch (AggregateException ag)
            {
                if (ag.InnerExceptions.Count == 1)
                {
                    throw ag.InnerException;
                }
                else
                {
                    throw ag.Flatten();
                }
            }
            catch (Exception)
            {
                throw;
            }

            Console.ReadLine();
        }
コード例 #2
0
 public void StartUpload(ContentWatcher watch)
 {
     this._watcher            = watch;
     this._watcher.FileFound += this._watchHandler;
     this._watcher.StartWatch();
 }