version 6.30 0 Form1 1 3 0 0 0 2 0 0 3 0 0 0 0 0 0 0 0 6 0 0 238 268 1 WebBrowser.dll 1 WebBrowser.dll 1 web:WebBrowser Sub designer addform(Form1,"PPC Wiki","",220,220,220)@ addlabel(form1,Label2,5,190,230,70,"",220,220,220,0,0,0,False,False,9)@ addimagebutton(form1,ExitButton,185,5,40,30,"",212,208,200,0,0,0,"cCenterImage","logout.png",True,False,False,9)@ addtextbox(form1,TextBox3,5,45,230,140,"TextBox3",255,255,255,0,0,0,False,False,True,9)@ addimagebutton(form1,SaveButton,140,5,40,30,"",212,208,200,0,0,0,"cCenterImage","save.png",True,False,False,9)@ addimagebutton(form1,ConfigButton,100,5,40,30,"",212,208,200,0,0,0,"cCenterImage","settings.png",True,True,True,9)@ addimagebutton(form1,EditButton,50,5,40,30,"",212,208,200,0,0,0,"cCenterImage","edit.png",True,True,True,9)@ addimagebutton(form1,HomeButton,5,5,40,30,"",212,208,200,0,0,0,"cCenterImage","home.png",True,True,True,9)@ addtextbox(form1,TextBox1,5,235,230,22,"TextBox1",255,255,255,0,0,0,True,False,False,9)@ End Sub @EndOfDesignText@Sub Globals 'Declare the global variables here. programname="Personel Pocket PC Wiki" programversion="0.1.2" programplatform="Pocket PC" homepage="homepage.txt" currentpage="" ProgDir = "" End Sub Sub App_Start Form1.Show Textbox1.Text="" Textbox3.Text="" web.New1("Form1",5,45,230,210) ProgDir = AppPath & "\" web.DocumentText="

Pocket PC


Version " & programversion & "


" currentpage=homepage End Sub Sub Button1_Click 'web.Navigate(Textbox1.Text) web.GoBack ' web.url = Textbox1.Text 'either Navigate or assigning to Url will load the web page End Sub Sub ReadWikiFile(file) file = ProgDir & file If FileExist (file) = true Then FileOpen (c1, file, cRead ,, cASCII) wiki = FileReadToEnd(c1) FileClose (c1) Return ParseWiki(wiki) Else ' wiki file doesn't exist - how did that happen? End If End Sub Sub ParseWiki (wiki) tagBOLD=0 tagITALIC=0 tagSTRIKE=0 tagUNDERLINE=0 tagHEADING=0 'HTML Header HtmStr = "" & crlf HtmStr = HtmStr & "homepage" & crlf HtmStr = HtmStr & "" & crlf HtmStr = HtmStr & "" & crlf For x=0 To StrLength(wiki) schr=SubString(wiki,x,1) ' Msgbox(schr) ' --- CONVERT SIMPLE SINGLE CHARACTERS --- If schr=" " Then HtmStr=HtmStr & " " End If If schr=Chr(13) Then HtmStr=Htmstr & "
" End If ' --- CONVERT LINK --- Select schr Case "[" If SubString(wiki,x,2)="[[" Then ' this is reference with differnt text ie [[wiki][welcome to my wiki!]] y=StrIndexOf(wiki, "]", x) z=StrIndexOf(wiki, "]", y+1) 'Msgbox(SubString(wiki,x+2,y-x-2)) HtmStr=Htmstr & "" & SubString(wiki,y+2,z-y-2) & "" x=z+1 Else y=StrIndexOf(wiki, "]", x) HtmStr=Htmstr & "" & SubString(wiki,x+1,y-x-1) & "" ' Msgbox(SubString(wiki,x+1,y-x-1)) 'Msgbox(htmstr) x=y End If Case "+" '

Locks Wiki

If tagHeading = 0 Then If SubString(wiki,x,3)="+++" Then ' Heading level 3 h3 ' Check to see if its first characer on line If SubString(wiki,x-1,1) = Chr(10) AND SubString(wiki,x-2,1) = Chr(13) Then tagHeading=3 HtmStr = HtmStr & "

