Beispiel #1
0
        private void Button1_Click(object sender, EventArgs e)
        {
            if (!Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + GlobalConfiguration.Documents))
            {
                Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + GlobalConfiguration.Documents);
            }

            if (Ressource.DoesRessourceExist(textBoxName.Text))
            {
                DialogResult result = MessageBox.Show("Ressource scheint schon zu existieren. Eindeutigen Namen wählen oder alte Ressource löschen und erneut versuchen?", "Alte Ressource löschen?", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    File.Delete(Ressource.PATH + textBoxName.Text + ".xml");
                    File.Delete(AppDomain.CurrentDomain.BaseDirectory + GlobalConfiguration.Documents + "//Ressources//" + textBoxName.Text + ".rtf");
                    MessageBox.Show("Alte Ressource gelöscht. Bitte erneut versuchen diese zu erstellen.");
                }
            }
            else
            {
                if (!Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + GlobalConfiguration.Documents + "//Ressources//"))
                {
                    Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + GlobalConfiguration.Documents + "//Ressources//");
                }
                richTextBoxDescr.SaveFile(AppDomain.CurrentDomain.BaseDirectory + GlobalConfiguration.Documents + "//Ressources//" + textBoxName.Text + ".rtf");
                Ressource ressource = new Ressource(textBoxName.Text)
                {
                    DescriptionPath = GlobalConfiguration.Documents + "//Ressources//" + textBoxName.Text + ".rtf"
                };
                Ressource.Save(ressource);
                Close();
            }
        }
Beispiel #2
0
        public string Save(string Name, Int64 ID, string jsonData, string Type = "")
        {
            string s = Ressource.Save(Name, ID, Type, jsonData);

            return(s);
        }