Ejemplo n.º 1
0
 public static void saveSettings(Settings settings)
 {
     if (!Directory.Exists(Settings.SaveDirPath) || !File.Exists(SettingsSavePath))
     {
         Directory.CreateDirectory(Settings.SaveDirPath);
     }
     XmlSerializer serializer = new XmlSerializer(typeof(Settings));
     using (XmlTextWriter writer = new XmlTextWriter(SettingsSavePath, Encoding.Unicode))
     {
         writer.Formatting = Formatting.Indented;
         serializer.Serialize(writer, settings);
     }
 }
Ejemplo n.º 2
0
 public static Settings tryLoad()
 {
     Settings settings = null;
     if(Directory.Exists(SaveDirPath) && File.Exists(SettingsSavePath))
     {
         XmlSerializer serializer = new XmlSerializer(typeof(Settings));
         using (XmlReader reader = new XmlTextReader(SettingsSavePath))
         {
             settings = serializer.Deserialize(reader) as Settings;
         }
         if (settings.IntervalMinutes < 10)
             settings.IntervalMinutes = 10;
     }
     else
         settings = new Settings();
     return settings;
 }
Ejemplo n.º 3
0
 private void GUIMainWindow_Load(object sender, EventArgs e)
 {
     settings = Settings.tryLoad();
     getter = new PikabuGetter(settings);
     getter.tryLoadComments();
     table = new DataTable();
     table.Columns.Add("Плюсы");
     table.Columns.Add("Автор");
     table.Columns.Add("Комментарий");
     table.Columns.Add("Название поста");
     commentsDataGridView.DataSource = table;
     resetTimer();
     mainTimer.Start();
 }
Ejemplo n.º 4
0
 public GUISettings(Settings settings)
 {
     InitializeComponent();
     this.settings = settings;
 }
Ejemplo n.º 5
0
 public PikabuGetter(Settings settings)
 {
     this.comments = new List<PikabuComment>();
     this.settings = settings;
 }