logo

XmlUtil class, for saving and parsering xml. More...

Static Public Member Functions

static string GetContentString (string filename, string nodename)
 Get a xml node and return the value as string. More...
 
static int GetContentInt (string filename, string nodename)
 Get a xml node and return the value as integer. More...
 
static bool ParserListPlugins (string response, short[] ipluginversionparts, System.Windows.Forms.ListBox lbxAvailablePlugins)
 Parser the listing of the plugins More...
 
static DownloadDetailsPlugin ParserDetailsPlugin (string response)
 Parser the details of the plugin detail response More...
 
static Note LoadNoteFile (Notes notes, string notefilename)
 Load a note file. More...
 
static bool LoadSettings ()
 Loads the settings file and set the settings in the static Settings class in memory. More...
 
static List< SkinLoadSkins ()
 Gets all skins from skin file. create Application data folder if does not exist. Create default SKINFILE if not exist. More...
 
static bool WriteDefaultSettings ()
 Write the default settings. Used for if SETTINGSFILE is not created yet. More...
 
static bool WriteNote (Note note, string skinname, string content)
 Write a note xml file. More...
 
static void ReadNoteFlyNotesBackupFile (Notes notes, string filepath)
 Read all notes from a notes backup file and return a array with all the notes. More...
 
static bool WriteSettings ()
 Write settings file. More...
 
static System.Drawing.Color ConvToClr (string colorstring)
 Convert HEX color to color object. More...
 
static short[] ParserLatestVersion (string serverresponse, out string versionquality, out string downloadurl, out string rsasignature)
 Get the new version as a integer array with first major second valeau the minor version and the third valeau being the release version. More...
 
static HighlightLanguage ParserLanguageLexical (string file, string name)
 Return a array of keywords used for the prgramming language we are doing a syntax check on. More...
 
static string GetContentStringLimited (string notefilepath, int limittextchars)
 Get the content node a note node More...
 
static void WriteNoteBody (XmlTextWriter xmlwrite, Note note, string skinname, string content)
 Write the note node with properties. More...
 

Public Attributes

const string SKINFILE = "skins.xml"
 Skin file. More...
 
const string SETTINGSFILE = "settings.xml"
 Settings file. More...
 

Static Private Member Functions

static Note ParserNoteNode (Notes notes, Note note, int readnotenum, bool setallcontent)
 Parser a note node in a xml file, readnotenum is the number of note node to be parser and returned as note object. More...
 
static void WriteDefaultSkins (string filename)
 Writes the default skins to the SKINFILE. Used for if SKINFILE is not created yet. More...
 
static void CheckFile (string filename)
 Checks if filesize is not 0 bytes for a filename More...
 
static void WriteXMLBool (XmlTextWriter xmlwrite, string element, bool checknode)
 Write 1 value for true and 0 for false. More...
 

Private Attributes

const string NOTEVERSION = "3"
 The note version More...
 

Static Private Attributes

static XmlTextReader xmlread = null
 XmlTextReader object. More...
 
static XmlTextWriter xmlwrite = null
 XmlTextWriter object. More...
 

Detailed Description

Member Function Documentation

