示例#1
0
        static void Main(string[] args)
        {
            int    width  = 0;
            int    height = 0;
            string format = "";
            string loadingXML;

            Console.WriteLine("            Welcome to this amazing \n                Photo Converter! \n               Let's get started!\n");

            loadingXML = OtherMethodsContainer.CheckForXmlConfig();

            ImageMetaDataContainer myContainer;

            if (loadingXML.Equals("yes"))
            {
                string xmlFilePath = "XML file\\PhotoConverterCommands.xml";
                //Defining the Container.
                myContainer = new ImageMetaDataContainer(xmlFilePath);
                //input = myContainer.input; // not needed, as it is just repackaging stuff, while it can be done in the class1 in method. and here the whole method will be simply called.
            }
            else
            {
                Tuple <string, string, string> getValueOfSourceMethod = OtherMethodsContainer.SourceMethod(); // this thing will initialise SourceMethod once and will enable to get the values of it for following variables.

                Console.WriteLine("\nProvide value to height or with to resize image with original aspect ratio for this size. \nOther value write '0' or press enter. \nWrite both values to loose aspect ratio but receive the demanded values");
                width  = OtherMethodsContainer.WidthMethod();
                height = OtherMethodsContainer.HeightMethod();
                format = OtherMethodsContainer.FormatMethodCheck();

                Tuple <string, string, string> getValueOfDestinationMethod = OtherMethodsContainer.DestinationMethod(format);

                //Defining the Container.
                myContainer = new ImageMetaDataContainer(getValueOfSourceMethod, width, height, format, getValueOfDestinationMethod);
            }

            string joinedformatOfFileInRootFolder = "*.jpg|*.png|*.gif|*.tiff";

            string[] files = OtherMethodsContainer.GetFiles(myContainer.sourceOfFolder, joinedformatOfFileInRootFolder, SearchOption.AllDirectories);


            //No Constructor, only one method call.
            PhotoConversionContainer.ImageConversionMethod(myContainer, files);


            Console.WriteLine("Press any key to continue");
            Console.ReadKey();
        }
示例#2
0
        static void Main(string[] args)
        {
            int    width  = 0;
            int    height = 0;
            string format = "";
            string loadingXML;


            Console.WriteLine("            Welcome to this amazing \n                Photo Converter! \n               Let's get started!\n");

            loadingXML = InputContainer.CheckForXmlConfig();

            ImageMetaDataContainer myContainer;

            if (loadingXML.Equals("yes"))
            {
                string xmlFilePath = "XML file\\PhotoConverterCommands.xml";
                myContainer = new ImageMetaDataContainer(xmlFilePath);
            }
            else
            {
                Tuple <string, string, string> getValueOfSourceMethod = InputContainer.SourceMethod();

                Console.WriteLine("\nProvide value to height or with to resize image with original aspect ratio for this size. \nOther value write '0' or press enter. \nWrite both values to loose aspect ratio but receive the demanded values");
                width  = InputContainer.Width();
                height = InputContainer.Height();
                format = InputContainer.FormatCheck();

                Tuple <string, string, string> getValueOfDestinationMethod = InputContainer.Destination(format);

                myContainer = new ImageMetaDataContainer(getValueOfSourceMethod, width, height, format, getValueOfDestinationMethod);
            }

            string joinedformatOfFileInRootFolder = "*.jpg|*.png|*.gif|*.tiff";

            string[] files = InputContainer.GetFiles(myContainer.sourceOfFolder, joinedformatOfFileInRootFolder, SearchOption.AllDirectories);


            PhotoConversionContainer.ImageConversion(myContainer, files);


            Console.WriteLine("Press any key to continue");
            Console.ReadKey();
        }