Beispiel #1
0
        public static void MyClassInitialize(TestContext testContext)
        {
            ctrl = new Controller();

            // prepare azure
            ctrl.SetPreviewSize(new Size(512, 512));
            ctrl.ConfigureAzure(@"http://czbeta.blob.core.windows.net/images/",
                "czbeta", "GuOeSK06XNtEh40CoXUhQUKhPXfxnTvzdY7ZwzGruRmCYA221htHIbeeZ4PC6YU9WZ5IGHLkQTpcxVIBX1WSYw==");
            // prepare sql
            ctrl.ConfigureSQL("data source=iikwkr4fng.database.windows.net;initial catalog=Chronozoom; persist security info=True; user id=czdev; password=ChronoZ)om;multipleactiveresultsets=True;App=EntityFramework");
        }
Beispiel #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");
            }
        }