private void InitializeManagers()
        {
            FilepathManagerInstance = new FilepathManager(GetFileManagerPath());

            DatabaseManagerInstance = new SQLiteDatabaseManager(FilepathManagerInstance);

            InMemoryManagerInstance = new InMemoryManager(DatabaseManagerInstance);

            ApiManagerInstance = new ApiManager
                                     (Properties.Settings.Default.ConsumerKey, Properties.Settings.Default.ConsumerSecret,
                                     Properties.Settings.Default.AccessKey, Properties.Settings.Default.AccessSecret,
                                     Properties.Settings.Default.RequestKey, Properties.Settings.Default.RequestSecret);

            ServerQueriesManagerInstance = new ServerQueriesManager(ApiManagerInstance, InMemoryManagerInstance);

            ImageCacheInstance = new ImageCache(
                Properties.Settings.Default.ImageCacheSizeInMB,
                new TimeSpan(0, 0, Properties.Settings.Default.ImageCacheSlidingExpirationInSeconds));

            ImageRetrieverInstance = new ImageRetriever(FilepathManagerInstance, ImageCacheInstance);

            ImageDownloaderInstance = new ImageDownloader(FilepathManagerInstance, InMemoryManagerInstance);

            GlobalManagerInstance = new GlobalManager
                                        (ApiManagerInstance, DatabaseManagerInstance, ImageDownloaderInstance, InMemoryManagerInstance, ServerQueriesManagerInstance);

            PortraitConverter portraitConv = (PortraitConverter)Application.Current.FindResource("PortraitConv");

            portraitConv.ImageRetriever = ImageRetrieverInstance;
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            // Get my dirty XML config
            string cameraAddress  = ConfigurationManager.AppSettings["CameraAddress"];
            string cameraUsername = ConfigurationManager.AppSettings["CameraUsername"];
            string cameraPassword = ConfigurationManager.AppSettings["CameraPassword"];
            string snapshotFolder = ConfigurationManager.AppSettings["SnapshotFolder"];
            // FTP Option
            string ftpAddress  = ConfigurationManager.AppSettings["FTPAddress"];
            string ftpUsername = ConfigurationManager.AppSettings["FTPUsername"];
            string ftpPassword = ConfigurationManager.AppSettings["FTPPassword"];

            // Setup
            camera = new Camera(new Uri(cameraAddress));
            if (!string.IsNullOrEmpty(cameraPassword))
            {
                camera.Credentials = new NetworkCredential(cameraUsername, cameraPassword);
            }

            saver = new FileImageSaver(snapshotFolder);
            //saver = new FTPImageSaver(new Uri(ftpAddress), ftpUsername, ftpPassword);
            retriever = new ImageRetriever();

            int seconds;

            if (args.Length > 0 && int.TryParse(args[0], out seconds))
            {
                Timer timer = new Timer(TimerTick, null, TimeSpan.Zero, TimeSpan.FromSeconds(seconds));
                System.Console.ReadLine();                 // Chillout and wait for the timer mo'fo
            }
            else
            {
                TimerTick(null);                 // Force it once
            }
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            // Get my dirty XML config
            string cameraAddress = ConfigurationManager.AppSettings["CameraAddress"];
            string cameraUsername = ConfigurationManager.AppSettings["CameraUsername"];
            string cameraPassword = ConfigurationManager.AppSettings["CameraPassword"];
            string snapshotFolder = ConfigurationManager.AppSettings["SnapshotFolder"];
            // FTP Option
            string ftpAddress = ConfigurationManager.AppSettings["FTPAddress"];
            string ftpUsername = ConfigurationManager.AppSettings["FTPUsername"];
            string ftpPassword = ConfigurationManager.AppSettings["FTPPassword"];

            // Setup
            camera = new Camera(new Uri(cameraAddress));
            if(!string.IsNullOrEmpty(cameraPassword))
                camera.Credentials = new NetworkCredential(cameraUsername, cameraPassword);

            saver = new FileImageSaver(snapshotFolder);
            //saver = new FTPImageSaver(new Uri(ftpAddress), ftpUsername, ftpPassword);
            retriever = new ImageRetriever();

            int seconds;
            if (args.Length > 0 && int.TryParse(args[0], out seconds))
            {
                Timer timer = new Timer(TimerTick, null, TimeSpan.Zero, TimeSpan.FromSeconds(seconds));
                System.Console.ReadLine(); // Chillout and wait for the timer mo'fo
            }
            else
            {
                TimerTick(null); // Force it once
            }
        }
