Exemple #1
0
        public static void Main(string[] args)
        {
            try
            {
                Console.WriteLine("Initializing thumbgen...");

                #region Initialization
                // initialize controller

                ControllerSettings cs = new ControllerSettings(Properties.Settings.Default.InitialSize,
                    Properties.Settings.Default.SourceConnectionString,
                    Properties.Settings.Default.AzureBlobUrl,
                    Properties.Settings.Default.AzureConnectionString);

                Controller ctrl = new Controller();
                ctrl.SetControllerSettings(cs);

                Console.WriteLine("Azure and database connected successfully.");

                #endregion

                if (args.Length == 0 || args[0].ToLower() == "updateall")
                {
                    Console.WriteLine("ThumbGen: running in 'update all' mode");
                    // update all mode
                    ctrl.UpdateThumbnails();

                }
                else if (args.Length == 2 && args[0].ToLower() == "update")
                {
                    Console.WriteLine("ThumbGen: running in 'single update' mode");
                    Guid input;
                    Guid.TryParse(args[1], out input);

                    if (input == null)
                        Console.WriteLine("ThumbGen: given ID is not a valid guid");

                    // update one mode
                    ctrl.MakeThumbsForItemID(input);

                }
                else if (args.Length == 1 && args[0].ToLower() == "deleteall")
                {
                    Console.WriteLine("ThumbGen: running in clean up mode.");
                    Console.WriteLine("Program is going to delete all thumbnail data. Do you want to proceed? (Y/N)");

                    while (true)
                    {
                        ConsoleKeyInfo ki = Console.ReadKey();

                        if (ki.Key == ConsoleKey.Y)
                        {
                            // delete all mode
                            ctrl.RemoveAllThumbnails();
                            break;
                        }
                        else if (ki.Key == ConsoleKey.N)
                        {
                            Console.WriteLine("Operation was cancelled by user.");
                            break;
                        }
                        else
                        {
                            continue;
                        }
                    }
                }
                else
                {
                    PrintHelp();
                }
            }
            catch (Exception e)
            {
                Console.Write("Exception caught: " + e.ToString() + "\n");
            }
        }
Exemple #2
0
        public static void Main(string[] args)
        {
            try
            {
                Console.WriteLine("Initializing thumbgen...");

                #region Initialization
                // initialize controller

                ControllerSettings cs = new ControllerSettings(Properties.Settings.Default.InitialSize,
                                                               Properties.Settings.Default.SourceConnectionString,
                                                               Properties.Settings.Default.AzureBlobUrl,
                                                               Properties.Settings.Default.AzureConnectionString);

                Controller ctrl = new Controller();
                ctrl.SetControllerSettings(cs);

                Console.WriteLine("Azure and database connected successfully.");

                #endregion


                if (args.Length == 0 || args[0].ToLower() == "updateall")
                {
                    Console.WriteLine("ThumbGen: running in 'update all' mode");
                    // update all mode
                    ctrl.UpdateThumbnails();
                }
                else if (args.Length == 2 && args[0].ToLower() == "update")
                {
                    Console.WriteLine("ThumbGen: running in 'single update' mode");
                    Guid input;
                    Guid.TryParse(args[1], out input);

                    if (input == null)
                    {
                        Console.WriteLine("ThumbGen: given ID is not a valid guid");
                    }

                    // update one mode
                    ctrl.MakeThumbsForItemID(input);
                }
                else if (args.Length == 1 && args[0].ToLower() == "deleteall")
                {
                    Console.WriteLine("ThumbGen: running in clean up mode.");
                    Console.WriteLine("Program is going to delete all thumbnail data. Do you want to proceed? (Y/N)");

                    while (true)
                    {
                        ConsoleKeyInfo ki = Console.ReadKey();

                        if (ki.Key == ConsoleKey.Y)
                        {
                            // delete all mode
                            ctrl.RemoveAllThumbnails();
                            break;
                        }
                        else if (ki.Key == ConsoleKey.N)
                        {
                            Console.WriteLine("Operation was cancelled by user.");
                            break;
                        }
                        else
                        {
                            continue;
                        }
                    }
                }
                else
                {
                    PrintHelp();
                }
            }
            catch (Exception e)
            {
                Console.Write("Exception caught: " + e.ToString() + "\n");
            }
        }
Exemple #3
0
 /// <summary>
 /// Sets controller settings
 /// </summary>
 /// <param name="cs">ControllerSettings to set up</param>
 public void SetControllerSettings(ControllerSettings cs)
 {
     SetPreviewSize(cs.PreviewSize);
     ConfigureAzure(cs.AzureBlobUrl, cs.AzureAccountName, cs.AzureKeytoBlob);
     ConfigureSQL(cs.SqlConnectionString);
 }
Exemple #4
0
 /// <summary>
 /// Sets controller settings
 /// </summary>
 /// <param name="cs">ControllerSettings to set up</param>
 public void SetControllerSettings(ControllerSettings cs)
 {
     SetPreviewSize(cs.PreviewSize);
     ConfigureAzure(cs.AzureBlobUrl, cs.AzureConnectionString);
     ConfigureSQL(cs.SqlConnectionString);
 }