-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It is now possible to export annotations to Mantano Reader (lite or premium). Added a form to choose import and export readers.
- Loading branch information
1 parent
43bbcb6
commit 80c2b76
Showing
25 changed files
with
3,244 additions
and
800 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,30 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace AnnotationConverter | ||
{ | ||
abstract class AbsExport | ||
{ | ||
abstract internal void PrepareDocument(string targetFile); | ||
abstract internal void ExportRow(long iD, int markupType, string strMark, string strMarkEnd, string strName, string strMarkedText, string page, DateTime addedDate); | ||
abstract internal void CloseDocument(); | ||
internal int RecordsSkipped { get; set; } | ||
internal int RecordsInserted { get; set; } | ||
internal int RecordsUpdated { get; set; } | ||
internal int RecordErrors { get; set; } | ||
|
||
/// <summary> | ||
/// Target is an individual file (e.g. each books stores the annotations in its own xml) | ||
/// </summary> | ||
/// <param name="targetFile">path including filename</param> | ||
abstract internal void PrepareTarget(string targetFile); | ||
|
||
/// <summary> | ||
/// Target resides in a DB | ||
/// </summary> | ||
/// <param name="bookId">ID of the book within the DB</param> | ||
abstract internal void PrepareTarget(long bookId); | ||
|
||
abstract internal void ExportRow(ExportRowParams exportRowParams); | ||
|
||
abstract internal void CloseTarget(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Data; | ||
using System.Drawing; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Windows.Forms; | ||
using AnnotationConverter.Helpers; | ||
|
||
namespace AnnotationConverter | ||
{ | ||
public partial class FrmChooseReaders : Form | ||
{ | ||
private Dictionary<Utils.EReader, string> _diImportReaders = new Dictionary<Utils.EReader, string>(); | ||
private Dictionary<Utils.EReader, string> _diExportReaders = new Dictionary<Utils.EReader, string>(); | ||
|
||
public FrmChooseReaders() | ||
{ | ||
_diImportReaders.Add(Utils.EReader.SonyPRST, "Sony PRS-T1/-T2/-T3"); | ||
_diExportReaders.Add(Utils.EReader.Mantano, "Mantano Ebook Reader Free/Pro"); | ||
_diExportReaders.Add(Utils.EReader.AdobeDigitalEditions, "Adobe Digital Editions 2.x/3.x"); | ||
InitializeComponent(); | ||
} | ||
|
||
#region Handler Methods | ||
private void radioButton_CheckedChanged(object sender, EventArgs e) | ||
{ | ||
var rdb = sender as RadioButton; | ||
if (rdb != null && rdb.Checked) | ||
{ | ||
rdb.Parent.Tag = (Utils.EReader)rdb.Tag; | ||
} | ||
} | ||
|
||
private void AddRadioButtons(Dictionary<Utils.EReader, string> readers, GroupBox targetBox) | ||
{ | ||
int vPos = 20; | ||
int i = 0; | ||
foreach (KeyValuePair<Utils.EReader, string> pair in readers) | ||
{ | ||
var rdb = new RadioButton | ||
{ | ||
Name = "rdb" + pair.Value, | ||
Text = pair.Value, | ||
Tag = pair.Key, | ||
Location = new Point(20, vPos), | ||
AutoSize = true | ||
}; | ||
rdb.CheckedChanged += new System.EventHandler(this.radioButton_CheckedChanged); | ||
targetBox.Controls.Add(rdb); | ||
rdb.Checked = (i == 0); | ||
vPos += 20; | ||
i++; | ||
} | ||
} | ||
|
||
private void OpenFormCloseThis(Form form) | ||
{ | ||
this.Hide(); | ||
form.Closed += (sender, args) => this.Close(); | ||
form.Show(); | ||
} | ||
|
||
private void btnOK_Click(object sender, EventArgs e) | ||
{ | ||
if ((Utils.EReader)gbImport.Tag == Utils.EReader.SonyPRST) | ||
{ | ||
switch ((Utils.EReader)gbExport.Tag) | ||
{ | ||
case Utils.EReader.AdobeDigitalEditions: | ||
OpenFormCloseThis(new ConverterGuiADE()); | ||
break; | ||
case Utils.EReader.Mantano: | ||
OpenFormCloseThis(new ConverterGuiMantano()); | ||
break; | ||
default: | ||
throw new ArgumentOutOfRangeException(); | ||
} | ||
} | ||
} | ||
|
||
private void btnCancel_Click(object sender, EventArgs e) | ||
{ | ||
this.Close(); | ||
} | ||
#endregion | ||
|
||
#region Various Methods | ||
private void ChooseReaders_Load(object sender, EventArgs e) | ||
{ | ||
int radioHeight = 20 * Math.Max(_diImportReaders.Count(), _diExportReaders.Count()); | ||
gbImport.Height = gbExport.Height = radioHeight + 30; | ||
this.Height = radioHeight + 140; | ||
AddRadioButtons(_diImportReaders, gbImport); | ||
AddRadioButtons(_diExportReaders, gbExport); | ||
} | ||
#endregion | ||
} | ||
} |
Oops, something went wrong.