Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am trying to do something very specific here; Essentially, what this code does:

else if (cmd == "streams")
                {
                    Console.WriteLine("Hello, thank you for testing out the streams beta.
Before you start, there are some things you should know.
 First off, all screenshots are saved to your documents folder. They are named streams and streams_green.
To stop recording, close the software.");
                    Console.WriteLine("Please enter your monitors resolution (RECORD WITH YOUR GAME IN FULLSCREEN WINDOWED)");
                    Console.WriteLine("X:");
                    int xres = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("Y:");
                    int yres = Convert.ToInt32(Console.ReadLine());
                    p.Send(maxfps);
                    Console.WriteLine("Thank you, recording now started.");
                    Bitmap memoryImage;
                    memoryImage = new Bitmap(xres, yres);
                    Size s = new Size(memoryImage.Width, memoryImage.Height);
                    Graphics memoryGraphics = Graphics.FromImage(memoryImage);
                    for (var i = 0; ; i++)
                    {
                        memoryGraphics.CopyFromScreen(0, 0, 0, 0, s);
                        string str = "";
                        string str2 = "";
                        str = string.Format(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) +
                        $@"streams{i}.png");
                        str2 = string.Format(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) +
                        $@"streams_green{i}.png");
                        System.Threading.Thread.Sleep(2);
                        //Send spacebar would go here
                        p.Send(green);
                        memoryImage.Save(str);
                        System.Threading.Thread.Sleep(1);
                        p.Send(regular);
                        memoryImage.Save(str2);
                        System.Threading.Thread.Sleep(1);

                    }

Is send a dvar to a game, take a screenshot, and another dvar, then take another screenshot ect. As you can see by "p.Send(green)" and (regular). However, I have an issue. I am trying to have this save all of the greenscreen screenshots as streams_green, and the regular ones under streams. It is currently properly saving all of the files, however, the _green images are identical to the regular ones, even though the moment the green screenshot was taken was a completely different displayed frame as the one before it. Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
284 views
Welcome To Ask or Share your Answers For Others

1 Answer

Based on the code your method takes only one screenshoot at line memoryGraphics.CopyFromScreen(0, 0, 0, 0, s); and then save it in two separate files by memoryImage.Save. If instancegreen (in line p.Send(green)) and instance regular (in line p.Send(regular)) have information you want to save then you should change them to Bitmap and save.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...