" x=x+2 End If Else If SubString(wiki,x,2)="++" Then ' Heading level 2 h2 ' Check to see if its first characer on line If SubString(wiki,x-1,1) = Chr(10) AND SubString(wiki,x-2,1) = Chr(13) Then tagHeading=2 HtmStr = HtmStr & "

" x=x+1 End If Else ' Must be heading level 1 "

Locks Wiki

" ' Check to see if its first characer on line If SubString(wiki,x-1,1) = Chr(10) AND SubString(wiki,x-2,1) = Chr(13) Then tagHeading=1 HtmStr = HtmStr & "

" End If End If End If Case "*" ' Bold If tagBOLD=0 Then HtmStr=HtmStr & "" tagBOLD=1 Else HtmStr=HtmStr & "" tagBOLD=0 End If Case "=" ' Italics If tagITALIC=0 Then HtmStr=HtmStr & "" tagITALIC=1 Else HtmStr=HtmStr & "" tagITALIC=0 End If Case "-" If tagSTRIKE=0 Then HtmStr=HtmStr & "" tagSTRIKE=1 Else HtmStr=HtmStr & "" tagSTRIKE=0 End If Case "_" 'check for additional underline: if so, this isn't. Its a horizontal line If SubString(wiki,x,3)="___" Then x=x+2 HtmStr=HtmStr & "
" Else If tagUNDERLINE=0 Then HtmStr=HtmStr & "" tagUNDERLINE=1 Else HtmStr=HtmStr & "" tagUNDERLINE=0 End If End If Case Chr(13) If tagHeading > 0 Then ' Id heading then make sure to close HtmStr = HtmStr & "
" If tagHeading = 1 Then ' close heading HtmStr = HtmStr & "

" Else If tagHeading = 2 Then ' close heading HtmStr = HtmStr & "

" Else If tagHeading = 3 Then ' close heading HtmStr = HtmStr & "" End If tagHeading = 0 End If Case Else HtmStr=HtmStr & schr End Select Next 'HTML FOOTER HtmStr=HtmStr & "" Return Htmstr End Sub Sub web_DocumentCompleted 'Msgbox("Completed", web.Url) 'Msgbox("web_completed") End Sub Sub web_Navigating If web.NavigatingURL = "about:blank" Then ' nothing - we are loading the default page Else 'Msgbox (web.NavigatingURL) currentpage=SubString(web.NavigatingURL,6, StrLength(web.NavigatingURL)-6) & ".txt" If FileExist (currentpage) = true Then ' do nothing Else ' create the file FileOpen (c1,currentpage,cWrite,,cASCII) FileWrite (c1,"[homepage]") FileClose (c1) End If x=ReadWikiFile(currentpage) web.DocumentText=x End If End Sub Sub web_Navigated ' Msgbox("web_Navigated") ' Msgbox("Navigated to" & crlf & web.Url) Textbox1.Text = web.Url End Sub Sub EditButton_Click label2.Enabled=true label2.Visible=true textbox3.Enabled=True textbox3.Visible=true SaveButton.Enabled=true SaveButton.Visible=true If FileExist (currentpage) = true Then FileOpen (c1,ProgDir & currentpage,cRead ,, cASCII) textbox3.Text=FileReadToEnd(c1) FileClose (c1) End If End Sub Sub SaveButton_Click 'If FileExist(ProgDir & currentpage) = true Then FileOpen (c1,ProgDir & currentpage,cWrite,,cASCII) FileWrite (c1,TextBox3.Text) FileClose (c1) 'End If label2.Enabled=false label2.Visible=false SaveButton.Enabled=false SaveButton.Visible=false textbox3.Enabled=false textbox3.Visible=false x=ReadWikiFile(currentpage) 'x=getFile(currentpage) web.DocumentText=x End Sub Sub HomeButton_Click x=ReadWikiFile(homepage) 'x=getFile(homepage) web.DocumentText=x End Sub