Exemplo n.º 1
0
        private void Save_Click(object sender, EventArgs e)
        {
            using (TempRemoveFileAttributes tempRemoveFileAttributes = new TempRemoveFileAttributes(Settings.WorkingDir + ".mailmap"))
            {

                //Enter a newline to work around a wierd bug that causes the first line to include 3 extra bytes. (encoding marker??)
                MailMapFile = Environment.NewLine + _MailMapText.Text.Trim();
                using (TextWriter tw = new StreamWriter(Settings.WorkingDir + ".mailmap", false, Settings.Encoding))
                {
                    tw.Write(MailMapFile);
                }
                Close();
            }
        }
Exemplo n.º 2
0
        private void Save_Click(object sender, EventArgs e)
        {
            try
            {
                using (TempRemoveFileAttributes tempRemoveFileAttributes = new TempRemoveFileAttributes(Settings.WorkingDir + ".gitignore"))
                {

                    //Enter a newline to work around a wierd bug that causes the first line to include 3 extra bytes. (encoding marker??)
                    GitIgnoreFile = Environment.NewLine + _GitIgnoreEdit.Text.Trim();
                    using (TextWriter tw = new StreamWriter(Settings.WorkingDir + ".gitignore", false, Settings.Encoding))
                    {
                        tw.Write(GitIgnoreFile);
                        tw.Close();
                    }
                    Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 3
0
        private void AddToIngore_Click(object sender, EventArgs e)
        {
            try
            {
                using (TempRemoveFileAttributes tempRemoveFileAttributes = new TempRemoveFileAttributes(Settings.WorkingDir + ".gitignore"))
                {
                    StringBuilder gitIgnoreFile = new StringBuilder();
                    gitIgnoreFile.Append(Environment.NewLine);
                    gitIgnoreFile.Append(FilePattern.Text);

                    using (TextWriter tw = new StreamWriter(Settings.WorkingDir + ".gitignore", true, Settings.Encoding))
                    {
                        tw.Write(gitIgnoreFile);
                        tw.Close();
                    }
                }
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            Close();
        }
Exemplo n.º 4
0
        public void Save()
        {
            StringBuilder configFileContent = new StringBuilder();

            foreach (ConfigSection section in sections)
            {
                //Skip empty sections
                if (section.Keys.Count == 0)
                    continue;

                configFileContent.AppendLine(section.ToString());

                foreach (KeyValuePair<string, string> key in section.Keys)
                {
                    configFileContent.AppendLine(string.Concat("\t", key.Key, " = ", escapeString(key.Value)));
                }
            }

            try
            {
                using (TempRemoveFileAttributes tempRemoveFileAttributes = new TempRemoveFileAttributes(fileName))
                {
                    File.WriteAllText(fileName, configFileContent.ToString(), Settings.Encoding);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }