You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCF/Proxy/CFProxy Tests
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
EventHandler Sub ExpandRow(row As Integer)
dim v as Variant = me.RowTag(row)
if v isa Dictionary then
end if
End EventHandler
End Control
EventHandler Sub Open()
dim d as Dictionary = CFProxyMBS.SystemProxySettings
List.AddFolder "SystemProxySettings"
List.RowTag(List.LastIndex) = d
dim d1() as Dictionary = CFProxyMBS.ProxiesForURL("ftp://www.hello.de")
List.AddFolder "ProxiesForURL"
List.RowTag(List.LastIndex) = d1
p = new proxy
// read a proxy file
dim f as FolderItem = FindFile("proxy.pac")
if f.Exists then
dim b as BinaryStream = BinaryStream.Open(f)
dim data as string = b.Read(b.Length, Encodings.utf8)
dim e as CFErrorMBS
dim d2() as Dictionary = CFProxyMBS.ProxiesForAutoConfigurationScript(data, "ftp://www.hello.de", e)
List.AddFolder "ProxiesForAutoConfigurationScript"
List.RowTag(List.LastIndex) = d2
if p.ExecuteProxyAutoConfigurationScript(data, "ftp://www.hello.de") then
System.DebugLog "ExecuteProxyAutoConfigurationScript started."
end if
end if
if p.ExecuteProxyAutoConfigurationURL("http://www.monkeybreadsoftware.de/proxy.pac", "ftp://www.hello.de") then
System.DebugLog "ExecuteProxyAutoConfigurationURL started."
end if
End EventHandler
Function FindFile(name as string) As FolderItem
// Look for file in parent folders from executable on
dim parent as FolderItem = app.ExecutableFile.Parent
while parent<>Nil
dim file as FolderItem = parent.Child(name)
if file<>Nil and file.Exists then
Return file
end if
parent = parent.Parent
wend
End Function
Property p As proxy
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
Class Proxy Inherits CFProxyMBS
EventHandler Sub AutoConfigurationResult(error as CFErrorMBS, proxyList() as Dictionary)
System.DebugLog CurrentMethodName
End EventHandler
End Class