Esempio n. 1
0
 private void SaveGroupedProfileAs_Click(object sender, EventArgs e)
 {
     if (GroupedProfilesList.Items.Count > 0)
     {
         _profile.Includes.Clear();
         foreach (string pathFile in GroupedProfilesList.Items)
         {
             string fullPathToFile = Application.StartupPath + "\\Profiles\\Quester\\" + pathFile;
             if (!string.IsNullOrWhiteSpace(pathFile) && File.Exists(fullPathToFile))
             {
                 _profile.Includes.Add(new Include {
                     PathFile = pathFile, ScriptCondition = ""
                 });
             }
         }
         string fileToSaveAs = Others.DialogBoxSaveFile(Application.StartupPath + "\\Profiles\\Quester\\Grouped\\",
                                                        nManager.Translate.Get(nManager.Translate.Id.GroupedQuestProfileFile) + " (*.xml)|*.xml");
         if (fileToSaveAs == "")
         {
             return;
         }
         if (XmlSerializer.Serialize(fileToSaveAs, _profile))
         {
             Close();
         }
     }
     else
     {
         MessageBox.Show(nManager.Translate.Get(nManager.Translate.Id.CantSaveEmptyGroupedNew));
     }
 }
Esempio n. 2
0
 private void SaveSimpleProfileAs_Click(object sender, EventArgs e)
 {
     if (_profile.Quests.Count > 0 || _profile.Questers.Count > 0)
     {
         string fileToSaveAs = Others.DialogBoxSaveFile(Application.StartupPath + "\\Profiles\\Quester\\", nManager.Translate.Get(nManager.Translate.Id.SimpleQuestProfileFile) + " (*.xml)|*.xml");
         if (fileToSaveAs != "")
         {
             XmlSerializer.Serialize(fileToSaveAs, _profile);
         }
         Close();
     }
     else
     {
         MessageBox.Show(nManager.Translate.Get(nManager.Translate.Id.CantSaveEmptySimpleNew));
     }
 }
Esempio n. 3
0
        private void saveB_Click(object sender, EventArgs ex)
        {
            try
            {
                string file =
                    Others.DialogBoxSaveFile(Application.StartupPath + "\\Profiles\\Grinder\\",
                                             "Profile files (*.xml)|*.xml|All files (*.*)|*.*");

                if (file != "")
                {
                    XmlSerializer.Serialize(file, _profile);
                }
            }
            catch (Exception e)
            {
                Logging.WriteError("Grinder > Bot > ProfileCreator > saveB_Click(object sender, EventArgs ex): " + e);
            }
        }
Esempio n. 4
0
 private void SaveGrid()
 {
     try
     {
         string filePath = Others.DialogBoxSaveFile(Application.StartupPath + @"\Data\Lang\", "Langage files (*.xml)|*.xml");
         if (!string.IsNullOrWhiteSpace(filePath))
         {
             _translation.Translations.Clear();
             for (int i = 0; i < TranslationTable.Rows.Count - 1; i++)
             {
                 DataGridViewRow row = TranslationTable.Rows[i];
                 // Foreach is necessary since the user can sort the Grid, the indexes wont match.
                 foreach (Translate.Id currId in Enum.GetValues(typeof(Translate.Id)))
                 {
                     if (currId.ToString() != row.Cells[0].Value.ToString())
                     {
                         continue;
                     }
                     string textContent = row.Cells[1].Value == null || string.IsNullOrEmpty(row.Cells[1].Value.ToString()) ||
                                          row.Cells[1].Value.ToString() == row.Cells[0].Value.ToString() || row.Cells[1].Value.ToString().Contains("_")
                         ? row.Cells[2].Value.ToString()
                         : row.Cells[1].Value.ToString();
                     _translation.Translations.Add(new Translate.Translation
                     {
                         Id   = currId,
                         Text = textContent
                     });
                     break;
                 }
             }
             XmlSerializer.Serialize(filePath, _translation);
             LoadGrid(filePath);
         }
     }
     catch (Exception ex)
     {
         Logging.WriteError("Translate_Tools > SaveGrid(): " + ex);
     }
 }