예제 #1
0
파일: Main.cs 프로젝트: Bzdun/NewProject
        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");
            }
        }
예제 #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");
            }
        }
예제 #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);
 }
예제 #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);
 }