예제 #1
0
        static void Main(string[] args)
        {
            String finishedFile = "jxfive_" + DateTime.Now.ToShortDateString() + "_" + DateTime.Now.ToShortTimeString().Replace(" ", string.Empty) + ".jpg";

            Console.WriteLine(finishedFile);
            Console.WriteLine(finishedFile.Substring(0, finishedFile.IndexOf("_")));
            Console.ReadLine();

            String fileName = "1_jxfive_pic#1";

            Console.WriteLine(fileName.Substring(0, fileName.IndexOf("_")));
            Console.ReadLine();
            Console.WriteLine(fileName.Substring(fileName.IndexOf("_") + 1, fileName.LastIndexOf("_") - 2));
            Console.ReadLine();

            DirectoryInfo dir = new DirectoryInfo(@"F:\");

            FileInfo[]    sdFiles = dir.GetFiles("*.txt", SearchOption.AllDirectories);
            List <Bitmap> myAL    = new List <Bitmap>();



            foreach (FileInfo f in sdFiles)
            {
                Console.WriteLine(f.Name);
                Console.WriteLine(f.FullName);
                if (f.Name.ToString().Substring(0, f.Name.ToString().IndexOf("_")).Equals("1"))
                {
                    Console.WriteLine("SUBSTRING 1");
                    myAL.Add(new Bitmap(new FileStream(f.FullName, FileMode.Open)));
                    //   myAL.Add(new  FileStream(f.FullName, FileMode.Open));
                }
            }
            Bitmap[] bitmapArray = myAL.ToArray();
            Console.WriteLine(bitmapArray.Length);
            CombineImage combinedImage = new CombineImage();

            //    combinedImage.combineByRectangle(myAL.ToArray());
            combinedImage.combineByRectangle(bitmapArray, finishedFile);
            Uri uploadPage = new Uri("http://*****:*****@"F:\jrxfive_something.jpg");

            Console.WriteLine("\nResponse Received.The contents of the file uploaded are:\n{0}",
                              System.Text.Encoding.ASCII.GetString(responseArray));

            Console.ReadLine();
        }
예제 #2
0
        static void Main(string[] args)
        {
            String finishedFile = "jxfive_" + DateTime.Now.ToShortDateString() + "_" + DateTime.Now.ToShortTimeString().Replace(" ", string.Empty) + ".jpg";
            Console.WriteLine(finishedFile);
            Console.WriteLine(finishedFile.Substring(0, finishedFile.IndexOf("_")));
            Console.ReadLine();

            String fileName = "1_jxfive_pic#1";
            Console.WriteLine(fileName.Substring(0, fileName.IndexOf("_")));
            Console.ReadLine();
            Console.WriteLine(fileName.Substring(fileName.IndexOf("_") + 1, fileName.LastIndexOf("_") - 2));
            Console.ReadLine();

            DirectoryInfo dir = new DirectoryInfo(@"F:\");
            FileInfo[] sdFiles = dir.GetFiles("*.txt", SearchOption.AllDirectories);
            List<Bitmap> myAL = new List<Bitmap>();

            foreach (FileInfo f in sdFiles)
            {
                Console.WriteLine(f.Name);
                Console.WriteLine(f.FullName);
                if (f.Name.ToString().Substring(0, f.Name.ToString().IndexOf("_")).Equals("1"))
                {
                    Console.WriteLine("SUBSTRING 1");
                    myAL.Add(new Bitmap( new FileStream(f.FullName, FileMode.Open)));
                 //   myAL.Add(new  FileStream(f.FullName, FileMode.Open));
                }
            }
            Bitmap[] bitmapArray = myAL.ToArray();
            Console.WriteLine(bitmapArray.Length);
            CombineImage combinedImage = new CombineImage();
            //    combinedImage.combineByRectangle(myAL.ToArray());
            combinedImage.combineByRectangle(bitmapArray, finishedFile);
            Uri uploadPage = new Uri("http://*****:*****@"F:\jrxfive_something.jpg");

            Console.WriteLine("\nResponse Received.The contents of the file uploaded are:\n{0}",
            System.Text.Encoding.ASCII.GetString(responseArray));

            Console.ReadLine();
        }