static void NoteFly.xmlUtil.CheckFile ( string  filename)
staticprivate
Parameters
filenameThe filename to check
static System.Drawing.Color NoteFly.xmlUtil.ConvToClr ( string  colorstring)
static
Parameters
colorstringHex color as string.
Returns
Color object.
static int NoteFly.xmlUtil.GetContentInt ( string  filename,
string  nodename 
)
static
Parameters
filenameThe filename and path to search in.
nodenameThe node name to lookup.
Returns
A integer value
static string NoteFly.xmlUtil.GetContentString ( string  filename,
string  nodename 
)
static
Parameters
filenameThe filename and path to search in.
nodenameThe node name to lookup.
Returns
Return node content as string, empty if not found.
static string NoteFly.xmlUtil.GetContentStringLimited ( string  notefilepath,
int  limittextchars 
)
static
Parameters
notefilepathThe file to load as xml file.
limittextcharsThe limit on how many characters to read at most with the content node of the xmlfile.
Returns
The valeau of the content node in the xml file limited to the amount of characters given by limittextchars.
static Note NoteFly.xmlUtil.LoadNoteFile ( Notes  notes,
string  notefilename 
)
static
Parameters
notesReference to notes class.
notefilenameThe note filename.
Returns
An note object.
static bool NoteFly.xmlUtil.LoadSettings ( )
static
Returns
True if file settings exists.
static List<Skin> NoteFly.xmlUtil.LoadSkins ( )
static
Returns
A list of skins objects
static DownloadDetailsPlugin NoteFly.xmlUtil.ParserDetailsPlugin ( string  response)
static
Parameters
responseParser the xml response
installedpluginnamesThe names of the plugins installed.
alreadyinstalledIs the plugin to get details from already installed.
updateavailableIs a update availible based on parsering of the serverresponse
Returns
Array of strings with details from the plugin.
static HighlightLanguage NoteFly.xmlUtil.ParserLanguageLexical ( string  file,
string  name 
)
static
Parameters
fileThe file to parser.
nameThe language to lookup.
Returns
HighlightLanguage object.
static short [] NoteFly.xmlUtil.ParserLatestVersion ( string  serverresponse,
out string  versionquality,
out string  downloadurl,
out string  rsasignature 
)
static
Parameters
serverresponseThe server reponse stream.
versionqualityThe latest version quality, e.g: alpha, beta, rc or nothing for final.
downloadurlThe download url found.
rsasignatureRSA signature.
Returns
The newest version as integer array, any negative valeau(-1 by default) considered as error.
static bool NoteFly.xmlUtil.ParserListPlugins ( string  response,
short[]  ipluginversionparts,
System.Windows.Forms.ListBox  lbxAvailablePlugins 
)
static
Parameters
responseThe server response.
ipluginversionpartsThe Iplugin version as array with major, minor, release numbers
lbxAvailablePluginsListBox with availible plugins
Returns
True if parsering of response succeeded.
static Note NoteFly.xmlUtil.ParserNoteNode ( Notes  notes,
Note  note,
int  readnotenum,
bool  setallcontent 
)
staticprivate
Parameters
notesReference to notes class.
noteThe note object to set.
readnotenumThe number occurance of the note node to be parser (first, sencod etc.)
setallcontentForce to set the note temporary content variable in the note class even if not visible.
Returns
A note object
static void NoteFly.xmlUtil.ReadNoteFlyNotesBackupFile ( Notes  notes,
string  filepath 
)
static
Parameters
notesReference to notes class.
filepathThe notes backup filename and path.
static bool NoteFly.xmlUtil.WriteDefaultSettings ( )
static
Returns
True if writing settings succeeded otherwise false.
static void NoteFly.xmlUtil.WriteDefaultSkins ( string  filename)
staticprivate
Parameters
filenameThe skins file filename and path
static bool NoteFly.xmlUtil.WriteNote ( Note  note,
string  skinname,
string  content 
)
static
Parameters
noteThe note object.
skinnameThe skin name of the note.
contentThe note content.
Returns
True on succeeded otherwise false.
static void NoteFly.xmlUtil.WriteNoteBody ( XmlTextWriter  xmlwrite,
Note  note,
string  skinname,
string  content 
)
static
Parameters
xmlwriteThe XmlTextWriter object to write with.
noteThe note object.
skinnameThe skinname used by this note.
contentThe note content.
static bool NoteFly.xmlUtil.WriteSettings ( )
static
Returns
true if succeed.
static void NoteFly.xmlUtil.WriteXMLBool ( XmlTextWriter  xmlwrite,
string  element,
bool  checknode 
)
staticprivate
Parameters
xmlwriteXmlTextWriter object.
elementThe element name
checknodeThe node to check

Member Data Documentation

const string NoteFly.xmlUtil.NOTEVERSION = "3"
private
const string NoteFly.xmlUtil.SETTINGSFILE = "settings.xml"
const string NoteFly.xmlUtil.SKINFILE = "skins.xml"
XmlTextReader NoteFly.xmlUtil.xmlread = null
staticprivate
XmlTextWriter NoteFly.xmlUtil.xmlwrite = null
staticprivate