コード例 #1
0
 private void OnMakePatch( object sender, EventArgs e )
 {
   if ( lstCenRep.SelectedItems.Count < 1 ) return;
   string fn = _cenRepDir+@"\" +lstCenRep.SelectedItems[0].SubItems[0].Text+".txt";
   TCenRepParser cenRep = new TCenRepParser( fn );
   ofdOpenCenrep.DefaultExt = "txt";
   ofdOpenCenrep.FileName = lstCenRep.SelectedItems[0].SubItems[0].Text + ".txt";
   ofdOpenCenrep.InitialDirectory=@"C:\";
   if ( ofdOpenCenrep.ShowDialog() != DialogResult.OK ) return;
   XElement xPatch = cenRep.CreatePatch( ofdOpenCenrep.SafeFileName );
   plugin.Add( xPatch );
   plugin.Save();
 }
コード例 #2
0
    private void OnApplyPatch(object sender, EventArgs e)
    {
      if (lstCenRep.SelectedItems.Count>1)
      {
        if (MessageBox.Show(Resources.frmMain_OnApplyPatch_Patching_all_selected_items_,Resources.frmMain_OnApplyPatch_Multiple_secetion,MessageBoxButtons.YesNo) == DialogResult.No)
        {
          MessageBox.Show(Resources.frmMain_OnApplyPatch_Patching_aborted___);
          return;
        }
      }
      foreach (ListViewItem lvItem in lstCenRep.SelectedItems)
      {
        string fn = _cenRepDir + @"\" + lvItem.SubItems[0].Text + ".txt";
        //File.Copy(fn,); //Backup
        lvItem.SubItems[3].Text = Resources._YES;
        TCenRepParser cenrPatcher = new TCenRepParser(fn);
        if (lvItem.SubItems[4].Text==Resources._YES)
        {
          cenrPatcher.ApplyPatch(plugin[lvItem.SubItems[0].Text]);

        }
      }
    }
コード例 #3
0
// ReSharper disable UnusedMember.Local
    private void BatchPatch()
// ReSharper restore UnusedMember.Local
    {
      List<string > requirePatch = ( from ListViewItem lvItem in lstCenRep.Items where lvItem.SubItems[4].Text == Resources._YES select lvItem.SubItems[0].Text ).ToList();
      foreach(string s in requirePatch)
      {
        TCenRepParser cParser = new TCenRepParser(_cenRepDir+@"\"+s+@".txt");
        foreach (XElement xActPatch in plugin[s].Elements("PATCH"))
        {
          cParser.ApplyPatch(xActPatch);
        }
        cParser.Save();
      }
    }