<commit_before>﻿
using Microsoft.Win32;
using System.IO;
using System.Windows;
using System.Windows.Controls;
namespace PICSimulator.View
{
	class SourcecodeDocument
	{
		private Window Owner;

		private string LastSaved_Value; // The Value that is currently on the Filesystem
		public string Value { get; private set; }

		public string Path { get; private set; }

		public bool isDirty { get { return Value != LastSaved_Value; } }

		public SourcecodeDocument(Window owner, TextBox handler, string text, string path)
		{
			LastSaved_Value = text;
			Value = text;
			Path = path;

			Owner = owner;

			handler.Text = Value;
			handler.TextChanged += OnChange;

			updateTitle();
		}

		public SourcecodeDocument(Window owner, TextBox handler)
		{
			LastSaved_Value = null;
			Value = "";
			Path = null;

			Owner = owner;

			handler.Text = Value;
			handler.TextChanged += OnChange;

			updateTitle();
		}

		public static SourcecodeDocument OpenNew(Window owner, TextBox handler)
		{
			OpenFileDialog ofd = new OpenFileDialog();
			ofd.Filter = "All Files|*|Sourcecode (.src)|*.src";
			ofd.FilterIndex = 2;
			ofd.CheckFileExists = true;
			ofd.CheckPathExists = true;

			if (ofd.ShowDialog().GetValueOrDefault(false))
			{
				try
				{
					string s = File.ReadAllText(ofd.FileName);

					return new SourcecodeDocument(owner, handler, s, ofd.FileName);
				}
				catch (IOException)
				{<commit_msg>Change OpenFile Dialog<commit_after>﻿
using Microsoft.Win32;
using System.IO;
using System.Windows;
using System.Windows.Controls;
namespace PICSimulator.View
{
	class SourcecodeDocument
	{
		private Window Owner;

		private string LastSaved_Value; // The Value that is currently on the Filesystem
		public string Value { get; private set; }

		public string Path { get; private set; }

		public bool isDirty { get { return Value != LastSaved_Value; } }

		public SourcecodeDocument(Window owner, TextBox handler, string text, string path)
		{
			LastSaved_Value = text;
			Value = text;
			Path = path;

			Owner = owner;

			handler.Text = Value;
			handler.TextChanged += OnChange;

			updateTitle();
		}

		public SourcecodeDocument(Window owner, TextBox handler)
		{
			LastSaved_Value = null;
			Value = "";
			Path = null;

			Owner = owner;

			handler.Text = Value;
			handler.TextChanged += OnChange;

			updateTitle();
		}

		public static SourcecodeDocument OpenNew(Window owner, TextBox handler)
		{
			OpenFileDialog ofd = new OpenFileDialog();
			ofd.Filter = "All Files|*|Source- and Programmcode|*.src,*.lst|Sourcecode|*.src|Programmcode|*.lst";
			ofd.FilterIndex = 2;
			ofd.CheckFileExists = true;
			ofd.CheckPathExists = true;

			if (ofd.ShowDialog().GetValueOrDefault(false))
			{
				try
				{
					string s = File.ReadAllText(ofd.FileName);

					return new SourcecodeDocument(owner, handler, s, ofd.FileName);
				}
				catch (IOException)
				{
{'fraction_non_alphanumeric': 0.10221760221760222, 'fraction_numerical': 0.002079002079002079, 'mean_word_length': 3.50390015600624, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5816839', 'n_tokens_mistral': 1077, 'n_tokens_neox': 885, 'n_words': 243}