c# pdf viewer open source : Reorder pages in pdf file software SDK cloud windows .net html class World%20of%20Warcraft%20Programming%20(2nd%20Edition)137-part1803

APP EN DI X
B
Utilizing Addon Libraries
WhenasystemasincrediblycomplexastheWorldofWarcraftAPIisreleased,
inevitablysomeonewritesalibraryoffunctionsthatmakesiteasierforspecific
uses, or adds certain functionality. True to form, several addon frameworks
andlibrarieshavebeen writtenforWoW.Thisappendixexploresthecreation
oflibrariesandintroducesyoutosomeof the moreprevalentaddon libraries.
What Is an Addon Library?
An addon libraryis a collection of code that can beused by multipleaddons.
They tend to provide some abstraction over the Blizzard API that makes it
easierto use for common cases. Over the course ofwriting your addons you
may find yourself writing the same functions over and overagain. Consider
thefollowing:
function debug(...)
local succ, message = pcall(string.format, ...)
if succ then
print(“|cffff1100Debug: |r“, message)
else
print(“|cffff1100Debug: |r“, tostringall(...))
end
end
1329
Reorder pages in pdf file - re-order PDF pages in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Support Customizing Page Order of PDF Document in C# Project
move pdf pages in preview; change pdf page order preview
Reorder pages in pdf file - VB.NET PDF Page Move Library: re-order PDF pages in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
Sort PDF Document Pages Using VB.NET Demo Code
reorder pages of pdf; switch page order pdf
1330 Part V
Appendixes
Iuse a function similar to this in many of my addons. It’s an extension of
the built-in
print
function thatprints a headingat the start ofeach message,
andalsoaccepts formatstrings.This meansinsteadofwritingthis:
print(string.format(“You have reached your destination '%s’“, destination)
Ican writethis:
print(“You have reached your destination '%s’“, destination)
Thisfunction can beusedtodisplay alist of arguments inthe samewayas
the
print
function.Although itmaynotseemlikemuch,Ifindprintingtothe
chat frame much easier using this function. This is how most libraries start,
identifyinga piece of code thatis useful to multipleaddons andthen writing
itin awaysoitcan bewrittenonce butdistributedwitheach ofthem.
How Do Libraries Work?
There are two main types of libraries: those that are written as standalone
addons and use the dependency system to load properly, and those that
are packaged within the actual addon, typically referred to as embedded
libraries.
Eachlibraryschemehasitsownsetofbenefitsandtradeoffs,andnosolution
has been foundthat fills everyone’s needs sufficiently. If yourlibrary is only
forpersonal use,andsomething youcan easilycontrol,making yourlibrarya
standalone addon is a natural choice. Ifyouare usingsomeoneelse’s library,
orknowthatotherdeveloperswilluseit,anembeddedlibrarygivesyoumuch
strictercontrol overwhatversion of alibraryyouareusing.
Standalone Libraries
Libraries that arewritten as standaloneaddonsareextremelyeasytouse and
towrite.Thefollowingcodeshowsasimplelibrarythatprovidesa waytouse
the
debug
function writtenearlierin this appendix:
AddonUtils.toc
## Interface: 30200
## Title: AddonUtils
## Notes: A library of simple addon utilities
AddonUtils.lua
AddonUtils.lua
AddonUtils = {}
C# TIFF: How to Reorder, Rearrange & Sort TIFF Pages Using C# Code
C# TIFF - Sort TIFF File Pages Order in C#.NET. Reorder, Rearrange and Sort TIFF Document Pages in C#.NET Application. C# TIFF Page Sorting Overview.
reorder pdf pages online; how to rearrange pdf pages in preview
C# PDF Page Rotate Library: rotate PDF page permanently in C#.net
C# .NET, add new PDF page, delete certain PDF page, reorder existing PDF pages and split may choose to only rotate a single page of PDF file or all
how to change page order in pdf acrobat; rearrange pages in pdf online
AppendixB
Utilizing AddonLibraries 1331
function AddonUtils.createDebugFunc(prefix)
return function(...)
local succ, message = pcall(string.format, ...)
if succ then
print(“|cffff1100“ .. prefix .. “: |r“, message)
else
print(“|cffff1100“ .. prefix .. “: |r“, tostringall(...))
end
end
end
To avoid conflicts with other addons, you create a new global table called
AddonUtils
. Inside you define a new function called
createDebugFunc()
,
which can be called by addons to create their own personalized debug
function.Forexamplethiscouldbeusedinthefollowingway:
local debug = AddonUtils.createDebugFunc(“MyAddon“)
debug(“Hello World!“)
Touse this library,an addonwouldneedtoincludeAddonUtils inits table
ofcontentsfilelikeso:
## Dependencies: AddonUtils
Advantages
Standalone addon libraries are very simple to create, and Blizzard’s depen-
dencysystemensuresthataddonsareloadedinthecorrectorder.Thereisonly
everone version of the libraryloaded, so no special consideration is needed.
In addition, the library can have its own dependencies, define its own XML
templates,andstoresavedvariables.
Disadvantages
The main problem with standalone addon libraries is the way they are
distributed.Ifyouareincludingonewithonlyafewofyouraddonsanddon’t
expectmanychangestoberequireditcanworkoutquitewell.Unfortunately
if multiple authors might be including your library, or periodic changes are
necessary to the codeitcanbe veryfrustrating.Witha standaloneaddon you
have twoways todistributeit:
1. Directtheusertowherehecandownloadthelatestversionofthelibrary
andmakehimresponsibleforitsupkeep.
2. Includethelibraryalongsideyourown addon.
VB.NET PowerPoint: Sort and Reorder PowerPoint Slides by Using VB.
Sort and Reorder PowerPoint Slides Range with VB amount of robust PPT slides/pages editing methods powerful & profession imaging controls, PDF document, image
reverse page order pdf; how to move pages within a pdf
VB.NET TIFF: Modify TIFF File by Adding, Deleting & Sort TIFF
Users can use it to reorder TIFF pages in ''' &ltsummary> ''' Sort TIFF document pages in designed powerful & profession imaging controls, PDF document, image
pdf reorder pages; pdf reverse page order preview
1332 Part V
Appendixes
Thefirstoption requires theusertodomoreworktouseyouraddon,butin
the day ofaddon updaters and email notification, this may notbe a problem
foryourapplication.
Thesecondoptionisthemoretroublesomebecauseitreliesonotherauthors
including the most recent version with their addons. In addition, it’s a bit
confusing to users when they’re asked by the operating system if they want
to overwrite a file when installing the addon. This particular point is why
embeddedlibrarieswerecreatedinthefirstplace.
The distribution problem becomes much more important when multiple
versions of a library exist, without the name of the library addon changing.
You take the risk that the user (or some other addon) will include an older
versionofa library yourelyon.
Embedded Libraries
An embedded library is onethat is includedin any addon that uses it, rather
than standalone asa separateaddon.A systemhas been developedthatuses
twopieces ofinformation toensurethesystemis robust:
Majorversion—A unique name that indicates the name and version of
thelibrary.Twolibrarieswithdifferentmajorversionswillrun alongside
each other.Forexample:AddonUtils-1.0orCommLib-2.0.
Minor version—A number that indicates the minor version of a given
library, with a higher value indicating a newer version. If two addons
have the same major version of a library but different minor versions,
the older one will be ‘‘upgraded’’ to the newer one using some defined
process.
Ingeneral,themajorversionshouldbeupdatedwheneverthereisachange
to the behavior of the underlying functions or any other change that is
not backward-compatible with previous versions. The minor version is only
incrementedwhen bugsarefixedorotherminorchangesaremade.
Embedded Library LoadProcess
Here’s the general process forloadingan embeddedlibrary:
1. Check to see if an instance ofthe library with the same majorversion is
alreadyloaded.
2. If the same major version already exists, compare the minor version
numbers.If the newlibrary being loadedhas a matching minorversion,
C# PDF: C# Code to Process PDF Document Page Using C#.NET PDF
delete or remove certain page from PDF document file. C# PDF Page Processing: Sort PDF Pages - online C#.NET tutorial page for how to reorder, sort, reorganize
reorder pages in pdf reader; reorder pdf pages in preview
Read PDF in Web Image Viewer| Online Tutorials
for image viewing to read, edit, create or write PDF documents from file or stream in Extract images from PDF documents; Add, reorder pages in PDF
rearrange pdf pages; reorder pages in pdf
AppendixB
Utilizing AddonLibraries 1333
or a lower minor version, the initialization process can safely return
immediately.
3. If a version exists but the minor version of the existing instance is less
than theonebeingloaded,thenthisinstanceshouldreplace(orupgrade)
the existinginstance withitself.
4. If the majorversion does notalready exist, the library should simply be
loaded.
Usingembeddedlibraries,multiplecopiesofthelibrarymaybeloadedand
thenthrownaway,which can increaseloadtimes.This wouldonlyhappenin
the situation where addons loaded in a specific order had increasing minor
versionsofthesamelibrary.Inaddition,thelibraryauthorneedstobesensitive
tothepotentialupgradeprocess,andshouldtestthelibrarythoroughlybefore
releasing aminorversionupdatetoalibrary.
Manually Versioning an Embedded Library
The code to manage the versioning of your library can be as simple as the
following:
local minor_version = 501
if MyLibraryName and minor_version < MyLibraryName.minor then
-- This version is old, so don’t load it
return
end
-- Library definition here
MyLibraryName = {}
function MyLibraryName.createDebugFunc(prefix)
return function(...)
local succ, message = pcall(string.format, ...)
if succ then
print(“|cffff1100“ .. prefix .. “: |r“, message)
else
print(“|cffff1100“ .. prefix .. “: |r“, tostringall(...))
end
end
end
end
Inthiscasethemajorversionnameis
MyLibraryName
,andtheminorversion
is
501
.The code first checks to see if the major version exists and, if it does,
compares the two minor versions. If the minor version being loaded is less
than theonethatalreadyexists,thecodereturns.
VB.NET TIFF: VB.NET Sample Code to Process & Manage TIFF Page
certain TIFF page, and sort & reorder TIFF pages in Process TIFF Pages Independently in VB.NET Code. powerful & profession imaging controls, PDF document, image
reverse page order pdf online; how to reorder pages in pdf preview
C# Word: How to Create Word Document Viewer in C#.NET Imaging
in C#.NET; Offer mature Word file page manipulation functions (add, delete & reorder pages) in document viewer; Rich options to add
how to reorder pdf pages in; pdf page order reverse
1334 Part V
Appendixes
Versioning Using LibStub
In late 2007 the addon community banded together to create a simple stan-
dard way to register and access libraries, called LibStub. LibStub has three
functions:
LibStub:NewLibrary(major, minor)
—Attemptstoregisteranewlibrary
withthegivenmajorandminorversions.Returnsatablethatcanbeused
tostore the library,or
nil
iftheversion beingregisteredisnotnew.
LibStub:GetLibrary(major [, silent])
—Tries toget the library with
the given major version. The
silent
flag can be used to test for the
existenceof alibrarywithout causing LibStubtoraisean error.
LibStub:IterateLibraries()
—Returns an iterator over all the regis-
teredlibraries.
Thefollowingshows how todefinethesamelibraryusingLibStub:
local major, minor = “MyLibraryName“, 1
local library = LibStub:NewLibrary(major, minor)
if not library then
-- This version is not new, so return
return
end
function library.createDebugFunc(prefix)
return function(...)
local succ, message = pcall(string.format, ...)
if succ then
print(“|cffff1100“ .. prefix .. “: |r“, message)
else
print(“|cffff1100“ .. prefix .. “: |r“, tostringall(...))
end
end
end
end
Thelibrarycan then beusedinthefollowingway:
local MyLibraryName = LibStub:GetLibrary(“MyLibraryName“)
local debug = MyLibraryName.createDebugFunc(“MyAddon“)
With LibStub, if you register a major version that already has an existing
version you will receive the previous table back. You can then clear it,
define new functions, or handle any other tasks that are necessary for your
addon.
For more information about how to write libraries using LibStub, visit
www.wowwiki.com/LibStub
.
AppendixB
Utilizing AddonLibraries 1335
Using a Library
Ratherthan tryingtogive full details on a set of existinglibraries,thissection
introduces youto several different categories of libraries, giving you general
informationaboutwhateachofthemdoes.
Ace3
TheAce3(
www.wowace.com/projects/ace3)
suiteoflibrarieswasdesignedto
be included as embedded libraries with minimal dependencies. This means
thatyoucan include only those libraries youwanttouseratherthan needing
toinclude theentiresuite.
Ace3includes libraries thatprovide thefollowingfunctionality:
AceAddon-3.0—An abstraction over addons that allow you to easily
disable and enable addons within the game without needing to reload
theuserinterface.Alsoprovides aframeworkformodularcomponents.
AceBucket-3.0—Groupsmultipleeventsinto‘‘buckets.’’Thisallowsyou
to watch for
UNIT_HEALTH
events, but only actually respond to them
periodicallyratherthan everytimean eventfires.
AceComm-3.0—A communications library that can handle arbitrarily
long messages.This library also throttles messages appropriately so the
senderis notdisconnected.
AceConfigCmd-3.0—Allowsyouto registeraslash commanddefinition
usinga table,andhaveaslash commandbuiltautomatically foryou.
AceConfigDialog-3.0—Generates a configuration GUI automatically
froma configurationtable.
AceDB-3.0—Manages saved variables for an addon,providingprofiles,
smart defaults, and custom portions of the database that are custom
loadedforeachcharacter.Thislibrary can be quite usefulifyou’dliketo
provideyouruserswiththeability toload/clone/saveaddonprofiles.
AceEvent-3.0—Allowsyoutoregisterforevents andhave customfunc-
tionscalledwhen aneventfires.Thislibraryismoreofaconveniencethat
avoidsyouhavingtocreateaframeandwriteacustom
OnEvent
handler.
AceHook-3.0—Library that allows you to hook and unhook functions
and scripts. Writing function hooks is not an easy endeavor and this
libraryhelpstoensure goodbehavior.
AceTime-3.0—Facilityforcreatingandregisteringtimers,socodecanbe
calledina delayedorrepeatingfashion.
Thesuite contains other,morespecial-purpose libraries.Formore informa-
tionvisit
www.wowace.com/projects/Ace3
.
1336 Part V
Appendixes
Portfolio
Portfolio(
www.wowinterface.com/downloads/info11749-Portfolio.html
)al-
lowsyoutocreateconfigurationscreensintheBlizzardInterfaceOptionsmenu
with relativeease.Itacceptsaverystraightforwardconfiguration tableformat
andwill automatically generateyourGUIforyou.
Dongle
Dongle (
www.wowwiki.com/Dongle
) is a collection of functions that should
be useful to anyone writing a new addon. Designed to be extremely small
without excess functionality, it provides an easy way to register events,
schedule tasks,and comes with a database system that makes creatingsaved
variablestructures withdefaults easy.
PeriodicTable
PeriodicTable (
www.wowace.com/projects/libperiodictable-3-1
) aims to
addorganization to itemsin Worldof Warcraft. It allows youto access them
via hierarchical sets (such as
Consumable.Food.Edible.Cheese
). This can be
useful when trying to figure out what categories an item might belong to,
in order to find out how best to use it. For example, it can help you identify
which common itemsareusedin tradeskills.
BossIDs
The BossIDs library (
www.wowace.com/projects/libbossids-1-0
) just con-
tains a list of all the mobs in the game thatare considered ‘‘bosses,’’ because
thereis no easy way to checkthis in-game. Youcan use the GUIDofthe mob
alongwith thislibrarytomakethatdetermination.
LibHealComm
LibHealComm (
www.wowace.com/projects/libhealcomm-3-0
) provides ev-
entsandcallbacksthatallowyoutogetmoreinformationaboutthespellsyour
partyandgroupmembers cast. Multipleusersmusthavethelibraryinstalled
to accomplish anything, but when the healers of a group have it installed it
makesitvery easytoseewho theyarehealingandatwhattime.
LibSharedMedia
LibSharedMedia (
www.wowace.com/projects/libsharedmedia-3-0
) is desi-
gned to provide a way to construct a library of media files (sounds, tex-
tures,fonts)andallowmultipleaddonstoaccessthem.In thisway,theaddon
AppendixB
Utilizing AddonLibraries 1337
developersimplyuses thelibrary ifitexiststoaccesstherepository ofmedia.
This allows users to select consistent graphics, fonts, and sounds depending
on theirwants andneeds.
Other Library Resources
Literally dozens of libraries have been written for any number of purposes,
and mostof themarewell documented andreadilyavailable.The bestplaces
toexplore forlibraries touseare thefollowing:
http://www.wowwiki.com/Function
Library
www.wowace.com/categories/libraries
www.wowinterface.com/downloads/cat53.html
Some of these libraries depend on other libraries (which can get quite
messy), but if you’re looking for a good existing API for something that you
findpeculiarintheBlizzardAPI,they mayjusthavewhatyou’relooking for.
Documents you may be interested
Documents you may be interested