Ejemplo n.º 4
0
 void Start()
 {
     presentation   = new Presentation();
     mainCamera     = GetComponent <Camera> ();
     cameraMovement = GetComponent <CameraMovement> ();
     imageRetriever = GameObject.FindGameObjectWithTag("Main Picture").GetComponent <ImageRetriever> ();
     filePath       = GameManager.Instance.filePath;
     saveName       = GameManager.Instance.saveName;
     Load(saveName);
 }
Ejemplo n.º 5
0
        public async Task TestMethodFetchPhotoFromAPI2()
        {
            string   rovername     = "curiosity";
            DateTime requestedDate = Convert.ToDateTime("6/2/2018");
            string   jsonOutput    = await ImageRetriever.FetchPhotoFromAPI(rovername, requestedDate);

            bool expectedSuccessResult = true;
            bool actualSuccessResult   = !String.IsNullOrEmpty(jsonOutput);

            Assert.AreEqual(expectedSuccessResult, actualSuccessResult);
        }
Ejemplo n.º 6
0
 public void SaveDiaporama(ImageRetriever imageRetriever, bool diapo)
 {
     // Let the user configure the diaporama export.
     using (formDiapoExport fde = new formDiapoExport(diapo))
     {
         if (fde.ShowDialog() == DialogResult.OK)
         {
             DoSave(fde.Filename,
                    fde.FrameInterval,
                    true,
                    fde.PausedVideo ? false : true,
                    fde.PausedVideo,
                    imageRetriever);
         }
     }
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Main video saving pipeline. Saves either a video or the analysis data.
        /// </summary>
        public void Save(double playbackFrameInterval, double slowmotionPercentage, ImageRetriever imageRetriever)
        {
            // Let the user select what he wants to save exactly.
            formVideoExport fve = new formVideoExport(videoReader.FilePath, metadata, slowmotionPercentage);

            if (fve.ShowDialog() != DialogResult.OK)
            {
                fve.Dispose();
                return;
            }

            if (!FilesystemHelper.CanWrite(fve.Filename))
            {
                DisplayErrorMessage(ScreenManagerLang.Error_SaveMovie_FileError);
                fve.Dispose();
                return;
            }

            if (fve.SaveAnalysis)
            {
                MetadataSerializer serializer = new MetadataSerializer();
                serializer.SaveToFile(metadata, fve.Filename);
                metadata.AfterManualExport();
            }
            else
            {
                DoSave(fve.Filename,
                       fve.UseSlowMotion ? playbackFrameInterval : metadata.UserInterval,
                       fve.BlendDrawings,
                       false,
                       false,
                       imageRetriever);

                PreferencesManager.PlayerPreferences.VideoFormat = FilesystemHelper.GetVideoFormat(fve.Filename);
                PreferencesManager.Save();
            }

            fve.Dispose();
        }
 public void SetUp()
 {
     provider  = MockRepository.GenerateMock <IImageProvider>();
     retriever = new ImageRetriever(provider, MockRepository.GenerateMock <ITaskHandler>());
 }
Ejemplo n.º 9
0
        private void DoSave(string filePath, double frameInterval, bool flushDrawings, bool keyframesOnly, bool pausedVideo, ImageRetriever imageRetriever)
        {
            SavingSettings s = new SavingSettings();

            s.Section            = videoReader.WorkingZone;
            s.File               = filePath;
            s.InputFrameInterval = frameInterval;
            s.FlushDrawings      = flushDrawings;
            s.KeyframesOnly      = keyframesOnly;
            s.PausedVideo        = pausedVideo;
            s.ImageRetriever     = imageRetriever;

            formProgressBar        = new formProgressBar(true);
            formProgressBar.Cancel = Cancel_Asked;
            bgWorkerSave.RunWorkerAsync(s);
            formProgressBar.ShowDialog();
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Main video export.
        /// </summary>
        public void SaveVideo(double playbackFrameInterval, double slowmotionPercentage, ImageRetriever imageRetriever)
        {
            // Show the intermediate dialog for export options.
            formVideoExport fve = new formVideoExport(videoReader.FilePath, slowmotionPercentage);

            if (fve.ShowDialog() != DialogResult.OK)
            {
                fve.Dispose();
                return;
            }

            if (!FilesystemHelper.CanWrite(fve.Filename))
            {
                DisplayErrorMessage(ScreenManagerLang.Error_SaveMovie_FileError);
                fve.Dispose();
                return;
            }

            DoSave(fve.Filename,
                   fve.UseSlowMotion ? playbackFrameInterval : metadata.UserInterval,
                   true,
                   false,
                   false,
                   imageRetriever);

            // Save this as the "preferred" format for video exports.
            PreferencesManager.PlayerPreferences.VideoFormat = FilesystemHelper.GetVideoFormat(fve.Filename);
            PreferencesManager.Save();

            fve.Dispose();
        }