コード例 #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
ファイル: Main.cs プロジェクト: prot1vogas/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");
            }
        }
コード例 #3
0
ファイル: Controller.cs プロジェクト: fashaikh/ChronoZoom
 /// <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
ファイル: Controller.cs プロジェクト: prot1vogas/NewProject
 /// <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);
 }