rhodes 2.3.2 → 2.4.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +18 -0
- data/CREDITS +38 -0
- data/README.md +2 -2
- data/Rakefile +60 -2
- data/bin/set-rhodes-sdk.bat +1 -0
- data/doc/application.txt +11 -0
- data/doc/build.txt +156 -39
- data/doc/configuration.txt +1 -10
- data/doc/connect-to-web-services.txt +6 -6
- data/doc/device-caps.txt +48 -5
- data/doc/extensions.txt +8 -1
- data/doc/rhom.txt +16 -0
- data/doc/synchronization.txt +56 -14
- data/doc/ui.txt +23 -2
- data/installer/instant-rhodes.nsi +6 -6
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Barcode.xcodeproj/project.pbxproj +4 -2
- data/lib/extensions/barcode/ext/barcode/platform/wm/Rakefile +1 -1
- data/lib/extensions/digest-md5/ext/Rakefile +3 -3
- data/lib/extensions/digest-md5/ext/build +0 -1
- data/lib/extensions/digest-sha1/ext/Rakefile +1 -1
- data/lib/extensions/digest-sha1/ext/build +0 -1
- data/lib/extensions/digest/ext/Rakefile +3 -3
- data/lib/extensions/digest/ext/build +0 -1
- data/lib/extensions/fcntl/ext/Rakefile +1 -1
- data/lib/extensions/mspec/mspec/guards/guard.rb +4 -0
- data/lib/extensions/mspec/mspec/helpers/environment.rb +4 -0
- data/lib/extensions/nfc/ext.yml +2 -0
- data/lib/extensions/nfc/ext/build +12 -0
- data/lib/extensions/nfc/ext/build.bat +8 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/AndroidManifest.xml +25 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/Rakefile +94 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/ext_build.files +4 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/jni/src/nfc.cpp +404 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/nfc/Nfc.java +138 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/nfc/NfcMessage.java +34 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/nfc/NfcMessagePack.java +33 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/nfc/NfcRecord.java +149 -0
- data/lib/extensions/nfc/ext/nfc/shared/ruby/nfc.i +22 -0
- data/lib/extensions/nfc/ext/nfc/shared/ruby/nfc_wrap.c +2034 -0
- data/lib/extensions/nfc/nfc.rb +120 -0
- data/lib/extensions/rholang/{lang_ca.rb → rholang/lang_ca.rb} +0 -0
- data/lib/extensions/rholang/{lang_cf.rb → rholang/lang_cf.rb} +0 -0
- data/lib/extensions/rholang/{lang_chef.rb → rholang/lang_chef.rb} +0 -0
- data/lib/extensions/rholang/{lang_cs.rb → rholang/lang_cs.rb} +0 -0
- data/lib/extensions/rholang/{lang_da.rb → rholang/lang_da.rb} +0 -0
- data/lib/extensions/rholang/{lang_de.rb → rholang/lang_de.rb} +0 -0
- data/lib/extensions/rholang/{lang_es.rb → rholang/lang_es.rb} +0 -0
- data/lib/extensions/rholang/{lang_es_ar.rb → rholang/lang_es_ar.rb} +0 -0
- data/lib/extensions/rholang/{lang_fi.rb → rholang/lang_fi.rb} +0 -0
- data/lib/extensions/rholang/{lang_fr.rb → rholang/lang_fr.rb} +0 -0
- data/lib/extensions/rholang/{lang_it.rb → rholang/lang_it.rb} +0 -0
- data/lib/extensions/rholang/{lang_ko.rb → rholang/lang_ko.rb} +0 -0
- data/lib/extensions/rholang/{lang_nl.rb → rholang/lang_nl.rb} +0 -0
- data/lib/extensions/rholang/{lang_no.rb → rholang/lang_no.rb} +0 -0
- data/lib/extensions/rholang/{lang_pt.rb → rholang/lang_pt.rb} +0 -0
- data/lib/extensions/rholang/{lang_pt_br.rb → rholang/lang_pt_br.rb} +0 -0
- data/lib/extensions/rholang/{lang_ru.rb → rholang/lang_ru.rb} +0 -0
- data/lib/extensions/rholang/{lang_se.rb → rholang/lang_se.rb} +0 -0
- data/lib/extensions/rholang/{lang_sr.rb → rholang/lang_sr.rb} +0 -0
- data/lib/extensions/rholang/{rhoerror_ru.rb → rholang/rhoerror_ru.rb} +0 -0
- data/lib/extensions/rholang/{rhomsg_ru.rb → rholang/rhomsg_ru.rb} +0 -0
- data/lib/framework/date/format.rb +2 -0
- data/lib/framework/dateOrig.rb +17 -8
- data/lib/framework/rational18.rb +532 -0
- data/lib/framework/res/back_btn.wp7.png +0 -0
- data/lib/framework/res/blue_pushpin.wp7.png +0 -0
- data/lib/framework/res/blue_pushpin_small.wp7.png +0 -0
- data/lib/framework/res/callout.wp7.png +0 -0
- data/lib/framework/res/callout_link.wp7.png +0 -0
- data/lib/framework/res/esri.wp7.png +0 -0
- data/lib/framework/res/forward_btn.wp7.png +0 -0
- data/lib/framework/res/home_btn.wp7.png +0 -0
- data/lib/framework/res/options_btn.wp7.png +0 -0
- data/lib/framework/res/refresh_btn.wp7.png +0 -0
- data/lib/framework/rho/render.rb +8 -1
- data/lib/framework/rho/rho.rb +30 -7
- data/lib/framework/rho/rhoapplication.rb +9 -4
- data/lib/framework/rho/rhofsconnector.rb +5 -1
- data/lib/framework/rho/rhotabbar.rb +8 -0
- data/lib/framework/rho/rhotoolbar.rb +1 -1
- data/lib/framework/rho/rhoviewhelpers.rb +18 -1
- data/lib/framework/rhodes.rb +1 -1
- data/lib/framework/rhoframework.rb +46 -1
- data/lib/framework/rholang/localization_simplified.rb +17 -16
- data/lib/framework/rhom/rhom_db_adapter.rb +2 -2
- data/lib/framework/rhom/rhom_object_factory.rb +115 -12
- data/lib/framework/rhosystem.rb +135 -0
- data/lib/framework/version.rb +1 -1
- data/lib/rhodes.rb +1 -1
- data/lib/test/apps/rhoconfig.txt +23 -23
- data/platform/android/Rhodes/AndroidManifest.full.xml +101 -0
- data/platform/android/Rhodes/AndroidManifest.xml +10 -15
- data/platform/android/Rhodes/default.properties +11 -0
- data/platform/android/Rhodes/gen/com/rhomobile/rhodes/R.java +59 -53
- data/platform/android/Rhodes/jni/include/rhodes.h +1 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesApplication.h +21 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_alert_PopupActivity.h +21 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_file_RhoFileApi.h +10 -2
- data/platform/android/Rhodes/jni/src/alert.cpp +2 -1
- data/platform/android/Rhodes/jni/src/datetimepicker.cpp +2 -0
- data/platform/android/Rhodes/jni/src/fileapi.cpp +671 -84
- data/platform/android/Rhodes/jni/src/nativebar.cpp +18 -0
- data/platform/android/Rhodes/jni/src/rhodes.cpp +92 -1
- data/platform/android/Rhodes/res/values/styles.xml +7 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +35 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +12 -13
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/LocalFileProvider.java +130 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/NativeBar.java +6 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushReceiver.java +5 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushService.java +6 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoMenu.java +7 -36
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +43 -20
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +2 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +63 -28
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Utils.java +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/WebView.java +6 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +19 -282
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/PopupActivity.java +354 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/datetime/DateTimePickerScreen.java +4 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +1 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/file/RhoFileApi.java +71 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +107 -37
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +10 -7
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +156 -56
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MapView.java +0 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorNew.java +40 -32
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/SignatureView.java +1 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/ExternalHttpHandler.java +14 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/LocalFileHandler.java +46 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/MailUriHandler.java +4 -24
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/UriHandler.java +3 -1
- data/platform/android/build/RhodesSRC_build.files +28 -25
- data/platform/android/build/android.rake +230 -54
- data/platform/android/build/androidcommon.rb +1 -1
- data/platform/android/build/librhocommon_build.files +1 -0
- data/platform/bb/Hsqldb/BlackBerry_App_Descriptor.xml +20 -0
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBResult.java +1 -5
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBStorage.java +6 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/rowio/RowOutputBase.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/rowio/RowOutputBinary.java +1 -1
- data/platform/bb/RubyVM/BlackBerry_App_Descriptor.xml +20 -0
- data/platform/bb/RubyVM/src/com/rho/IRhoRubyHelper.java +2 -0
- data/platform/bb/RubyVM/src/com/rho/RhoLogOutputSink.java +0 -1
- data/platform/bb/RubyVM/src/com/rho/RhoLogger.java +12 -10
- data/platform/bb/RubyVM/src/com/rho/RhoThread.java +16 -0
- data/platform/bb/RubyVM/src/com/rho/RhoTimer.java +89 -0
- data/platform/bb/RubyVM/src/com/rho/RhodesApp.java +20 -13
- data/platform/bb/RubyVM/src/com/rho/SplashScreen.java +1 -2
- data/platform/bb/RubyVM/src/com/rho/ThreadQueue.java +2 -2
- data/platform/bb/RubyVM/src/com/rho/TimeInterval.java +5 -0
- data/platform/bb/RubyVM/src/com/rho/db/DBAdapter.java +54 -48
- data/platform/bb/RubyVM/src/com/rho/db/IDBResult.java +0 -1
- data/platform/bb/RubyVM/src/com/rho/db/IDBStorage.java +1 -0
- data/platform/bb/RubyVM/src/com/rho/net/AsyncHttp.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/sync/ClientRegister.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +16 -8
- data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +2 -2
- data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +52 -29
- data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +1 -3
- data/platform/bb/build/RubyVM_build.files +1 -0
- data/platform/bb/build/bb.rake +29 -9
- data/platform/bb/rhodes/BlackBerry_App_Descriptor.xml +23 -0
- data/platform/bb/rhodes/platform/5.0/com/rho/RhodesApplicationPlatform.java +1 -1
- data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteCopyResult.java +0 -4
- data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteResult.java +13 -20
- data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteStorage.java +183 -157
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +22 -0
- data/platform/bb/rhodes/src/com/rho/RhodesApplicationPlatform.java +1 -1
- data/platform/bb/rhodes/src/com/rho/db/SqliteCopyResult.java +0 -4
- data/platform/bb/rhodes/src/com/rho/db/SqliteResult.java +13 -20
- data/platform/bb/rhodes/src/com/rho/db/SqliteStorage.java +183 -157
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +46 -1
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +8 -1
- data/platform/bb/rhodes/src/rhomobile/camera/CameraFilesListener.java +13 -3
- data/platform/iphone/Classes/AppManager/AppManager.h +5 -1
- data/platform/iphone/Classes/AppManager/AppManager.m +170 -7
- data/platform/iphone/Classes/DateTimePicker.m +14 -1
- data/platform/iphone/Classes/DateTimePickerDelegate.h +2 -0
- data/platform/iphone/Classes/DateTimePickerDelegate.m +36 -2
- data/platform/iphone/Classes/NativeBar.h +1 -0
- data/platform/iphone/Classes/NativeBar.m +15 -3
- data/platform/iphone/Classes/Phonebook/phonebook.m +8 -9
- data/platform/iphone/Classes/Rhodes.m +50 -6
- data/platform/iphone/Classes/SimpleMainView.m +7 -6
- data/platform/iphone/Classes/SplitView/RightViewController.h +3 -1
- data/platform/iphone/Classes/SplitView/RightViewController.m +14 -1
- data/platform/iphone/Classes/TabbedMainView.h +4 -0
- data/platform/iphone/Classes/TabbedMainView.m +43 -26
- data/platform/iphone/Info.plist +1 -1
- data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +4 -0
- data/platform/iphone/curl/curl.xcodeproj/project.pbxproj +3 -3
- data/platform/iphone/rbuild/iphone.rake +168 -119
- data/platform/iphone/rhoextlib/rhoextlib.xcodeproj/project.pbxproj +4 -2
- data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +3 -3
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +2 -2
- data/platform/iphone/rhosynclib/rhosynclib.xcodeproj/project.pbxproj +3 -3
- data/platform/shared/SyncClient/SyncClient.cpp +20 -8
- data/platform/shared/SyncClient/SyncClient.h +2 -1
- data/platform/shared/common/RhoDefs.h +4 -0
- data/platform/shared/common/RhoPort.h +22 -0
- data/platform/shared/common/RhoStd.h +5 -0
- data/platform/shared/common/RhoTime.cpp +73 -0
- data/platform/shared/common/RhoTime.h +26 -53
- data/platform/shared/common/RhodesApp.cpp +29 -28
- data/platform/shared/common/RhodesApp.h +4 -1
- data/platform/shared/common/StringConverter.h +37 -10
- data/platform/shared/common/app_build_capabilities.h +2 -0
- data/platform/shared/common/rhoparams.cpp +25 -12
- data/platform/shared/common/rhoparams.h +10 -8
- data/platform/shared/db/DBAdapter.cpp +0 -22
- data/platform/shared/json/RJSONTokener.c +15 -23
- data/platform/shared/net/AsyncHttp.cpp +9 -8
- data/platform/shared/net/HttpServer.cpp +61 -19
- data/platform/shared/net/HttpServer.h +2 -0
- data/platform/shared/ruby/ext/datetimepicker/datetimepicker.i +3 -0
- data/platform/shared/ruby/ext/datetimepicker/datetimepicker_wrap.c +151 -402
- data/platform/shared/ruby/ext/nativebar/nativebar.i +3 -0
- data/platform/shared/ruby/ext/nativebar/nativebar_wrap.c +154 -403
- data/platform/shared/ruby/ext/rho/rhoruby.c +4 -0
- data/platform/shared/ruby/ext/rho/rhoruby.h +2 -0
- data/platform/shared/ruby/ext/system/system.i +8 -0
- data/platform/shared/ruby/ext/system/system_wrap.c +80 -5
- data/platform/shared/ruby/file.c +6 -4
- data/platform/shared/ruby/gc.c +1 -1
- data/platform/shared/ruby/linux/ruby/config.h +7 -2
- data/platform/shared/ruby/missing/acosh.c +3 -3
- data/platform/shared/ruby/wince/_time.h +1 -1
- data/platform/shared/ruby/wince/stdlib.c +1 -1
- data/platform/shared/ruby/wince/string_wce.c +2 -2
- data/platform/shared/ruby/wince/sys/timeb.c +1 -0
- data/platform/shared/ruby/wince/time_wce.c +8 -0
- data/platform/shared/ruby/wince/wince.c +7 -7
- data/platform/shared/ruby/wince/wince.h +22 -0
- data/platform/shared/rubyext/System.cpp +19 -1
- data/platform/shared/sqlite/sqlite3.c +18993 -8129
- data/platform/shared/sqlite/sqlite3.h +953 -358
- data/platform/shared/sqlite/sqlite3ext.h +42 -0
- data/platform/shared/sync/SyncEngine.cpp +10 -0
- data/platform/shared/sync/SyncSource.cpp +41 -19
- data/platform/shared/sync/SyncSource.h +1 -1
- data/platform/shared/tcmalloc/rhomem.h +7 -2
- data/platform/shared/tcmalloc/windows/port.h +2 -0
- data/platform/shared/unzip/unzip.cpp +1 -0
- data/platform/shared/xruby/src/com/xruby/compiler/parser/RubyParser.java +11 -1
- data/platform/wm/RhoLib/RhoLib.vcproj +182 -24
- data/platform/wm/build/wm.rake +16 -3
- data/platform/wm/rhodes.sln +106 -113
- data/platform/wm/rhodes/Alert.cpp +6 -7
- data/platform/wm/rhodes/AppManager.cpp +8 -17
- data/platform/wm/rhodes/DateTimePicker.cpp +3 -0
- data/platform/wm/rhodes/DateTimePicker.h +2 -0
- data/platform/wm/rhodes/MainWindow.cpp +36 -16
- data/platform/wm/rhodes/MainWindow.h +6 -3
- data/platform/wm/rhodes/OutlookApp.cpp +3 -3
- data/platform/wm/rhodes/Rhodes.cpp +46 -27
- data/platform/wm/rhodes/Rhodes.rc +16 -3
- data/platform/wm/rhodes/RingtoneManager.cpp +7 -7
- data/platform/wm/rhodes/RingtoneManager.h +1 -1
- data/platform/wm/rhodes/Utils.cpp +2 -1
- data/platform/wm/rhodes/bluetooth/Bluetooth.cpp +1 -13
- data/platform/wm/rhodes/bluetooth/Bluetooth.h +1 -2
- data/platform/wm/rhodes/camera/Camera.cpp +6 -12
- data/platform/wm/rhodes/phonebook/phonebook.cpp +11 -11
- data/platform/wm/rhodes/phonebook/phonebook.h +1 -1
- data/platform/wm/rhodes/resource.h +3 -1
- data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +7 -5
- data/platform/wm/rhodes/rho/rubyext/GeoLocationImpl.cpp +6 -6
- data/platform/wm/rhodes/rho/rubyext/GeoLocationImpl.h +1 -1
- data/platform/wm/rhodes/rho/rubyext/NativeToolbar.cpp +6 -1
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +84 -19
- data/platform/wm/rhodes/rho/rubyext/calendar.cpp +2 -2
- data/platform/wm/rhodes/rhodes.vcproj +316 -73
- data/platform/wm/rhodes/signature/Signature.cpp +336 -6
- data/platform/wm/rhodes/signature/Signature.h +55 -0
- data/platform/wm/rhodes/stdafx.h +7 -4
- data/platform/wm/rubylib/rubylib.vcproj +261 -91
- data/platform/wm/sqlite3/sqlite3.vcproj +223 -69
- data/platform/wm/syncengine/syncengine.vcproj +220 -66
- data/platform/wm/tcmalloc/tcmalloc.vcproj +197 -43
- data/platform/wp7/IronRuby/Languages/Ruby/Ruby/Builtins/ConsoleStream.cs +107 -0
- data/platform/wp7/IronRuby/Languages/Ruby/Ruby/Runtime/Loader.cs +1037 -0
- data/platform/wp7/IronRuby/Languages/Ruby/Ruby/Runtime/RubyUtils.cs +1476 -0
- data/platform/wp7/RhoAppRunner/Program.cs +55 -0
- data/platform/wp7/RhoAppRunner/Properties/AssemblyInfo.cs +36 -0
- data/platform/wp7/RhoAppRunner/RhoAppRunner.csproj +69 -0
- data/platform/wp7/RhoRubyExtGen/GenerateInitializers.cmd +7 -0
- data/platform/wp7/RhoRubyExtGen/Properties/AssemblyInfo.cs +36 -0
- data/platform/wp7/RhoRubyExtGen/RhoAsyncHttp.cs +38 -0
- data/platform/wp7/RhoRubyExtGen/RhoDatabase.cs +93 -0
- data/platform/wp7/RhoRubyExtGen/RhoJSON.cs +37 -0
- data/platform/wp7/RhoRubyExtGen/RhoNativeBar.cs +106 -0
- data/platform/wp7/RhoRubyExtGen/RhoRubyExtGen.csproj +75 -0
- data/platform/wp7/RhoRubyExtGen/RhoSyncEngine.cs +123 -0
- data/platform/wp7/RhoRubyExtGen/RhoWebView.cs +42 -0
- data/platform/wp7/RhoRubyLib/Initializers.Generated.cs +309 -0
- data/platform/wp7/RhoRubyLib/Properties/AssemblyInfo.cs +36 -0
- data/platform/wp7/RhoRubyLib/RhoAppAdapter.cs +96 -0
- data/platform/wp7/RhoRubyLib/RhoRuby.cs +296 -0
- data/platform/wp7/RhoRubyLib/RhoRubyLib.csproj +155 -0
- data/platform/wp7/RhoRubyLib/WP_PlatformAdaptationLayer.cs +107 -0
- data/platform/wp7/RhoRubyLib/common/IInputStream.cs +21 -0
- data/platform/wp7/RhoRubyLib/common/Mutex.cs +30 -0
- data/platform/wp7/RhoRubyLib/common/RhoConf.cs +389 -0
- data/platform/wp7/RhoRubyLib/common/RhoEmptyProfiler.cs +27 -0
- data/platform/wp7/RhoRubyLib/common/RhoFile.cs +332 -0
- data/platform/wp7/RhoRubyLib/common/RhoFilePath.cs +89 -0
- data/platform/wp7/RhoRubyLib/common/RhoParamArray.cs +33 -0
- data/platform/wp7/RhoRubyLib/common/RhoParams.cs +66 -0
- data/platform/wp7/RhoRubyLib/common/RhoProfiler.cs +145 -0
- data/platform/wp7/RhoRubyLib/common/RhoResourceMap.cs +68 -0
- data/platform/wp7/RhoRubyLib/common/RhoStd.cs +205 -0
- data/platform/wp7/RhoRubyLib/common/RhoThread.cs +114 -0
- data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +504 -0
- data/platform/wp7/RhoRubyLib/common/ThreadQueue.cs +199 -0
- data/platform/wp7/RhoRubyLib/common/TimeInterval.cs +56 -0
- data/platform/wp7/RhoRubyLib/common/Tokenizer.cs +52 -0
- data/platform/wp7/RhoRubyLib/db/DBAdapter.cs +1129 -0
- data/platform/wp7/RhoRubyLib/db/DBAttrManager.cs +92 -0
- data/platform/wp7/RhoRubyLib/db/DBException.cs +35 -0
- data/platform/wp7/RhoRubyLib/db/IDBCallback.cs +10 -0
- data/platform/wp7/RhoRubyLib/db/IDBResult.cs +33 -0
- data/platform/wp7/RhoRubyLib/db/IDBStorage.cs +32 -0
- data/platform/wp7/RhoRubyLib/db/SqliteCopyResult.cs +79 -0
- data/platform/wp7/RhoRubyLib/db/SqliteResult.cs +267 -0
- data/platform/wp7/RhoRubyLib/db/SqliteStorage.cs +319 -0
- data/platform/wp7/RhoRubyLib/json/JSONArrayIterator.cs +63 -0
- data/platform/wp7/RhoRubyLib/json/JSONEntry.cs +96 -0
- data/platform/wp7/RhoRubyLib/json/JSONStructIterator.cs +77 -0
- data/platform/wp7/RhoRubyLib/json/JsonParser.cs +483 -0
- data/platform/wp7/RhoRubyLib/json/RJSONTokener.cs +406 -0
- data/platform/wp7/RhoRubyLib/logging/IRhoLogSink.cs +12 -0
- data/platform/wp7/RhoRubyLib/logging/RhoLogConf.cs +161 -0
- data/platform/wp7/RhoRubyLib/logging/RhoLogFileSink.cs +174 -0
- data/platform/wp7/RhoRubyLib/logging/RhoLogger.cs +320 -0
- data/platform/wp7/RhoRubyLib/net/AsyncHttp.cs +362 -0
- data/platform/wp7/RhoRubyLib/net/HttpServer.cs +466 -0
- data/platform/wp7/RhoRubyLib/net/NetRequest.cs +717 -0
- data/platform/wp7/RhoRubyLib/net/NetResponse.cs +64 -0
- data/platform/wp7/RhoRubyLib/net/URI.cs +187 -0
- data/platform/wp7/RhoRubyLib/rubyext/RhoAsyncHttp.cs +43 -0
- data/platform/wp7/RhoRubyLib/rubyext/RhoDatabase.cs +177 -0
- data/platform/wp7/RhoRubyLib/rubyext/RhoJSON.cs +39 -0
- data/platform/wp7/RhoRubyLib/rubyext/RhoKernelOps.cs +19 -0
- data/platform/wp7/RhoRubyLib/rubyext/RhoNativeBar.cs +117 -0
- data/platform/wp7/RhoRubyLib/rubyext/RhoSyncEngine.cs +199 -0
- data/platform/wp7/RhoRubyLib/rubyext/RhoWebView.cs +49 -0
- data/platform/wp7/RhoRubyLib/sync/ClientRegister.cs +142 -0
- data/platform/wp7/RhoRubyLib/sync/ISyncProtocol.cs +23 -0
- data/platform/wp7/RhoRubyLib/sync/ISyncStatusListener.cs +10 -0
- data/platform/wp7/RhoRubyLib/sync/SyncEngine.cs +1051 -0
- data/platform/wp7/RhoRubyLib/sync/SyncNotify.cs +651 -0
- data/platform/wp7/RhoRubyLib/sync/SyncProtocol_3.cs +79 -0
- data/platform/wp7/RhoRubyLib/sync/SyncSource.cs +1105 -0
- data/platform/wp7/RhoRubyLib/sync/SyncThread.cs +301 -0
- data/platform/wp7/WPApplication.sln +50 -0
- data/platform/wp7/WPApplication/App.xaml +19 -0
- data/platform/wp7/WPApplication/App.xaml.cs +211 -0
- data/platform/wp7/WPApplication/ApplicationIcon.png +0 -0
- data/platform/wp7/WPApplication/Background.png +0 -0
- data/platform/wp7/WPApplication/MainPage.xaml +44 -0
- data/platform/wp7/WPApplication/MainPage.xaml.cs +132 -0
- data/platform/wp7/WPApplication/Properties/AppManifest.xml +6 -0
- data/platform/wp7/WPApplication/Properties/AssemblyInfo.cs +35 -0
- data/platform/wp7/WPApplication/Properties/WMAppManifest.xml +32 -0
- data/platform/wp7/WPApplication/SplashScreenImage.jpg +0 -0
- data/platform/wp7/WPApplication/WPApplication.csproj +201 -0
- data/platform/wp7/WPApplication/WP_PlatformAdaptationLayer.cs +88 -0
- data/platform/wp7/WPApplication/app_manifest.txt +1 -0
- data/platform/wp7/WPApplication/readme.htm +40 -0
- data/platform/wp7/WPApplication/readme2.htm +37 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/edit.bb.erb +29 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/edit.erb +32 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/index.bb.erb +21 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/index.erb +26 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/model1.rb +10 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/model1_controller.rb +58 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/new.bb.erb +29 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/new.erb +31 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/show.bb.erb +26 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/show.erb +28 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/controller.rb +75 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/home.bb.erb +17 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/home.erb +20 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/index.bb.erb +32 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/index.erb +30 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/login.bb.erb +35 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/login.erb +27 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/reset.bb.erb +15 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/reset.erb +17 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/wait.bb.erb +3 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/wait.erb +5 -0
- data/platform/wp7/WPApplication/rho/apps/app/application.rb +16 -0
- data/platform/wp7/WPApplication/rho/apps/app/helpers/application_helper.rb +126 -0
- data/platform/wp7/WPApplication/rho/apps/app/helpers/browser_helper.rb +18 -0
- data/platform/wp7/WPApplication/rho/apps/app/index.bb.erb +26 -0
- data/platform/wp7/WPApplication/rho/apps/app/index.erb +26 -0
- data/platform/wp7/WPApplication/rho/apps/app/layout.erb +45 -0
- data/platform/wp7/WPApplication/rho/apps/app/loading.html +11 -0
- data/platform/wp7/WPApplication/rho/apps/app_manifest.txt +1 -0
- data/platform/wp7/WPApplication/rho/apps/public/css/android.css +330 -0
- data/platform/wp7/WPApplication/rho/apps/public/css/blackberry.css +115 -0
- data/platform/wp7/WPApplication/rho/apps/public/css/iphone.css +410 -0
- data/platform/wp7/WPApplication/rho/apps/public/css/windows_mobile.css +222 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/IUI_LICENSE.txt +21 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/android/btn_check_off.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/android/btn_check_on.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/android/btn_radio_off.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/android/btn_radio_on.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/android/disclosure.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/android/ic_menu_more.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/backButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/blueButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/cancel.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/grayButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/disclosure.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/disclosure_detail.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/backButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/blueButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/cancel.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/chevron.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/grayButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/listArrowSel.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/listGroup.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/loading.gif +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/on_off.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/pinstripes.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/selection.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/thumb.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/toggle.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/toggleOn.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/toolButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/toolbar.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/whiteButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/radiobutton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/select.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/switch.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iui-logo-touch-icon.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/listArrow.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/listArrowDown.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/listArrowSel.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/listGroup.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/loading.gif +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/pinstripes.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/right_button.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/selection.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/thumb.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/toggle.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/toggleOn.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/toolButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/toolButton_new.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/toolbar.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/whiteButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/jqtouch/jqtouch-iphone.css +9 -0
- data/platform/wp7/WPApplication/rho/apps/public/jqtouch/jqtouch.css +374 -0
- data/platform/wp7/WPApplication/rho/apps/public/jqtouch/jqtouch.js +742 -0
- data/platform/wp7/WPApplication/rho/apps/public/jqtouch/jqtouch.transitions.js +60 -0
- data/platform/wp7/WPApplication/rho/apps/public/jqtouch/jquery.1.3.2.min.js +19 -0
- data/platform/wp7/WPApplication/rho/apps/public/js/application.js +1 -0
- data/platform/wp7/WPApplication/rho/apps/public/js/rho.js +4 -0
- data/platform/wp7/WPApplication/rho/apps/public/js/rhogeolocation-wm.js +59 -0
- data/platform/wp7/WPApplication/rho/apps/public/js/rhogeolocation.js +11 -0
- data/platform/wp7/WPApplication/rho/apps/rhoconfig.txt +32 -0
- data/platform/wp7/WPApplication/rhoconfig.txt +32 -0
- data/platform/wp7/WPApplication/windows_mobile.css +222 -0
- data/platform/wp7/build/wp.rake +261 -0
- data/platform/wp7/rhodes.sln +79 -0
- data/platform/wp7/rhodes/App.xaml +19 -0
- data/platform/wp7/rhodes/App.xaml.cs +144 -0
- data/platform/wp7/rhodes/Background.png +0 -0
- data/platform/wp7/rhodes/MainPage.xaml +44 -0
- data/platform/wp7/rhodes/MainPage.xaml.cs +98 -0
- data/platform/wp7/rhodes/Properties/AppManifest.xml +6 -0
- data/platform/wp7/rhodes/Properties/AssemblyInfo.cs +35 -0
- data/platform/wp7/rhodes/Properties/WMAppManifest.xml +31 -0
- data/platform/wp7/rhodes/Rhodes.csproj +127 -0
- data/platform/wp7/rhodes/SplashScreenImage.jpg +0 -0
- data/platform/wp7/rhodes/icon.png +0 -0
- data/platform/wp7/sqlite3/Properties/AssemblyInfo.cs +35 -0
- data/platform/wp7/sqlite3/SQLiteClient.cs +550 -0
- data/platform/wp7/sqlite3/SqliteWrapper/BtreeInt_h.cs +774 -0
- data/platform/wp7/sqlite3/SqliteWrapper/Btree_h.cs +280 -0
- data/platform/wp7/sqlite3/SqliteWrapper/ClassDiagram1.cd +1306 -0
- data/platform/wp7/sqlite3/SqliteWrapper/Delagates.cs +365 -0
- data/platform/wp7/sqlite3/SqliteWrapper/Hash_h.cs +133 -0
- data/platform/wp7/sqlite3/SqliteWrapper/VdbeInt_h.cs +620 -0
- data/platform/wp7/sqlite3/SqliteWrapper/Vdbe_h.cs +302 -0
- data/platform/wp7/sqlite3/SqliteWrapper/_Custom.cs +449 -0
- data/platform/wp7/sqlite3/SqliteWrapper/alter_c.cs +872 -0
- data/platform/wp7/sqlite3/SqliteWrapper/analyze_c.cs +757 -0
- data/platform/wp7/sqlite3/SqliteWrapper/attach_c.cs +628 -0
- data/platform/wp7/sqlite3/SqliteWrapper/auth_c.cs +268 -0
- data/platform/wp7/sqlite3/SqliteWrapper/backup_c.cs +737 -0
- data/platform/wp7/sqlite3/SqliteWrapper/bitvec_c.cs +509 -0
- data/platform/wp7/sqlite3/SqliteWrapper/btmutex_c.cs +379 -0
- data/platform/wp7/sqlite3/SqliteWrapper/btree_c.cs +9138 -0
- data/platform/wp7/sqlite3/SqliteWrapper/build_c.cs +4189 -0
- data/platform/wp7/sqlite3/SqliteWrapper/callback_c.cs +548 -0
- data/platform/wp7/sqlite3/SqliteWrapper/complete_c.cs +342 -0
- data/platform/wp7/sqlite3/SqliteWrapper/ctime_cs.cs +408 -0
- data/platform/wp7/sqlite3/SqliteWrapper/date_c.cs +1317 -0
- data/platform/wp7/sqlite3/SqliteWrapper/delete_c.cs +726 -0
- data/platform/wp7/sqlite3/SqliteWrapper/expr_c.cs +4406 -0
- data/platform/wp7/sqlite3/SqliteWrapper/fault_c.cs +115 -0
- data/platform/wp7/sqlite3/SqliteWrapper/fkey_c.cs +1330 -0
- data/platform/wp7/sqlite3/SqliteWrapper/func_c.cs +2025 -0
- data/platform/wp7/sqlite3/SqliteWrapper/global_c.cs +228 -0
- data/platform/wp7/sqlite3/SqliteWrapper/hash_c.cs +351 -0
- data/platform/wp7/sqlite3/SqliteWrapper/hwtime_c.cs +101 -0
- data/platform/wp7/sqlite3/SqliteWrapper/insert_c.cs +2122 -0
- data/platform/wp7/sqlite3/SqliteWrapper/journal_c.cs +247 -0
- data/platform/wp7/sqlite3/SqliteWrapper/keywordhash_h.cs +302 -0
- data/platform/wp7/sqlite3/SqliteWrapper/legacy_c.cs +223 -0
- data/platform/wp7/sqlite3/SqliteWrapper/loadext_c.cs +683 -0
- data/platform/wp7/sqlite3/SqliteWrapper/main_c.cs +2716 -0
- data/platform/wp7/sqlite3/SqliteWrapper/malloc_c.cs +977 -0
- data/platform/wp7/sqlite3/SqliteWrapper/mem_Pool.cs +394 -0
- data/platform/wp7/sqlite3/SqliteWrapper/memjournal_c.cs +315 -0
- data/platform/wp7/sqlite3/SqliteWrapper/mutex_c.cs +182 -0
- data/platform/wp7/sqlite3/SqliteWrapper/mutex_h.cs +91 -0
- data/platform/wp7/sqlite3/SqliteWrapper/mutex_noop_c.cs +202 -0
- data/platform/wp7/sqlite3/SqliteWrapper/mutex_w32.cs +344 -0
- data/platform/wp7/sqlite3/SqliteWrapper/notify_c.cs +347 -0
- data/platform/wp7/sqlite3/SqliteWrapper/opcodes_c.cs +171 -0
- data/platform/wp7/sqlite3/SqliteWrapper/opcodes_h.cs +346 -0
- data/platform/wp7/sqlite3/SqliteWrapper/os_c.cs +367 -0
- data/platform/wp7/sqlite3/SqliteWrapper/os_common_h.cs +174 -0
- data/platform/wp7/sqlite3/SqliteWrapper/os_h.cs +295 -0
- data/platform/wp7/sqlite3/SqliteWrapper/os_win_c.cs +1255 -0
- data/platform/wp7/sqlite3/SqliteWrapper/pager_c.cs +6078 -0
- data/platform/wp7/sqlite3/SqliteWrapper/pager_h.cs +188 -0
- data/platform/wp7/sqlite3/SqliteWrapper/parse_c.cs +4045 -0
- data/platform/wp7/sqlite3/SqliteWrapper/parse_h.cs +331 -0
- data/platform/wp7/sqlite3/SqliteWrapper/pcache1_c.cs +969 -0
- data/platform/wp7/sqlite3/SqliteWrapper/pcache_c.cs +712 -0
- data/platform/wp7/sqlite3/SqliteWrapper/pcache_h.cs +213 -0
- data/platform/wp7/sqlite3/SqliteWrapper/pragma_c.cs +1767 -0
- data/platform/wp7/sqlite3/SqliteWrapper/prepare_c.cs +1015 -0
- data/platform/wp7/sqlite3/SqliteWrapper/printf_c.cs +1300 -0
- data/platform/wp7/sqlite3/SqliteWrapper/random_c.cs +201 -0
- data/platform/wp7/sqlite3/SqliteWrapper/resolve_c.cs +1396 -0
- data/platform/wp7/sqlite3/SqliteWrapper/rowset_c.cs +519 -0
- data/platform/wp7/sqlite3/SqliteWrapper/select_c.cs +4878 -0
- data/platform/wp7/sqlite3/SqliteWrapper/sqlite3_h.cs +6253 -0
- data/platform/wp7/sqlite3/SqliteWrapper/sqlite3ext_h.cs +397 -0
- data/platform/wp7/sqlite3/SqliteWrapper/sqliteInt_h.cs +4075 -0
- data/platform/wp7/sqlite3/SqliteWrapper/sqliteLimit_h.cs +214 -0
- data/platform/wp7/sqlite3/SqliteWrapper/sqliteicu_h.cs +39 -0
- data/platform/wp7/sqlite3/SqliteWrapper/status_c.cs +155 -0
- data/platform/wp7/sqlite3/SqliteWrapper/table_c.cs +222 -0
- data/platform/wp7/sqlite3/SqliteWrapper/tokenize_c.cs +673 -0
- data/platform/wp7/sqlite3/SqliteWrapper/trigger_c.cs +1219 -0
- data/platform/wp7/sqlite3/SqliteWrapper/update_c.cs +766 -0
- data/platform/wp7/sqlite3/SqliteWrapper/utf_c.cs +612 -0
- data/platform/wp7/sqlite3/SqliteWrapper/util_c.cs +1476 -0
- data/platform/wp7/sqlite3/SqliteWrapper/vacuum_c.cs +382 -0
- data/platform/wp7/sqlite3/SqliteWrapper/vdbe_c.cs +6566 -0
- data/platform/wp7/sqlite3/SqliteWrapper/vdbeapi_c.cs +1557 -0
- data/platform/wp7/sqlite3/SqliteWrapper/vdbeaux_c.cs +4019 -0
- data/platform/wp7/sqlite3/SqliteWrapper/vdbeblob_c.cs +396 -0
- data/platform/wp7/sqlite3/SqliteWrapper/vdbemem_c.cs +1480 -0
- data/platform/wp7/sqlite3/SqliteWrapper/vdbetrace_c.cs +181 -0
- data/platform/wp7/sqlite3/SqliteWrapper/vtab_c.cs +957 -0
- data/platform/wp7/sqlite3/SqliteWrapper/walker_c.cs +174 -0
- data/platform/wp7/sqlite3/SqliteWrapper/where_c.cs +4651 -0
- data/platform/wp7/sqlite3/sqlite3.csproj +155 -0
- data/rakefile.rb +60 -2
- data/res/build-tools/7za.exe +0 -0
- data/res/build-tools/RhoAppRunner.exe +0 -0
- data/res/build-tools/xruby-0.3.3.jar +0 -0
- data/res/generators/rhogen.rb +9 -1
- data/res/generators/templates/application/app/Settings/reset.erb +1 -1
- data/res/generators/templates/application/app/layout.erb +17 -10
- data/res/generators/templates/application/build.yml +5 -3
- data/res/generators/templates/application/public/jqtouch/changes.txt +20 -0
- data/res/generators/templates/application/public/jqtouch/jqtouch.js +12 -4
- data/res/generators/templates/application/public/jqtouch/jquery.1.3.2.min.js +1 -1
- data/res/generators/templates/application/public/js/wp7.js +7 -0
- data/res/generators/templates/model/controller.rb +5 -6
- data/rhobuild.yml.example +1 -0
- data/rhodes.gemspec +2 -1
- data/spec/framework_spec/app/spec/core/dir/close_spec.rb +1 -1
- data/spec/framework_spec/app/spec/core/dir/shared/pwd.rb +13 -11
- data/spec/framework_spec/app/spec/core/env/shared/store.rb +12 -10
- data/spec/framework_spec/app/spec/core/env/update_spec.rb +1 -0
- data/spec/framework_spec/app/spec/core/file/expand_path_spec.rb +3 -2
- data/spec/framework_spec/app/spec/core/file/fixtures/file_types.rb +7 -1
- data/spec/framework_spec/app/spec/core/file/flock_spec.rb +8 -1
- data/spec/framework_spec/app/spec/core/file/ftype_spec.rb +5 -3
- data/spec/framework_spec/app/spec/core/file/lchmod_spec.rb +1 -1
- data/spec/framework_spec/app/spec/core/file/setgid_spec.rb +1 -1
- data/spec/framework_spec/app/spec/core/file/setuid_spec.rb +1 -1
- data/spec/framework_spec/app/spec/core/file/stat/ftype_spec.rb +6 -4
- data/spec/framework_spec/app/spec/core/file/truncate_spec.rb +5 -1
- data/spec/framework_spec/app/spec/core/float/to_s_spec.rb +1 -1
- data/spec/framework_spec/app/spec/core/process/gid_spec.rb +5 -3
- data/spec/framework_spec/app/spec/core/process/groups_spec.rb +11 -9
- data/spec/framework_spec/app/spec/core/process/uid_spec.rb +5 -3
- data/spec/framework_spec/app/spec/language/execution_spec.rb +10 -6
- data/spec/framework_spec/app/spec/shared/file/directory.rb +6 -1
- data/spec/framework_spec/app/spec/shared/file/executable.rb +7 -1
- data/spec/framework_spec/app/spec/shared/file/file.rb +6 -1
- data/spec/framework_spec/app/spec/shared/file/readable.rb +13 -4
- data/spec/framework_spec/app/spec/shared/file/writable.rb +6 -1
- data/spec/phone_spec/app/spec/rho_controller_spec.rb +11 -0
- data/spec/phone_spec/app/spec/rho_spec.rb +11 -0
- data/spec/phone_spec/app/spec/rhom_object_spec.rb +102 -6
- data/spec/phone_spec/app/spec/string/end_with_spec.rb +4 -1
- data/spec/phone_spec/app/spec/string/slice_spec.rb +5 -1
- data/spec/phone_spec/app/spec/string/start_with_spec.rb +4 -0
- data/spec/phone_spec/app/spec/syncengine_spec.rb +73 -6
- data/spec/phone_spec/app/spec_runner.rb +7 -3
- metadata +380 -41
- data/Manifest.txt +0 -5819
- data/platform/bb/Hsqldb/Hsqldb.cso +0 -5
- data/platform/bb/Hsqldb/Hsqldb.jdp +0 -197
- data/platform/bb/RhoBundle/RhoBundle.cso +0 -5
- data/platform/bb/RhoBundle/RhoBundle.jdp +0 -42
- data/platform/bb/RubyVM/RubyVM.cso +0 -5
- data/platform/bb/RubyVM/RubyVM.jdp +0 -467
- data/platform/bb/rhodes/rhodes.csl +0 -3
- data/platform/bb/rhodes/rhodes.cso +0 -5
- data/platform/bb/rhodes/rhodes.jdp +0 -104
@@ -0,0 +1,295 @@
|
|
1
|
+
#define SQLITE_OS_WIN
|
2
|
+
using u32 = System.UInt32;
|
3
|
+
|
4
|
+
namespace Community.CsharpSqlite
|
5
|
+
{
|
6
|
+
public partial class Sqlite3
|
7
|
+
{
|
8
|
+
/*
|
9
|
+
** 2001 September 16
|
10
|
+
**
|
11
|
+
** The author disclaims copyright to this source code. In place of
|
12
|
+
** a legal notice, here is a blessing:
|
13
|
+
**
|
14
|
+
** May you do good and not evil.
|
15
|
+
** May you find forgiveness for yourself and forgive others.
|
16
|
+
** May you share freely, never taking more than you give.
|
17
|
+
**
|
18
|
+
******************************************************************************
|
19
|
+
**
|
20
|
+
** This header file (together with is companion C source-code file
|
21
|
+
** "os.c") attempt to abstract the underlying operating system so that
|
22
|
+
** the SQLite library will work on both POSIX and windows systems.
|
23
|
+
**
|
24
|
+
** This header file is #include-ed by sqliteInt.h and thus ends up
|
25
|
+
** being included by every source file.
|
26
|
+
*************************************************************************
|
27
|
+
** Included in SQLite3 port to C#-SQLite; 2008 Noah B Hart
|
28
|
+
** C#-SQLite is an independent reimplementation of the SQLite software library
|
29
|
+
**
|
30
|
+
** SQLITE_SOURCE_ID: 2009-12-07 16:39:13 1ed88e9d01e9eda5cbc622e7614277f29bcc551c
|
31
|
+
**
|
32
|
+
** $Header$
|
33
|
+
*************************************************************************
|
34
|
+
*/
|
35
|
+
#if !_SQLITE_OS_H_
|
36
|
+
//#define _SQLITE_OS_H_
|
37
|
+
|
38
|
+
/*
|
39
|
+
** Figure out if we are dealing with Unix, Windows, or some other
|
40
|
+
** operating system. After the following block of preprocess macros,
|
41
|
+
** all of SQLITE_OS_UNIX, SQLITE_OS_WIN, SQLITE_OS_OS2, and SQLITE_OS_OTHER
|
42
|
+
** will defined to either 1 or 0. One of the four will be 1. The other
|
43
|
+
** three will be 0.
|
44
|
+
*/
|
45
|
+
//#if defined(SQLITE_OS_OTHER)
|
46
|
+
//# if SQLITE_OS_OTHER==1
|
47
|
+
//# undef SQLITE_OS_UNIX
|
48
|
+
//# define SQLITE_OS_UNIX 0
|
49
|
+
//# undef SQLITE_OS_WIN
|
50
|
+
//# define SQLITE_OS_WIN 0
|
51
|
+
//# undef SQLITE_OS_OS2
|
52
|
+
//# define SQLITE_OS_OS2 0
|
53
|
+
//# else
|
54
|
+
//# undef SQLITE_OS_OTHER
|
55
|
+
//# endif
|
56
|
+
//#endif
|
57
|
+
//#if !(SQLITE_OS_UNIX) && !SQLITE_OS_OTHER)
|
58
|
+
//# define SQLITE_OS_OTHER 0
|
59
|
+
//# ifndef SQLITE_OS_WIN
|
60
|
+
//# if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BORLANDC__)
|
61
|
+
//# define SQLITE_OS_WIN 1
|
62
|
+
//# define SQLITE_OS_UNIX 0
|
63
|
+
//# define SQLITE_OS_OS2 0
|
64
|
+
//# elif defined(__EMX__) || defined(_OS2) || defined(OS2) || defined(_OS2_) || defined(__OS2__)
|
65
|
+
//# define SQLITE_OS_WIN 0
|
66
|
+
//# define SQLITE_OS_UNIX 0
|
67
|
+
//# define SQLITE_OS_OS2 1
|
68
|
+
//# else
|
69
|
+
//# define SQLITE_OS_WIN 0
|
70
|
+
//# define SQLITE_OS_UNIX 1
|
71
|
+
//# define SQLITE_OS_OS2 0
|
72
|
+
//# endif
|
73
|
+
//# else
|
74
|
+
//# define SQLITE_OS_UNIX 0
|
75
|
+
//# define SQLITE_OS_OS2 0
|
76
|
+
//# endif
|
77
|
+
//#else
|
78
|
+
//# ifndef SQLITE_OS_WIN
|
79
|
+
//# define SQLITE_OS_WIN 0
|
80
|
+
//# endif
|
81
|
+
//#endif
|
82
|
+
|
83
|
+
const bool SQLITE_OS_WIN = true;
|
84
|
+
const bool SQLITE_OS_UNIX = false;
|
85
|
+
const bool SQLITE_OS_OS2 = false;
|
86
|
+
|
87
|
+
/*
|
88
|
+
** Determine if we are dealing with WindowsCE - which has a much
|
89
|
+
** reduced API.
|
90
|
+
*/
|
91
|
+
//#if defined(_WIN32_WCE)
|
92
|
+
//# define SQLITE_OS_WINCE 1
|
93
|
+
//#else
|
94
|
+
//# define SQLITE_OS_WINCE 0
|
95
|
+
//#endif
|
96
|
+
|
97
|
+
/*
|
98
|
+
** Define the maximum size of a temporary filename
|
99
|
+
*/
|
100
|
+
#if SQLITE_OS_WIN
|
101
|
+
//# include <windows.h>
|
102
|
+
const int MAX_PATH = 260;
|
103
|
+
const int SQLITE_TEMPNAME_SIZE = ( MAX_PATH + 50 ); //# define SQLITE_TEMPNAME_SIZE (MAX_PATH+50)
|
104
|
+
#elif SQLITE_OS_OS2
|
105
|
+
# if FALSE //(__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >= 3) && OS2_HIGH_MEMORY)
|
106
|
+
//# include <os2safe.h> /* has to be included before os2.h for linking to work */
|
107
|
+
# endif
|
108
|
+
//# define INCL_DOSDATETIME
|
109
|
+
//# define INCL_DOSFILEMGR
|
110
|
+
//# define INCL_DOSERRORS
|
111
|
+
//# define INCL_DOSMISC
|
112
|
+
//# define INCL_DOSPROCESS
|
113
|
+
//# define INCL_DOSMODULEMGR
|
114
|
+
//# define INCL_DOSSEMAPHORES
|
115
|
+
//# include <os2.h>
|
116
|
+
//# include <uconv.h>
|
117
|
+
//# define SQLITE_TEMPNAME_SIZE (CCHMAXPATHCOMP)
|
118
|
+
//#else
|
119
|
+
//# define SQLITE_TEMPNAME_SIZE 200
|
120
|
+
#endif
|
121
|
+
|
122
|
+
/* If the SET_FULLSYNC macro is not defined above, then make it
|
123
|
+
** a no-op
|
124
|
+
*/
|
125
|
+
//#if !SET_FULLSYNC
|
126
|
+
//# define SET_FULLSYNC(x,y)
|
127
|
+
//#endif
|
128
|
+
|
129
|
+
/*
|
130
|
+
** The default size of a disk sector
|
131
|
+
*/
|
132
|
+
#if !SQLITE_DEFAULT_SECTOR_SIZE
|
133
|
+
const int SQLITE_DEFAULT_SECTOR_SIZE = 512;//# define SQLITE_DEFAULT_SECTOR_SIZE 512
|
134
|
+
#endif
|
135
|
+
|
136
|
+
/*
|
137
|
+
** Temporary files are named starting with this prefix followed by 16 random
|
138
|
+
** alphanumeric characters, and no file extension. They are stored in the
|
139
|
+
** OS's standard temporary file directory, and are deleted prior to exit.
|
140
|
+
** If sqlite is being embedded in another program, you may wish to change the
|
141
|
+
** prefix to reflect your program's name, so that if your program exits
|
142
|
+
** prematurely, old temporary files can be easily identified. This can be done
|
143
|
+
** using -DSQLITE_TEMP_FILE_PREFIX=myprefix_ on the compiler command line.
|
144
|
+
**
|
145
|
+
** 2006-10-31: The default prefix used to be "sqlite_". But then
|
146
|
+
** Mcafee started using SQLite in their anti-virus product and it
|
147
|
+
** started putting files with the "sqlite" name in the c:/temp folder.
|
148
|
+
** This annoyed many windows users. Those users would then do a
|
149
|
+
** Google search for "sqlite", find the telephone numbers of the
|
150
|
+
** developers and call to wake them up at night and complain.
|
151
|
+
** For this reason, the default name prefix is changed to be "sqlite"
|
152
|
+
** spelled backwards. So the temp files are still identified, but
|
153
|
+
** anybody smart enough to figure out the code is also likely smart
|
154
|
+
** enough to know that calling the developer will not help get rid
|
155
|
+
** of the file.
|
156
|
+
*/
|
157
|
+
#if !SQLITE_TEMP_FILE_PREFIX
|
158
|
+
const string SQLITE_TEMP_FILE_PREFIX = "etilqs_"; //# define SQLITE_TEMP_FILE_PREFIX "etilqs_"
|
159
|
+
#endif
|
160
|
+
|
161
|
+
/*
|
162
|
+
** The following values may be passed as the second argument to
|
163
|
+
** sqlite3OsLock(). The various locks exhibit the following semantics:
|
164
|
+
**
|
165
|
+
** SHARED: Any number of processes may hold a SHARED lock simultaneously.
|
166
|
+
** RESERVED: A single process may hold a RESERVED lock on a file at
|
167
|
+
** any time. Other processes may hold and obtain new SHARED locks.
|
168
|
+
** PENDING: A single process may hold a PENDING lock on a file at
|
169
|
+
** any one time. Existing SHARED locks may persist, but no new
|
170
|
+
** SHARED locks may be obtained by other processes.
|
171
|
+
** EXCLUSIVE: An EXCLUSIVE lock precludes all other locks.
|
172
|
+
**
|
173
|
+
** PENDING_LOCK may not be passed directly to sqlite3OsLock(). Instead, a
|
174
|
+
** process that requests an EXCLUSIVE lock may actually obtain a PENDING
|
175
|
+
** lock. This can be upgraded to an EXCLUSIVE lock by a subsequent call to
|
176
|
+
** sqlite3OsLock().
|
177
|
+
*/
|
178
|
+
const int NO_LOCK = 0;
|
179
|
+
const int SHARED_LOCK = 1;
|
180
|
+
const int RESERVED_LOCK = 2;
|
181
|
+
const int PENDING_LOCK = 3;
|
182
|
+
const int EXCLUSIVE_LOCK = 4;
|
183
|
+
|
184
|
+
/*
|
185
|
+
** File Locking Notes: (Mostly about windows but also some info for Unix)
|
186
|
+
**
|
187
|
+
** We cannot use LockFileEx() or UnlockFileEx() on Win95/98/ME because
|
188
|
+
** those functions are not available. So we use only LockFile() and
|
189
|
+
** UnlockFile().
|
190
|
+
**
|
191
|
+
** LockFile() prevents not just writing but also reading by other processes.
|
192
|
+
** A SHARED_LOCK is obtained by locking a single randomly-chosen
|
193
|
+
** byte out of a specific range of bytes. The lock byte is obtained at
|
194
|
+
** random so two separate readers can probably access the file at the
|
195
|
+
** same time, unless they are unlucky and choose the same lock byte.
|
196
|
+
** An EXCLUSIVE_LOCK is obtained by locking all bytes in the range.
|
197
|
+
** There can only be one writer. A RESERVED_LOCK is obtained by locking
|
198
|
+
** a single byte of the file that is designated as the reserved lock byte.
|
199
|
+
** A PENDING_LOCK is obtained by locking a designated byte different from
|
200
|
+
** the RESERVED_LOCK byte.
|
201
|
+
**
|
202
|
+
** On WinNT/2K/XP systems, LockFileEx() and UnlockFileEx() are available,
|
203
|
+
** which means we can use reader/writer locks. When reader/writer locks
|
204
|
+
** are used, the lock is placed on the same range of bytes that is used
|
205
|
+
** for probabilistic locking in Win95/98/ME. Hence, the locking scheme
|
206
|
+
** will support two or more Win95 readers or two or more WinNT readers.
|
207
|
+
** But a single Win95 reader will lock out all WinNT readers and a single
|
208
|
+
** WinNT reader will lock out all other Win95 readers.
|
209
|
+
**
|
210
|
+
** The following #defines specify the range of bytes used for locking.
|
211
|
+
** SHARED_SIZE is the number of bytes available in the pool from which
|
212
|
+
** a random byte is selected for a shared lock. The pool of bytes for
|
213
|
+
** shared locks begins at SHARED_FIRST.
|
214
|
+
**
|
215
|
+
** The same locking strategy and
|
216
|
+
** byte ranges are used for Unix. This leaves open the possiblity of having
|
217
|
+
** clients on win95, winNT, and unix all talking to the same shared file
|
218
|
+
** and all locking correctly. To do so would require that samba (or whatever
|
219
|
+
** tool is being used for file sharing) implements locks correctly between
|
220
|
+
** windows and unix. I'm guessing that isn't likely to happen, but by
|
221
|
+
** using the same locking range we are at least open to the possibility.
|
222
|
+
**
|
223
|
+
** Locking in windows is manditory. For this reason, we cannot store
|
224
|
+
** actual data in the bytes used for locking. The pager never allocates
|
225
|
+
** the pages involved in locking therefore. SHARED_SIZE is selected so
|
226
|
+
** that all locks will fit on a single page even at the minimum page size.
|
227
|
+
** PENDING_BYTE defines the beginning of the locks. By default PENDING_BYTE
|
228
|
+
** is set high so that we don't have to allocate an unused page except
|
229
|
+
** for very large databases. But one should test the page skipping logic
|
230
|
+
** by setting PENDING_BYTE low and running the entire regression suite.
|
231
|
+
**
|
232
|
+
** Changing the value of PENDING_BYTE results in a subtly incompatible
|
233
|
+
** file format. Depending on how it is changed, you might not notice
|
234
|
+
** the incompatibility right away, even running a full regression test.
|
235
|
+
** The default location of PENDING_BYTE is the first byte past the
|
236
|
+
** 1GB boundary.
|
237
|
+
**
|
238
|
+
*/
|
239
|
+
static int PENDING_BYTE = 0x40000000; //sqlite3PendingByte;
|
240
|
+
|
241
|
+
static int RESERVED_BYTE = ( PENDING_BYTE + 1 );
|
242
|
+
static int SHARED_FIRST = ( PENDING_BYTE + 2 );
|
243
|
+
static int SHARED_SIZE = 510;
|
244
|
+
|
245
|
+
/*
|
246
|
+
** Wrapper around OS specific sqlite3_os_init() function.
|
247
|
+
*/
|
248
|
+
//int sqlite3OsInit(void);
|
249
|
+
|
250
|
+
/*
|
251
|
+
** Functions for accessing sqlite3_file methods
|
252
|
+
*/
|
253
|
+
//int sqlite3OsClose(sqlite3_file*);
|
254
|
+
//int sqlite3OsRead(sqlite3_file*, void*, int amt, i64 offset);
|
255
|
+
//int sqlite3OsWrite(sqlite3_file*, const void*, int amt, i64 offset);
|
256
|
+
//int sqlite3OsTruncate(sqlite3_file*, i64 size);
|
257
|
+
//int sqlite3OsSync(sqlite3_file*, int);
|
258
|
+
//int sqlite3OsFileSize(sqlite3_file*, i64 pSize);
|
259
|
+
//int sqlite3OsLock(sqlite3_file*, int);
|
260
|
+
//int sqlite3OsUnlock(sqlite3_file*, int);
|
261
|
+
//int sqlite3OsCheckReservedLock(sqlite3_file *id, int pResOut);
|
262
|
+
//int sqlite3OsFileControl(sqlite3_file*,int,void*);
|
263
|
+
//#define SQLITE_FCNTL_DB_UNCHANGED 0xca093fa0
|
264
|
+
const u32 SQLITE_FCNTL_DB_UNCHANGED = 0xca093fa0;
|
265
|
+
|
266
|
+
//int sqlite3OsSectorSize(sqlite3_file *id);
|
267
|
+
//int sqlite3OsDeviceCharacteristics(sqlite3_file *id);
|
268
|
+
|
269
|
+
/*
|
270
|
+
** Functions for accessing sqlite3_vfs methods
|
271
|
+
*/
|
272
|
+
//int sqlite3OsOpen(sqlite3_vfs *, const char *, sqlite3_file*, int, int *);
|
273
|
+
//int sqlite3OsDelete(sqlite3_vfs *, const char *, int);
|
274
|
+
//int sqlite3OsAccess(sqlite3_vfs *, const char *, int, int pResOut);
|
275
|
+
//int sqlite3OsFullPathname(sqlite3_vfs *, const char *, int, char *);
|
276
|
+
#if !SQLITE_OMIT_LOAD_EXTENSION
|
277
|
+
//void *sqlite3OsDlOpen(sqlite3_vfs *, const char *);
|
278
|
+
//void sqlite3OsDlError(sqlite3_vfs *, int, char *);
|
279
|
+
//void (*sqlite3OsDlSym(sqlite3_vfs *, void *, const char *))(void);
|
280
|
+
//void sqlite3OsDlClose(sqlite3_vfs *, void *);
|
281
|
+
#endif
|
282
|
+
//int sqlite3OsRandomness(sqlite3_vfs *, int, char *);
|
283
|
+
//int sqlite3OsSleep(sqlite3_vfs *, int);
|
284
|
+
//int sqlite3OsCurrentTime(sqlite3_vfs *, double*);
|
285
|
+
|
286
|
+
/*
|
287
|
+
** Convenience functions for opening and closing files using
|
288
|
+
** sqlite3Malloc() to obtain space for the file-handle structure.
|
289
|
+
*/
|
290
|
+
//int sqlite3OsOpenMalloc(sqlite3_vfs *, const char *, sqlite3_file **, int,int*);
|
291
|
+
//int sqlite3OsCloseFree(sqlite3_file *);
|
292
|
+
#endif // * _SQLITE_OS_H_ */
|
293
|
+
|
294
|
+
}
|
295
|
+
}
|
@@ -0,0 +1,1255 @@
|
|
1
|
+
#define SQLITE_OS_WIN
|
2
|
+
|
3
|
+
using System;
|
4
|
+
using System.Diagnostics;
|
5
|
+
using System.IO;
|
6
|
+
using System.Runtime.InteropServices;
|
7
|
+
using System.Text;
|
8
|
+
using System.Threading;
|
9
|
+
using DWORD = System.UInt64;
|
10
|
+
using HANDLE = System.IntPtr;
|
11
|
+
using i64 = System.Int64;
|
12
|
+
using sqlite3_int64 = System.Int64;
|
13
|
+
using u32 = System.UInt32;
|
14
|
+
using u8 = System.Byte;
|
15
|
+
using System.IO.IsolatedStorage;
|
16
|
+
|
17
|
+
|
18
|
+
namespace Community.CsharpSqlite
|
19
|
+
{
|
20
|
+
public partial class Sqlite3
|
21
|
+
{
|
22
|
+
/*
|
23
|
+
** 2004 May 22
|
24
|
+
**
|
25
|
+
** The author disclaims copyright to this source code. In place of
|
26
|
+
** a legal notice, here is a blessing:
|
27
|
+
**
|
28
|
+
** May you do good and not evil.
|
29
|
+
** May you find forgiveness for yourself and forgive others.
|
30
|
+
** May you share freely, never taking more than you give.
|
31
|
+
**
|
32
|
+
******************************************************************************
|
33
|
+
**
|
34
|
+
** This file contains code that is specific to windows.
|
35
|
+
*************************************************************************
|
36
|
+
** Included in SQLite3 port to C#-SQLite; 2008 Noah B Hart
|
37
|
+
** C#-SQLite is an independent reimplementation of the SQLite software library
|
38
|
+
**
|
39
|
+
** SQLITE_SOURCE_ID: 2010-03-09 19:31:43 4ae453ea7be69018d8c16eb8dabe05617397dc4d
|
40
|
+
**
|
41
|
+
** $Header: Community.CsharpSqlite/src/os_win_c.cs,v 6604176a7dbe 2010/03/12 23:35:36 Noah $
|
42
|
+
*************************************************************************
|
43
|
+
*/
|
44
|
+
|
45
|
+
const int INVALID_FILE_ATTRIBUTES = -1;
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
private static LockingStrategy lockingStrategy = HelperMethods.IsRunningMediumTrust() ? new MediumTrustLockingStrategy() : new LockingStrategy();
|
50
|
+
|
51
|
+
public static IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication();
|
52
|
+
|
53
|
+
public partial class sqlite3_file
|
54
|
+
{
|
55
|
+
// public HANDLE h; /* Handle for accessing the file */
|
56
|
+
public int locktype; /* Type of lock currently held on this file */
|
57
|
+
public int sharedLockByte; /* Randomly chosen byte used as a shared lock */
|
58
|
+
public DWORD lastErrno; /* The Windows errno from the last I/O error */
|
59
|
+
public DWORD sectorSize; /* Sector size of the device file is on */
|
60
|
+
|
61
|
+
public IsolatedStorageFileStream fs = null;
|
62
|
+
|
63
|
+
public void Clear()
|
64
|
+
{
|
65
|
+
pMethods = null;
|
66
|
+
//fs = null;
|
67
|
+
locktype = 0;
|
68
|
+
sharedLockByte = 0;
|
69
|
+
lastErrno = 0;
|
70
|
+
sectorSize = 0;
|
71
|
+
}
|
72
|
+
};
|
73
|
+
|
74
|
+
static int sqlite3_os_type = 0;
|
75
|
+
|
76
|
+
|
77
|
+
/*
|
78
|
+
** Return true (non-zero) if we are running under WinNT, Win2K, WinXP,
|
79
|
+
** or WinCE. Return false (zero) for Win95, Win98, or WinME.
|
80
|
+
**
|
81
|
+
** Here is an interesting observation: Win95, Win98, and WinME lack
|
82
|
+
** the LockFileEx() API. But we can still statically link against that
|
83
|
+
** API as long as we don't call it when running Win95/98/ME. A call to
|
84
|
+
** this routine is used to determine if the host is Win95/98/ME or
|
85
|
+
** WinNT/2K/XP so that we will know whether or not we can safely call
|
86
|
+
** the LockFileEx() API.
|
87
|
+
*/
|
88
|
+
|
89
|
+
static bool isNT()
|
90
|
+
{
|
91
|
+
return Environment.OSVersion.Platform >= PlatformID.Win32NT;
|
92
|
+
}
|
93
|
+
|
94
|
+
private static bool ExistsFile(string sFilename)
|
95
|
+
{
|
96
|
+
return store.FileExists(sFilename);
|
97
|
+
}
|
98
|
+
|
99
|
+
private static void DeleteFile(string sFilename)
|
100
|
+
{
|
101
|
+
store.DeleteFile(sFilename);
|
102
|
+
}
|
103
|
+
|
104
|
+
/*
|
105
|
+
** Close a file.
|
106
|
+
**
|
107
|
+
** It is reported that an attempt to close a handle might sometimes
|
108
|
+
** fail. This is a very unreasonable result, but windows is notorious
|
109
|
+
** for being unreasonable so I do not doubt that it might happen. If
|
110
|
+
** the close fails, we pause for 100 milliseconds and try again. As
|
111
|
+
** many as MX_CLOSE_ATTEMPT attempts to close the handle are made before
|
112
|
+
** giving up and returning an error.
|
113
|
+
*/
|
114
|
+
public static int MX_CLOSE_ATTEMPT = 3;
|
115
|
+
static int winClose( sqlite3_file id )
|
116
|
+
{
|
117
|
+
bool rc;
|
118
|
+
int cnt = 0;
|
119
|
+
//sqlite3_file pFile = (sqlite3_file)id;
|
120
|
+
|
121
|
+
Debug.Assert( id != null );
|
122
|
+
do
|
123
|
+
{
|
124
|
+
if (id.fs != null)
|
125
|
+
{
|
126
|
+
id.fs.Close();
|
127
|
+
id.fs = null;
|
128
|
+
}
|
129
|
+
rc = true;
|
130
|
+
// rc = CloseHandle(pFile.h);
|
131
|
+
// if (!rc && ++cnt < MX_CLOSE_ATTEMPT) Thread.Sleep(100); //, 1) );
|
132
|
+
} while ( !rc && ++cnt < MX_CLOSE_ATTEMPT ); //, 1) );
|
133
|
+
return rc ? SQLITE_OK : SQLITE_IOERR;
|
134
|
+
}
|
135
|
+
|
136
|
+
/*
|
137
|
+
** Some microsoft compilers lack this definition.
|
138
|
+
*/
|
139
|
+
#if !INVALID_SET_FILE_POINTER
|
140
|
+
const int INVALID_SET_FILE_POINTER = -1;
|
141
|
+
#endif
|
142
|
+
|
143
|
+
/*
|
144
|
+
** Read data from a file into a buffer. Return SQLITE_OK if all
|
145
|
+
** bytes were read successfully and SQLITE_IOERR if anything goes
|
146
|
+
** wrong.
|
147
|
+
*/
|
148
|
+
static int winRead(
|
149
|
+
sqlite3_file id, /* File to read from */
|
150
|
+
byte[] pBuf, /* Write content into this buffer */
|
151
|
+
int amt, /* Number of bytes to read */
|
152
|
+
sqlite3_int64 offset /* Begin reading at this offset */
|
153
|
+
)
|
154
|
+
{
|
155
|
+
long rc;
|
156
|
+
// sqlite3_file pFile = id;
|
157
|
+
long got;
|
158
|
+
//Debug.Assert( fs != null );
|
159
|
+
if ( !id.fs.CanRead ) return SQLITE_IOERR_READ;
|
160
|
+
try
|
161
|
+
{
|
162
|
+
rc = id.fs.Seek( offset, SeekOrigin.Begin ); // SetFilePointer(pFile.fs.Name, lowerBits, upperBits, FILE_BEGIN);
|
163
|
+
}
|
164
|
+
catch ( Exception e ) // if( rc==INVALID_SET_FILE_POINTER && (error=GetLastError())!=NO_ERROR )
|
165
|
+
{
|
166
|
+
//pFile.lastErrno = 1;
|
167
|
+
return SQLITE_FULL;
|
168
|
+
}
|
169
|
+
|
170
|
+
try
|
171
|
+
{
|
172
|
+
got = id.fs.Read( pBuf, 0, amt ); // if (!ReadFile(pFile.fs.Name, pBuf, amt, got, 0))
|
173
|
+
}
|
174
|
+
catch ( Exception e )
|
175
|
+
{
|
176
|
+
//pFile.lastErrno = 1;
|
177
|
+
return SQLITE_IOERR_READ;
|
178
|
+
}
|
179
|
+
if ( got == amt )
|
180
|
+
{
|
181
|
+
return SQLITE_OK;
|
182
|
+
}
|
183
|
+
else
|
184
|
+
{
|
185
|
+
/* Unread parts of the buffer must be zero-filled */
|
186
|
+
Array.Clear( pBuf, (int)got, (int)( amt - got ) ); // memset(&((char*)pBuf)[got], 0, amt - got);
|
187
|
+
return SQLITE_IOERR_SHORT_READ;
|
188
|
+
}
|
189
|
+
}
|
190
|
+
|
191
|
+
/*
|
192
|
+
** Write data from a buffer into a file. Return SQLITE_OK on success
|
193
|
+
** or some other error code on failure.
|
194
|
+
*/
|
195
|
+
static int winWrite(
|
196
|
+
sqlite3_file id, /* File to write into */
|
197
|
+
byte[] pBuf, /* The bytes to be written */
|
198
|
+
int amt, /* Number of bytes to write */
|
199
|
+
sqlite3_int64 offset /* Offset into the file to begin writing at */
|
200
|
+
)
|
201
|
+
{
|
202
|
+
int rc;
|
203
|
+
long wrote = 0;
|
204
|
+
//Debug.Assert( id != null );
|
205
|
+
//id.fs.Seek( offset, SeekOrigin.Begin );
|
206
|
+
id.fs.Seek(offset, SeekOrigin.Begin);
|
207
|
+
Debug.Assert( amt > 0 );
|
208
|
+
//wrote = id.fs.Position;
|
209
|
+
wrote = id.fs.Position;
|
210
|
+
try
|
211
|
+
{
|
212
|
+
Debug.Assert( pBuf.Length >= amt );
|
213
|
+
//id.fs.Write( pBuf, 0, amt );
|
214
|
+
id.fs.Write(pBuf, 0, amt);
|
215
|
+
rc = 1;// Success
|
216
|
+
//wrote = id.fs.Position - wrote;
|
217
|
+
wrote = id.fs.Position - wrote;
|
218
|
+
}
|
219
|
+
catch ( IOException e )
|
220
|
+
{
|
221
|
+
return SQLITE_READONLY;
|
222
|
+
}
|
223
|
+
if ( rc == 0 || amt > (int)wrote )
|
224
|
+
{
|
225
|
+
id.lastErrno = 1;
|
226
|
+
return SQLITE_FULL;
|
227
|
+
}
|
228
|
+
return SQLITE_OK;
|
229
|
+
}
|
230
|
+
|
231
|
+
/*
|
232
|
+
** Truncate an open file to a specified size
|
233
|
+
*/
|
234
|
+
static int winTruncate( sqlite3_file id, sqlite3_int64 nByte )
|
235
|
+
{
|
236
|
+
Debug.Assert( id != null );
|
237
|
+
try
|
238
|
+
{
|
239
|
+
//id.fs.SetLength( nByte );
|
240
|
+
id.fs.SetLength(nByte);
|
241
|
+
}
|
242
|
+
catch ( IOException e )
|
243
|
+
{
|
244
|
+
id.lastErrno = 1;
|
245
|
+
return SQLITE_IOERR_TRUNCATE;
|
246
|
+
}
|
247
|
+
return SQLITE_OK;
|
248
|
+
}
|
249
|
+
|
250
|
+
/*
|
251
|
+
** Make sure all writes to a particular file are committed to disk.
|
252
|
+
*/
|
253
|
+
static int winSync( sqlite3_file id, int flags )
|
254
|
+
{
|
255
|
+
sqlite3_file pFile = (sqlite3_file)id;
|
256
|
+
Debug.Assert( id != null );
|
257
|
+
UNUSED_PARAMETER(flags);
|
258
|
+
//pFile.fs.Flush();
|
259
|
+
id.fs.Flush();
|
260
|
+
return SQLITE_OK;
|
261
|
+
}
|
262
|
+
|
263
|
+
/*
|
264
|
+
** Determine the current size of a file in bytes
|
265
|
+
*/
|
266
|
+
static int sqlite3_fileSize( sqlite3_file id, ref int pSize )
|
267
|
+
{
|
268
|
+
Debug.Assert( id != null );
|
269
|
+
//pSize = id.fs.CanRead ? (int)id.fs.Length : 0;
|
270
|
+
pSize = id.fs.CanRead ? (int)id.fs.Length : 0;
|
271
|
+
return SQLITE_OK;
|
272
|
+
}
|
273
|
+
|
274
|
+
|
275
|
+
/*
|
276
|
+
** Acquire a reader lock.
|
277
|
+
** Different API routines are called depending on whether or not this
|
278
|
+
** is Win95 or WinNT.
|
279
|
+
*/
|
280
|
+
static int getReadLock(sqlite3_file pFile)
|
281
|
+
{
|
282
|
+
int res = 0;
|
283
|
+
if (isNT())
|
284
|
+
{
|
285
|
+
res = lockingStrategy.SharedLockFile(pFile, SHARED_FIRST, SHARED_SIZE);
|
286
|
+
}
|
287
|
+
if (res == 0)
|
288
|
+
{
|
289
|
+
pFile.lastErrno = 1;
|
290
|
+
}
|
291
|
+
return res;
|
292
|
+
}
|
293
|
+
|
294
|
+
/*
|
295
|
+
** Undo a readlock
|
296
|
+
*/
|
297
|
+
static int unlockReadLock(sqlite3_file pFile)
|
298
|
+
{
|
299
|
+
int res = 1;
|
300
|
+
if (isNT())
|
301
|
+
{
|
302
|
+
try
|
303
|
+
{
|
304
|
+
lockingStrategy.UnlockFile(pFile, SHARED_FIRST, SHARED_SIZE); // res = UnlockFile(pFilE.h, SHARED_FIRST, 0, SHARED_SIZE, 0);
|
305
|
+
}
|
306
|
+
catch (Exception e)
|
307
|
+
{
|
308
|
+
res = 0;
|
309
|
+
}
|
310
|
+
}
|
311
|
+
else
|
312
|
+
{
|
313
|
+
Debugger.Break(); // res = UnlockFile(pFilE.h, SHARED_FIRST + pFilE.sharedLockByte, 0, 1, 0);
|
314
|
+
}
|
315
|
+
if (res == 0)
|
316
|
+
{
|
317
|
+
pFile.lastErrno = 1;
|
318
|
+
}
|
319
|
+
return res;
|
320
|
+
}
|
321
|
+
|
322
|
+
/*
|
323
|
+
** Lock the file with the lock specified by parameter locktype - one
|
324
|
+
** of the following:
|
325
|
+
**
|
326
|
+
** (1) SHARED_LOCK
|
327
|
+
** (2) RESERVED_LOCK
|
328
|
+
** (3) PENDING_LOCK
|
329
|
+
** (4) EXCLUSIVE_LOCK
|
330
|
+
**
|
331
|
+
** Sometimes when requesting one lock state, additional lock states
|
332
|
+
** are inserted in between. The locking might fail on one of the later
|
333
|
+
** transitions leaving the lock state different from what it started but
|
334
|
+
** still short of its goal. The following chart shows the allowed
|
335
|
+
** transitions and the inserted intermediate states:
|
336
|
+
**
|
337
|
+
** UNLOCKED -> SHARED
|
338
|
+
** SHARED -> RESERVED
|
339
|
+
** SHARED -> (PENDING) -> EXCLUSIVE
|
340
|
+
** RESERVED -> (PENDING) -> EXCLUSIVE
|
341
|
+
** PENDING -> EXCLUSIVE
|
342
|
+
**
|
343
|
+
** This routine will only increase a lock. The winUnlock() routine
|
344
|
+
** erases all locks at once and returns us immediately to locking level 0.
|
345
|
+
** It is not possible to lower the locking level one step at a time. You
|
346
|
+
** must go straight to locking level 0.
|
347
|
+
*/
|
348
|
+
static int winLock( sqlite3_file id, int locktype )
|
349
|
+
{
|
350
|
+
int rc = SQLITE_OK; /* Return code from subroutines */
|
351
|
+
int res = 1; /* Result of a windows lock call */
|
352
|
+
int newLocktype; /* Set pFile.locktype to this value before exiting */
|
353
|
+
bool gotPendingLock = false;/* True if we acquired a PENDING lock this time */
|
354
|
+
sqlite3_file pFile = (sqlite3_file)id;
|
355
|
+
DWORD error = NO_ERROR;
|
356
|
+
|
357
|
+
Debug.Assert( id != null );
|
358
|
+
/* If there is already a lock of this type or more restrictive on the
|
359
|
+
** OsFile, do nothing. Don't use the end_lock: exit path, as
|
360
|
+
** sqlite3OsEnterMutex() hasn't been called yet.
|
361
|
+
*/
|
362
|
+
if ( pFile.locktype >= locktype )
|
363
|
+
{
|
364
|
+
return SQLITE_OK;
|
365
|
+
}
|
366
|
+
|
367
|
+
/* Make sure the locking sequence is correct
|
368
|
+
*/
|
369
|
+
Debug.Assert( pFile.locktype != NO_LOCK || locktype == SHARED_LOCK );
|
370
|
+
Debug.Assert( locktype != PENDING_LOCK );
|
371
|
+
Debug.Assert( locktype != RESERVED_LOCK || pFile.locktype == SHARED_LOCK );
|
372
|
+
|
373
|
+
/* Lock the PENDING_LOCK byte if we need to acquire a PENDING lock or
|
374
|
+
** a SHARED lock. If we are acquiring a SHARED lock, the acquisition of
|
375
|
+
** the PENDING_LOCK byte is temporary.
|
376
|
+
*/
|
377
|
+
newLocktype = pFile.locktype;
|
378
|
+
if ( pFile.locktype == NO_LOCK
|
379
|
+
|| ( ( locktype == EXCLUSIVE_LOCK )
|
380
|
+
&& ( pFile.locktype == RESERVED_LOCK ) )
|
381
|
+
)
|
382
|
+
{
|
383
|
+
int cnt = 3;
|
384
|
+
res = 0;
|
385
|
+
while ( cnt-- > 0 && res == 0 )//(res = LockFile(pFile.fs.SafeFileHandle.DangerousGetHandle().ToInt32(), PENDING_BYTE, 0, 1, 0)) == 0)
|
386
|
+
{
|
387
|
+
try
|
388
|
+
{
|
389
|
+
lockingStrategy.LockFile( pFile, PENDING_BYTE, 1 );
|
390
|
+
res = 1;
|
391
|
+
}
|
392
|
+
catch ( Exception e )
|
393
|
+
{
|
394
|
+
/* Try 3 times to get the pending lock. The pending lock might be
|
395
|
+
** held by another reader process who will release it momentarily.
|
396
|
+
*/
|
397
|
+
Thread.Sleep( 1 );
|
398
|
+
}
|
399
|
+
}
|
400
|
+
gotPendingLock = ( res != 0 );
|
401
|
+
if ( 0 == res )
|
402
|
+
{
|
403
|
+
error = 1;
|
404
|
+
}
|
405
|
+
}
|
406
|
+
|
407
|
+
/* Acquire a shared lock
|
408
|
+
*/
|
409
|
+
if ( locktype == SHARED_LOCK && res != 0 )
|
410
|
+
{
|
411
|
+
Debug.Assert( pFile.locktype == NO_LOCK );
|
412
|
+
res = getReadLock( pFile );
|
413
|
+
if ( res != 0 )
|
414
|
+
{
|
415
|
+
newLocktype = SHARED_LOCK;
|
416
|
+
}
|
417
|
+
else
|
418
|
+
{
|
419
|
+
error = 1;
|
420
|
+
}
|
421
|
+
}
|
422
|
+
|
423
|
+
if ( ( locktype == RESERVED_LOCK ) && res != 0 )
|
424
|
+
{
|
425
|
+
Debug.Assert( pFile.locktype == SHARED_LOCK );
|
426
|
+
try
|
427
|
+
{
|
428
|
+
lockingStrategy.LockFile( pFile, RESERVED_BYTE, 1 );//res = LockFile(pFile.fs.SafeFileHandle.DangerousGetHandle().ToInt32(), RESERVED_BYTE, 0, 1, 0);
|
429
|
+
newLocktype = RESERVED_LOCK;
|
430
|
+
res = 1;
|
431
|
+
}
|
432
|
+
catch ( Exception e )
|
433
|
+
{
|
434
|
+
res = 0;
|
435
|
+
error = 1;
|
436
|
+
}
|
437
|
+
if ( res != 0 )
|
438
|
+
{
|
439
|
+
newLocktype = RESERVED_LOCK;
|
440
|
+
}
|
441
|
+
else
|
442
|
+
{
|
443
|
+
error = 1;
|
444
|
+
}
|
445
|
+
}
|
446
|
+
|
447
|
+
/* Acquire a PENDING lock
|
448
|
+
*/
|
449
|
+
if ( locktype == EXCLUSIVE_LOCK && res != 0 )
|
450
|
+
{
|
451
|
+
newLocktype = PENDING_LOCK;
|
452
|
+
gotPendingLock = false;
|
453
|
+
}
|
454
|
+
|
455
|
+
/* Acquire an EXCLUSIVE lock
|
456
|
+
*/
|
457
|
+
if ( locktype == EXCLUSIVE_LOCK && res != 0 )
|
458
|
+
{
|
459
|
+
Debug.Assert( pFile.locktype >= SHARED_LOCK );
|
460
|
+
res = unlockReadLock( pFile );
|
461
|
+
try
|
462
|
+
{
|
463
|
+
lockingStrategy.LockFile( pFile, SHARED_FIRST, SHARED_SIZE );
|
464
|
+
newLocktype = EXCLUSIVE_LOCK;
|
465
|
+
res = 1;
|
466
|
+
}
|
467
|
+
catch ( Exception e )
|
468
|
+
{
|
469
|
+
res = 0;
|
470
|
+
}
|
471
|
+
if ( res != 0 )
|
472
|
+
{
|
473
|
+
newLocktype = EXCLUSIVE_LOCK;
|
474
|
+
}
|
475
|
+
else
|
476
|
+
{
|
477
|
+
error = 1;
|
478
|
+
getReadLock( pFile );
|
479
|
+
}
|
480
|
+
}
|
481
|
+
|
482
|
+
/* If we are holding a PENDING lock that ought to be released, then
|
483
|
+
** release it now.
|
484
|
+
*/
|
485
|
+
if ( gotPendingLock && locktype == SHARED_LOCK )
|
486
|
+
{
|
487
|
+
lockingStrategy.UnlockFile( pFile, PENDING_BYTE, 1 );
|
488
|
+
}
|
489
|
+
|
490
|
+
/* Update the state of the lock has held in the file descriptor then
|
491
|
+
** return the appropriate result code.
|
492
|
+
*/
|
493
|
+
if ( res != 0 )
|
494
|
+
{
|
495
|
+
rc = SQLITE_OK;
|
496
|
+
}
|
497
|
+
else
|
498
|
+
{
|
499
|
+
pFile.lastErrno = error;
|
500
|
+
rc = SQLITE_BUSY;
|
501
|
+
}
|
502
|
+
pFile.locktype = (u8)newLocktype;
|
503
|
+
return rc;
|
504
|
+
}
|
505
|
+
|
506
|
+
/*
|
507
|
+
** This routine checks if there is a RESERVED lock held on the specified
|
508
|
+
** file by this or any other process. If such a lock is held, return
|
509
|
+
** non-zero, otherwise zero.
|
510
|
+
*/
|
511
|
+
static int winCheckReservedLock( sqlite3_file id, ref int pResOut )
|
512
|
+
{
|
513
|
+
//int rc;
|
514
|
+
//Debug.Assert( id != null );
|
515
|
+
//if ( id.locktype >= RESERVED_LOCK )
|
516
|
+
//{
|
517
|
+
// rc = 1;
|
518
|
+
//}
|
519
|
+
//else
|
520
|
+
//{
|
521
|
+
// try
|
522
|
+
// {
|
523
|
+
// lockingStrategy.LockFile(id, RESERVED_BYTE, 1);
|
524
|
+
// lockingStrategy.UnlockFile(id, RESERVED_BYTE, 1);
|
525
|
+
// rc = 1;
|
526
|
+
// }
|
527
|
+
// catch ( IOException e )
|
528
|
+
// { rc = 0; }
|
529
|
+
// rc = 1 - rc; // !rc
|
530
|
+
//}
|
531
|
+
//pResOut = rc;
|
532
|
+
pResOut = 0;
|
533
|
+
return SQLITE_OK;
|
534
|
+
}
|
535
|
+
|
536
|
+
/*
|
537
|
+
** Lower the locking level on file descriptor id to locktype. locktype
|
538
|
+
** must be either NO_LOCK or SHARED_LOCK.
|
539
|
+
**
|
540
|
+
** If the locking level of the file descriptor is already at or below
|
541
|
+
** the requested locking level, this routine is a no-op.
|
542
|
+
**
|
543
|
+
** It is not possible for this routine to fail if the second argument
|
544
|
+
** is NO_LOCK. If the second argument is SHARED_LOCK then this routine
|
545
|
+
** might return SQLITE_IOERR;
|
546
|
+
*/
|
547
|
+
static int winUnlock( sqlite3_file id, int locktype )
|
548
|
+
{
|
549
|
+
int type;
|
550
|
+
sqlite3_file pFile = (sqlite3_file)id;
|
551
|
+
int rc = SQLITE_OK;
|
552
|
+
Debug.Assert( pFile != null );
|
553
|
+
Debug.Assert( locktype <= SHARED_LOCK );
|
554
|
+
type = pFile.locktype;
|
555
|
+
if ( type >= EXCLUSIVE_LOCK )
|
556
|
+
{
|
557
|
+
lockingStrategy.UnlockFile( pFile, SHARED_FIRST, SHARED_SIZE ); // UnlockFile(pFilE.h, SHARED_FIRST, 0, SHARED_SIZE, 0);
|
558
|
+
if ( locktype == SHARED_LOCK && getReadLock( pFile ) == 0 )
|
559
|
+
{
|
560
|
+
/* This should never happen. We should always be able to
|
561
|
+
** reacquire the read lock */
|
562
|
+
rc = SQLITE_IOERR_UNLOCK;
|
563
|
+
}
|
564
|
+
}
|
565
|
+
if ( type >= RESERVED_LOCK )
|
566
|
+
{
|
567
|
+
try
|
568
|
+
{
|
569
|
+
lockingStrategy.UnlockFile( pFile, RESERVED_BYTE, 1 );// UnlockFile(pFilE.h, RESERVED_BYTE, 0, 1, 0);
|
570
|
+
}
|
571
|
+
catch ( Exception e ) { }
|
572
|
+
}
|
573
|
+
if ( locktype == NO_LOCK && type >= SHARED_LOCK )
|
574
|
+
{
|
575
|
+
unlockReadLock( pFile );
|
576
|
+
}
|
577
|
+
if ( type >= PENDING_LOCK )
|
578
|
+
{
|
579
|
+
try
|
580
|
+
{
|
581
|
+
lockingStrategy.UnlockFile( pFile, PENDING_BYTE, 1 );// UnlockFile(pFilE.h, PENDING_BYTE, 0, 1, 0);
|
582
|
+
}
|
583
|
+
catch ( Exception e )
|
584
|
+
{ }
|
585
|
+
}
|
586
|
+
pFile.locktype = (u8)locktype;
|
587
|
+
return rc;
|
588
|
+
}
|
589
|
+
|
590
|
+
/*
|
591
|
+
** Control and query of the open file handle.
|
592
|
+
*/
|
593
|
+
static int winFileControl( sqlite3_file id, int op, ref int pArg )
|
594
|
+
{
|
595
|
+
switch ( op )
|
596
|
+
{
|
597
|
+
case SQLITE_FCNTL_LOCKSTATE:
|
598
|
+
{
|
599
|
+
pArg = ( (sqlite3_file)id ).locktype;
|
600
|
+
return SQLITE_OK;
|
601
|
+
}
|
602
|
+
case SQLITE_LAST_ERRNO:
|
603
|
+
{
|
604
|
+
pArg = (int)( (sqlite3_file)id ).lastErrno;
|
605
|
+
return SQLITE_OK;
|
606
|
+
}
|
607
|
+
}
|
608
|
+
return SQLITE_ERROR;
|
609
|
+
}
|
610
|
+
|
611
|
+
/*
|
612
|
+
** Return the sector size in bytes of the underlying block device for
|
613
|
+
** the specified file. This is almost always 512 bytes, but may be
|
614
|
+
** larger for some devices.
|
615
|
+
**
|
616
|
+
** SQLite code assumes this function cannot fail. It also assumes that
|
617
|
+
** if two files are created in the same file-system directory (i.e.
|
618
|
+
** a database and its journal file) that the sector size will be the
|
619
|
+
** same for both.
|
620
|
+
*/
|
621
|
+
static int winSectorSize( sqlite3_file id )
|
622
|
+
{
|
623
|
+
Debug.Assert( id != null );
|
624
|
+
return (int)( id.sectorSize );
|
625
|
+
}
|
626
|
+
|
627
|
+
/*
|
628
|
+
** Return a vector of device characteristics.
|
629
|
+
*/
|
630
|
+
static int winDeviceCharacteristics( sqlite3_file id )
|
631
|
+
{
|
632
|
+
UNUSED_PARAMETER( id );
|
633
|
+
return 0;
|
634
|
+
}
|
635
|
+
|
636
|
+
/*
|
637
|
+
** This vector defines all the methods that can operate on an
|
638
|
+
** sqlite3_file for win32.
|
639
|
+
*/
|
640
|
+
static sqlite3_io_methods winIoMethod = new sqlite3_io_methods(
|
641
|
+
1, /* iVersion */
|
642
|
+
(dxClose)winClose,
|
643
|
+
(dxRead)winRead,
|
644
|
+
(dxWrite)winWrite,
|
645
|
+
(dxTruncate)winTruncate,
|
646
|
+
(dxSync)winSync,
|
647
|
+
(dxFileSize)sqlite3_fileSize,
|
648
|
+
(dxLock)winLock,
|
649
|
+
(dxUnlock)winUnlock,
|
650
|
+
(dxCheckReservedLock)winCheckReservedLock,
|
651
|
+
(dxFileControl)winFileControl,
|
652
|
+
(dxSectorSize)winSectorSize,
|
653
|
+
(dxDeviceCharacteristics)winDeviceCharacteristics
|
654
|
+
);
|
655
|
+
|
656
|
+
/***************************************************************************
|
657
|
+
** Here ends the I/O methods that form the sqlite3_io_methods object.
|
658
|
+
**
|
659
|
+
** The next block of code implements the VFS methods.
|
660
|
+
****************************************************************************/
|
661
|
+
|
662
|
+
/*
|
663
|
+
** Convert a UTF-8 filename into whatever form the underlying
|
664
|
+
** operating system wants filenames in. Space to hold the result
|
665
|
+
** is obtained from malloc and must be freed by the calling
|
666
|
+
** function.
|
667
|
+
*/
|
668
|
+
static string convertUtf8Filename( string zFilename )
|
669
|
+
{
|
670
|
+
return zFilename;
|
671
|
+
}
|
672
|
+
|
673
|
+
/*
|
674
|
+
** Create a temporary file name in zBuf. zBuf must be big enough to
|
675
|
+
** hold at pVfs.mxPathname characters.
|
676
|
+
*/
|
677
|
+
static int getTempname(int nBuf, StringBuilder zBuf)
|
678
|
+
{
|
679
|
+
const string zChars = "abcdefghijklmnopqrstuvwxyz0123456789";
|
680
|
+
StringBuilder zRandom = new StringBuilder(20);
|
681
|
+
i64 iRandom = 0;
|
682
|
+
for (int i = 0; i < 20; i++)
|
683
|
+
{
|
684
|
+
sqlite3_randomness(1, ref iRandom);
|
685
|
+
zRandom.Append((char)zChars[(int)(iRandom % (zChars.Length - 1))]);
|
686
|
+
}
|
687
|
+
//zBuf.Append(Path.GetTempPath() + SQLITE_TEMP_FILE_PREFIX + zRandom.ToString());
|
688
|
+
zBuf.Append("db/" + SQLITE_TEMP_FILE_PREFIX + zRandom.ToString());
|
689
|
+
return SQLITE_OK;
|
690
|
+
}
|
691
|
+
|
692
|
+
/*
|
693
|
+
** The return value of getLastErrorMsg
|
694
|
+
** is zero if the error message fits in the buffer, or non-zero
|
695
|
+
** otherwise (if the message was truncated).
|
696
|
+
*/
|
697
|
+
static int getLastErrorMsg( int nBuf, ref string zBuf )
|
698
|
+
{
|
699
|
+
zBuf = "Unknown error";
|
700
|
+
return 0;
|
701
|
+
}
|
702
|
+
|
703
|
+
/*
|
704
|
+
** Open a file.
|
705
|
+
*/
|
706
|
+
static int winOpen(
|
707
|
+
sqlite3_vfs pVfs, /* Not used */
|
708
|
+
string zName, /* Name of the file (UTF-8) */
|
709
|
+
sqlite3_file pFile, /* Write the SQLite file handle here */
|
710
|
+
int flags, /* Open mode flags */
|
711
|
+
ref int pOutFlags /* Status return flags */
|
712
|
+
)
|
713
|
+
{
|
714
|
+
if (pFile.fs != null)
|
715
|
+
return SQLITE_OK;
|
716
|
+
//HANDLE h;
|
717
|
+
//pFile.fs = null;
|
718
|
+
//fs = null;
|
719
|
+
FileAccess dwDesiredAccess;
|
720
|
+
FileShare dwShareMode;
|
721
|
+
FileMode dwCreationDisposition;
|
722
|
+
string zConverted; /* Filename in OS encoding */
|
723
|
+
string zUtf8Name = zName; /* Filename in UTF-8 encoding */
|
724
|
+
StringBuilder zTmpname = new StringBuilder( MAX_PATH + 1 ); /* Buffer used to create temp filename */
|
725
|
+
|
726
|
+
Debug.Assert( pFile != null );
|
727
|
+
UNUSED_PARAMETER( pVfs );
|
728
|
+
|
729
|
+
/* If the second argument to this function is NULL, generate a
|
730
|
+
** temporary file name to use
|
731
|
+
*/
|
732
|
+
if ( String.IsNullOrEmpty( zUtf8Name ) )
|
733
|
+
{
|
734
|
+
int rc = getTempname( MAX_PATH + 1, zTmpname );
|
735
|
+
if ( rc != SQLITE_OK )
|
736
|
+
{
|
737
|
+
return rc;
|
738
|
+
}
|
739
|
+
zUtf8Name = zTmpname.ToString();
|
740
|
+
}
|
741
|
+
|
742
|
+
// /* Convert the filename to the system encoding. */
|
743
|
+
zConverted = zUtf8Name;// convertUtf8Filename( zUtf8Name );
|
744
|
+
if ( String.IsNullOrEmpty( zConverted ) )
|
745
|
+
{
|
746
|
+
return SQLITE_NOMEM;
|
747
|
+
}
|
748
|
+
|
749
|
+
if ( ( flags & SQLITE_OPEN_READWRITE ) != 0 )
|
750
|
+
{
|
751
|
+
dwDesiredAccess = FileAccess.Read | FileAccess.Write; // GENERIC_READ | GENERIC_WRITE;
|
752
|
+
}
|
753
|
+
else
|
754
|
+
{
|
755
|
+
dwDesiredAccess = FileAccess.Read; // GENERIC_READ;
|
756
|
+
}
|
757
|
+
/* SQLITE_OPEN_EXCLUSIVE is used to make sure that a new file is
|
758
|
+
** created. SQLite doesn't use it to indicate "exclusive access"
|
759
|
+
** as it is usually understood.
|
760
|
+
*/
|
761
|
+
Debug.Assert( 0 == ( flags & SQLITE_OPEN_EXCLUSIVE ) || ( flags & SQLITE_OPEN_CREATE ) != 0 );
|
762
|
+
if ( ( flags & SQLITE_OPEN_EXCLUSIVE ) != 0 )
|
763
|
+
{
|
764
|
+
/* Creates a new file, only if it does not already exist. */
|
765
|
+
/* If the file exists, it fails. */
|
766
|
+
dwCreationDisposition = FileMode.CreateNew;// CREATE_NEW;
|
767
|
+
}
|
768
|
+
else if ( ( flags & SQLITE_OPEN_CREATE ) != 0 )
|
769
|
+
{
|
770
|
+
/* Open existing file, or create if it doesn't exist */
|
771
|
+
dwCreationDisposition = FileMode.OpenOrCreate;// OPEN_ALWAYS;
|
772
|
+
}
|
773
|
+
else
|
774
|
+
{
|
775
|
+
/* Opens a file, only if it exists. */
|
776
|
+
dwCreationDisposition = FileMode.Open;//OPEN_EXISTING;
|
777
|
+
}
|
778
|
+
dwShareMode = FileShare.Read | FileShare.Write;// FILE_SHARE_READ | FILE_SHARE_WRITE;
|
779
|
+
if ( ( flags & SQLITE_OPEN_DELETEONCLOSE ) != 0 )
|
780
|
+
{
|
781
|
+
}
|
782
|
+
else
|
783
|
+
{
|
784
|
+
}
|
785
|
+
/* Reports from the internet are that performance is always
|
786
|
+
** better if FILE_FLAG_RANDOM_ACCESS is used. Ticket #2699. */
|
787
|
+
if ( isNT() )
|
788
|
+
{
|
789
|
+
int retries = 3;
|
790
|
+
//while ( ( pFile.fs == null ) && ( retries > 0 ) )
|
791
|
+
while ((pFile.fs == null) && (retries > 0))
|
792
|
+
try
|
793
|
+
{
|
794
|
+
retries--;
|
795
|
+
//pFile.fs = new IsolatedStorageFileStream(zConverted, dwCreationDisposition, dwDesiredAccess, dwShareMode, pFile.store);
|
796
|
+
pFile.fs = new IsolatedStorageFileStream(zConverted, dwCreationDisposition, dwDesiredAccess, dwShareMode, store);
|
797
|
+
}
|
798
|
+
catch ( Exception e )
|
799
|
+
{
|
800
|
+
Thread.Sleep( 100 );
|
801
|
+
}
|
802
|
+
|
803
|
+
/* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed.
|
804
|
+
** Since the ASCII version of these Windows API do not exist for WINCE,
|
805
|
+
** it's important to not reference them for WINCE builds.
|
806
|
+
*/
|
807
|
+
}
|
808
|
+
//if ( pFile.fs == null
|
809
|
+
if (pFile.fs == null
|
810
|
+
||
|
811
|
+
//!pFile.fs.CanRead
|
812
|
+
!pFile.fs.CanRead
|
813
|
+
)
|
814
|
+
{
|
815
|
+
if ( ( flags & SQLITE_OPEN_READWRITE ) != 0 )
|
816
|
+
{
|
817
|
+
return winOpen( pVfs, zName, pFile,
|
818
|
+
( ( flags | SQLITE_OPEN_READONLY ) & ~SQLITE_OPEN_READWRITE ), ref pOutFlags );
|
819
|
+
}
|
820
|
+
else
|
821
|
+
{
|
822
|
+
return SQLITE_CANTOPEN_BKPT();
|
823
|
+
}
|
824
|
+
}
|
825
|
+
if ( ( flags & SQLITE_OPEN_READWRITE ) != 0 )
|
826
|
+
{
|
827
|
+
pOutFlags = SQLITE_OPEN_READWRITE;
|
828
|
+
}
|
829
|
+
else
|
830
|
+
{
|
831
|
+
pOutFlags = SQLITE_OPEN_READONLY;
|
832
|
+
}
|
833
|
+
//}
|
834
|
+
pFile.Clear(); // memset(pFile, 0, sizeof(*pFile));
|
835
|
+
pFile.pMethods = winIoMethod;
|
836
|
+
pFile.lastErrno = NO_ERROR;
|
837
|
+
pFile.sectorSize = (ulong)getSectorSize( pVfs, zUtf8Name );
|
838
|
+
return SQLITE_OK;
|
839
|
+
}
|
840
|
+
|
841
|
+
/*
|
842
|
+
** Delete the named file.
|
843
|
+
**
|
844
|
+
** Note that windows does not allow a file to be deleted if some other
|
845
|
+
** process has it open. Sometimes a virus scanner or indexing program
|
846
|
+
** will open a journal file shortly after it is created in order to do
|
847
|
+
** whatever it does. While this other process is holding the
|
848
|
+
** file open, we will be unable to delete it. To work around this
|
849
|
+
** problem, we delay 100 milliseconds and try to delete again. Up
|
850
|
+
** to MX_DELETION_ATTEMPTs deletion attempts are run before giving
|
851
|
+
** up and returning an error.
|
852
|
+
*/
|
853
|
+
static int MX_DELETION_ATTEMPTS = 5;
|
854
|
+
static int winDelete(
|
855
|
+
sqlite3_vfs pVfs, /* Not used on win32 */
|
856
|
+
string zFilename, /* Name of file to delete */
|
857
|
+
int syncDir /* Not used on win32 */
|
858
|
+
)
|
859
|
+
{
|
860
|
+
int cnt = 0;
|
861
|
+
int rc;
|
862
|
+
int error;
|
863
|
+
UNUSED_PARAMETER( pVfs );
|
864
|
+
UNUSED_PARAMETER( syncDir );
|
865
|
+
string zConverted = convertUtf8Filename( zFilename );
|
866
|
+
if ( zConverted == null || zConverted == "" )
|
867
|
+
{
|
868
|
+
return SQLITE_NOMEM;
|
869
|
+
}
|
870
|
+
if ( isNT() )
|
871
|
+
{
|
872
|
+
do
|
873
|
+
{
|
874
|
+
if (!ExistsFile(zFilename))
|
875
|
+
{
|
876
|
+
rc = SQLITE_IOERR;
|
877
|
+
break;
|
878
|
+
}
|
879
|
+
try
|
880
|
+
{
|
881
|
+
DeleteFile( zConverted );
|
882
|
+
rc = SQLITE_OK;
|
883
|
+
}
|
884
|
+
catch ( IOException e )
|
885
|
+
{
|
886
|
+
rc = SQLITE_IOERR;
|
887
|
+
Thread.Sleep( 100 );
|
888
|
+
}
|
889
|
+
} while ( rc != SQLITE_OK && ++cnt < MX_DELETION_ATTEMPTS );
|
890
|
+
/* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed.
|
891
|
+
** Since the ASCII version of these Windows API do not exist for WINCE,
|
892
|
+
** it's important to not reference them for WINCE builds.
|
893
|
+
*/
|
894
|
+
}
|
895
|
+
else
|
896
|
+
{
|
897
|
+
do
|
898
|
+
{
|
899
|
+
if (!ExistsFile(zFilename))
|
900
|
+
{
|
901
|
+
rc = SQLITE_IOERR;
|
902
|
+
break;
|
903
|
+
}
|
904
|
+
try
|
905
|
+
{
|
906
|
+
DeleteFile(zConverted);
|
907
|
+
rc = SQLITE_OK;
|
908
|
+
}
|
909
|
+
catch ( IOException e )
|
910
|
+
{
|
911
|
+
rc = SQLITE_IOERR;
|
912
|
+
Thread.Sleep( 100 );
|
913
|
+
}
|
914
|
+
} while ( rc != SQLITE_OK && cnt++ < MX_DELETION_ATTEMPTS );
|
915
|
+
|
916
|
+
}
|
917
|
+
//free(zConverted);
|
918
|
+
#if SQLITE_DEBUG
|
919
|
+
OSTRACE2( "DELETE \"%s\"\n", zFilename );
|
920
|
+
#endif
|
921
|
+
//return ( ( rc == INVALID_FILE_ATTRIBUTES )
|
922
|
+
//&& ( error == ERROR_FILE_NOT_FOUND ) ) ? SQLITE_OK : SQLITE_IOERR_DELETE;
|
923
|
+
return rc;
|
924
|
+
}
|
925
|
+
|
926
|
+
/*
|
927
|
+
** Check the existence and status of a file.
|
928
|
+
*/
|
929
|
+
static int winAccess(
|
930
|
+
sqlite3_vfs pVfs, /* Not used on win32 */
|
931
|
+
string zFilename, /* Name of file to check */
|
932
|
+
int flags, /* Type of test to make on this file */
|
933
|
+
ref int pResOut /* OUT: Result */
|
934
|
+
)
|
935
|
+
{
|
936
|
+
pResOut = 1;
|
937
|
+
return SQLITE_OK;
|
938
|
+
|
939
|
+
//FileAttributes attr = 0; // DWORD attr;
|
940
|
+
//int rc = 0;
|
941
|
+
//UNUSED_PARAMETER( pVfs );
|
942
|
+
// if (flags == SQLITE_ACCESS_EXISTS)
|
943
|
+
// {
|
944
|
+
// pResOut =store.FileExists(zFilename) ? 1 : 0;
|
945
|
+
// return SQLITE_OK;
|
946
|
+
// }
|
947
|
+
|
948
|
+
// try
|
949
|
+
// {
|
950
|
+
// if (store.DirectoryExists(zFilename))
|
951
|
+
// {
|
952
|
+
// StringBuilder zTmpname = new StringBuilder(255); /* Buffer used to create temp filename */
|
953
|
+
// getTempname(256, zTmpname);
|
954
|
+
|
955
|
+
// string zTempFilename;
|
956
|
+
// zTempFilename = zTmpname.ToString();//( SQLITE_TEMP_FILE_PREFIX.Length + 1 );
|
957
|
+
// try
|
958
|
+
// {
|
959
|
+
// IsolatedStorageFileStream fs = store.CreateFile(zTempFilename);
|
960
|
+
// fs.Close();
|
961
|
+
// fs = null;
|
962
|
+
// store.DeleteFile(zTempFilename);
|
963
|
+
// attr = FileAttributes.Normal;
|
964
|
+
// }
|
965
|
+
// catch (IOException e) { attr = FileAttributes.ReadOnly; }
|
966
|
+
// }
|
967
|
+
// }
|
968
|
+
// catch (IOException e)
|
969
|
+
// {
|
970
|
+
// }
|
971
|
+
|
972
|
+
//// free(zConverted);
|
973
|
+
//switch ( flags )
|
974
|
+
//{
|
975
|
+
// case SQLITE_ACCESS_READ:
|
976
|
+
// case SQLITE_ACCESS_EXISTS:
|
977
|
+
// rc = attr != 0 ? 1 : 0;// != INVALID_FILE_ATTRIBUTES;
|
978
|
+
// break;
|
979
|
+
// case SQLITE_ACCESS_READWRITE:
|
980
|
+
// rc = attr == 0 ? 0 : (int)( attr & FileAttributes.ReadOnly ) != 0 ? 0 : 1; //FILE_ATTRIBUTE_READONLY ) == 0;
|
981
|
+
// break;
|
982
|
+
// default:
|
983
|
+
// Debug.Assert( "" == "Invalid flags argument" );
|
984
|
+
// rc = 0;
|
985
|
+
// break;
|
986
|
+
//}
|
987
|
+
//pResOut = rc;
|
988
|
+
//return SQLITE_OK;
|
989
|
+
}
|
990
|
+
|
991
|
+
/*
|
992
|
+
** Turn a relative pathname into a full pathname. Write the full
|
993
|
+
** pathname into zOut[]. zOut[] will be at least pVfs.mxPathname
|
994
|
+
** bytes in size.
|
995
|
+
*/
|
996
|
+
static int winFullPathname(
|
997
|
+
sqlite3_vfs pVfs, /* Pointer to vfs object */
|
998
|
+
string zRelative, /* Possibly relative input path */
|
999
|
+
int nFull, /* Size of output buffer in bytes */
|
1000
|
+
StringBuilder zFull /* Output buffer */
|
1001
|
+
)
|
1002
|
+
{
|
1003
|
+
zFull.Append(zRelative);
|
1004
|
+
return SQLITE_OK;
|
1005
|
+
int nByte;
|
1006
|
+
string zOut = null;
|
1007
|
+
UNUSED_PARAMETER( nFull );
|
1008
|
+
//convertUtf8Filename(zRelative));
|
1009
|
+
if ( isNT() )
|
1010
|
+
{
|
1011
|
+
try
|
1012
|
+
{
|
1013
|
+
zOut = Path.GetFullPath( zRelative ); // was unicodeToUtf8(zTemp);
|
1014
|
+
}
|
1015
|
+
catch ( IOException e )
|
1016
|
+
{ zOut = zRelative; }
|
1017
|
+
}
|
1018
|
+
else
|
1019
|
+
{
|
1020
|
+
Debugger.Break(); // -- Not Running under NT
|
1021
|
+
}
|
1022
|
+
if ( zOut != null )
|
1023
|
+
{
|
1024
|
+
// sqlite3_snprintf(pVfs.mxPathname, zFull, "%s", zOut);
|
1025
|
+
if ( zFull.Length > pVfs.mxPathname ) zFull.Length = pVfs.mxPathname;
|
1026
|
+
zFull.Append( zOut );
|
1027
|
+
|
1028
|
+
// will happen on exit; was free(zOut);
|
1029
|
+
return SQLITE_OK;
|
1030
|
+
}
|
1031
|
+
else
|
1032
|
+
{
|
1033
|
+
return SQLITE_NOMEM;
|
1034
|
+
}
|
1035
|
+
}
|
1036
|
+
|
1037
|
+
|
1038
|
+
/*
|
1039
|
+
** Get the sector size of the device used to store
|
1040
|
+
** file.
|
1041
|
+
*/
|
1042
|
+
static int getSectorSize(
|
1043
|
+
sqlite3_vfs pVfs,
|
1044
|
+
string zRelative /* UTF-8 file name */
|
1045
|
+
)
|
1046
|
+
{
|
1047
|
+
return SQLITE_DEFAULT_SECTOR_SIZE;
|
1048
|
+
}
|
1049
|
+
|
1050
|
+
|
1051
|
+
//TODO -- Fix This
|
1052
|
+
static HANDLE winDlOpen( sqlite3_vfs vfs, string zFilename ) { return new HANDLE(); }
|
1053
|
+
static int winDlError( sqlite3_vfs vfs, int nByte, ref string zErrMsg ) { return 0; }
|
1054
|
+
static HANDLE winDlSym( sqlite3_vfs vfs, HANDLE data, string zSymbol ) { return new HANDLE(); }
|
1055
|
+
static int winDlClose( sqlite3_vfs vfs, HANDLE data ) { return 0; }
|
1056
|
+
|
1057
|
+
static int winRandomness( sqlite3_vfs pVfs, int nBuf, ref byte[] zBuf )
|
1058
|
+
{
|
1059
|
+
int n = 0;
|
1060
|
+
UNUSED_PARAMETER( pVfs );
|
1061
|
+
|
1062
|
+
byte[] sBuf = BitConverter.GetBytes(System.DateTime.Now.Ticks);
|
1063
|
+
zBuf[0] = sBuf[0];
|
1064
|
+
zBuf[1] = sBuf[1];
|
1065
|
+
zBuf[2] = sBuf[2];
|
1066
|
+
zBuf[3] = sBuf[3];
|
1067
|
+
;// memcpy(&zBuf[n], x, sizeof(x))
|
1068
|
+
n += 16;// sizeof(x);
|
1069
|
+
if ( sizeof( DWORD ) <= nBuf - n )
|
1070
|
+
{
|
1071
|
+
//DWORD pid = GetCurrentProcessId();
|
1072
|
+
u32 processId;
|
1073
|
+
processId = 28376023;
|
1074
|
+
|
1075
|
+
put32bits( zBuf, n, processId);//(memcpy(&zBuf[n], pid, sizeof(pid));
|
1076
|
+
n += 4;// sizeof(pid);
|
1077
|
+
}
|
1078
|
+
if ( sizeof( DWORD ) <= nBuf - n )
|
1079
|
+
{
|
1080
|
+
//DWORD cnt = GetTickCount();
|
1081
|
+
System.DateTime dt = new System.DateTime();
|
1082
|
+
put32bits( zBuf, n, (u32)dt.Ticks );// memcpy(&zBuf[n], cnt, sizeof(cnt));
|
1083
|
+
n += 4;// cnt.Length;
|
1084
|
+
}
|
1085
|
+
if ( sizeof( long ) <= nBuf - n )
|
1086
|
+
{
|
1087
|
+
long i;
|
1088
|
+
i = System.DateTime.UtcNow.Millisecond;// QueryPerformanceCounter(out i);
|
1089
|
+
put32bits( zBuf, n, (u32)( i & 0xFFFFFFFF ) );//memcpy(&zBuf[n], i, sizeof(i));
|
1090
|
+
put32bits( zBuf, n, (u32)( i >> 32 ) );
|
1091
|
+
n += sizeof( long );
|
1092
|
+
}
|
1093
|
+
return n;
|
1094
|
+
}
|
1095
|
+
|
1096
|
+
|
1097
|
+
/*
|
1098
|
+
** Sleep for a little while. Return the amount of time slept.
|
1099
|
+
*/
|
1100
|
+
static int winSleep( sqlite3_vfs pVfs, int microsec )
|
1101
|
+
{
|
1102
|
+
Thread.Sleep( ( microsec + 999 ) / 1000 );
|
1103
|
+
UNUSED_PARAMETER( pVfs );
|
1104
|
+
return ( ( microsec + 999 ) / 1000 ) * 1000;
|
1105
|
+
}
|
1106
|
+
|
1107
|
+
/*
|
1108
|
+
** The following variable, if set to a non-zero value, becomes the result
|
1109
|
+
** returned from sqlite3OsCurrentTime(). This is used for testing.
|
1110
|
+
|
1111
|
+
/*
|
1112
|
+
** Find the current time (in Universal Coordinated Time). Write the
|
1113
|
+
** current time and date as a Julian Day number into prNow and
|
1114
|
+
** return 0. Return 1 if the time and date cannot be found.
|
1115
|
+
*/
|
1116
|
+
static int winCurrentTime( sqlite3_vfs pVfs, ref double prNow )
|
1117
|
+
{
|
1118
|
+
sqlite3_int64 timeW; /* Whole days */
|
1119
|
+
sqlite3_int64 timeF; /* Fractional Days */
|
1120
|
+
|
1121
|
+
/* Number of 100-nanosecond intervals in a single day */
|
1122
|
+
const sqlite3_int64 ntuPerDay =
|
1123
|
+
10000000 * (sqlite3_int64)86400;
|
1124
|
+
|
1125
|
+
/* Number of 100-nanosecond intervals in half of a day */
|
1126
|
+
const sqlite3_int64 ntuPerHalfDay =
|
1127
|
+
10000000 * (sqlite3_int64)43200;
|
1128
|
+
|
1129
|
+
timeW = System.DateTime.UtcNow.ToFileTime();
|
1130
|
+
timeF = timeW % ntuPerDay; /* fractional days (100-nanoseconds) */
|
1131
|
+
timeW = timeW / ntuPerDay; /* whole days */
|
1132
|
+
timeW = timeW + 2305813; /* add whole days (from 2305813.5) */
|
1133
|
+
timeF = timeF + ntuPerHalfDay; /* add half a day (from 2305813.5) */
|
1134
|
+
timeW = timeW + ( timeF / ntuPerDay ); /* add whole day if half day made one */
|
1135
|
+
timeF = timeF % ntuPerDay; /* compute new fractional days */
|
1136
|
+
prNow = (double)timeW + ( (double)timeF / (double)ntuPerDay );
|
1137
|
+
return 0;
|
1138
|
+
}
|
1139
|
+
|
1140
|
+
|
1141
|
+
/*
|
1142
|
+
** The idea is that this function works like a combination of
|
1143
|
+
** GetLastError() and FormatMessage() on windows (or errno and
|
1144
|
+
** strerror_r() on unix). After an error is returned by an OS
|
1145
|
+
** function, SQLite calls this function with zBuf pointing to
|
1146
|
+
** a buffer of nBuf bytes. The OS layer should populate the
|
1147
|
+
** buffer with a nul-terminated UTF-8 encoded error message
|
1148
|
+
** describing the last IO error to have occurred within the calling
|
1149
|
+
** thread.
|
1150
|
+
**
|
1151
|
+
** If the error message is too large for the supplied buffer,
|
1152
|
+
** it should be truncated. The return value of xGetLastError
|
1153
|
+
** is zero if the error message fits in the buffer, or non-zero
|
1154
|
+
** otherwise (if the message was truncated). If non-zero is returned,
|
1155
|
+
** then it is not necessary to include the nul-terminator character
|
1156
|
+
** in the output buffer.
|
1157
|
+
**
|
1158
|
+
** Not supplying an error message will have no adverse effect
|
1159
|
+
** on SQLite. It is fine to have an implementation that never
|
1160
|
+
** returns an error message:
|
1161
|
+
**
|
1162
|
+
** int xGetLastError(sqlite3_vfs pVfs, int nBuf, char *zBuf){
|
1163
|
+
** Debug.Assert(zBuf[0]=='\0');
|
1164
|
+
** return 0;
|
1165
|
+
** }
|
1166
|
+
**
|
1167
|
+
** However if an error message is supplied, it will be incorporated
|
1168
|
+
** by sqlite into the error message available to the user using
|
1169
|
+
** sqlite3_errmsg(), possibly making IO errors easier to debug.
|
1170
|
+
*/
|
1171
|
+
static int winGetLastError( sqlite3_vfs pVfs, int nBuf, ref string zBuf )
|
1172
|
+
{
|
1173
|
+
UNUSED_PARAMETER( pVfs );
|
1174
|
+
return getLastErrorMsg( nBuf, ref zBuf );
|
1175
|
+
}
|
1176
|
+
|
1177
|
+
static sqlite3_vfs winVfs = new sqlite3_vfs(
|
1178
|
+
1, /* iVersion */
|
1179
|
+
-1, //sqlite3_file.Length, /* szOsFile */
|
1180
|
+
MAX_PATH, /* mxPathname */
|
1181
|
+
null, /* pNext */
|
1182
|
+
"win32", /* zName */
|
1183
|
+
0, /* pAppData */
|
1184
|
+
|
1185
|
+
(dxOpen)winOpen, /* xOpen */
|
1186
|
+
(dxDelete)winDelete, /* xDelete */
|
1187
|
+
(dxAccess)winAccess, /* xAccess */
|
1188
|
+
(dxFullPathname)winFullPathname,/* xFullPathname */
|
1189
|
+
(dxDlOpen)winDlOpen, /* xDlOpen */
|
1190
|
+
(dxDlError)winDlError, /* xDlError */
|
1191
|
+
(dxDlSym)winDlSym, /* xDlSym */
|
1192
|
+
(dxDlClose)winDlClose, /* xDlClose */
|
1193
|
+
(dxRandomness)winRandomness, /* xRandomness */
|
1194
|
+
(dxSleep)winSleep, /* xSleep */
|
1195
|
+
(dxCurrentTime)winCurrentTime, /* xCurrentTime */
|
1196
|
+
(dxGetLastError)winGetLastError /* xGetLastError */
|
1197
|
+
);
|
1198
|
+
|
1199
|
+
/*
|
1200
|
+
** Initialize and deinitialize the operating system interface.
|
1201
|
+
*/
|
1202
|
+
static int sqlite3_os_init()
|
1203
|
+
{
|
1204
|
+
sqlite3_vfs_register( winVfs, 1 );
|
1205
|
+
return SQLITE_OK;
|
1206
|
+
}
|
1207
|
+
static int sqlite3_os_end()
|
1208
|
+
{
|
1209
|
+
return SQLITE_OK;
|
1210
|
+
}
|
1211
|
+
|
1212
|
+
//
|
1213
|
+
// Windows DLL definitions
|
1214
|
+
//
|
1215
|
+
|
1216
|
+
const int NO_ERROR = 0;
|
1217
|
+
/// <summary>
|
1218
|
+
/// Basic locking strategy for Console/Winform applications
|
1219
|
+
/// </summary>
|
1220
|
+
private class LockingStrategy
|
1221
|
+
{
|
1222
|
+
public virtual void LockFile( sqlite3_file pFile, long offset, long length )
|
1223
|
+
{
|
1224
|
+
}
|
1225
|
+
|
1226
|
+
public virtual int SharedLockFile( sqlite3_file pFile, long offset, long length )
|
1227
|
+
{
|
1228
|
+
return 1;
|
1229
|
+
}
|
1230
|
+
|
1231
|
+
public virtual void UnlockFile( sqlite3_file pFile, long offset, long length )
|
1232
|
+
{
|
1233
|
+
}
|
1234
|
+
}
|
1235
|
+
|
1236
|
+
/// <summary>
|
1237
|
+
/// Locking strategy for Medium Trust. It uses the same trick used in the native code for WIN_CE
|
1238
|
+
/// which doesn't support LockFileEx as well.
|
1239
|
+
/// </summary>
|
1240
|
+
private class MediumTrustLockingStrategy : LockingStrategy
|
1241
|
+
{
|
1242
|
+
public override int SharedLockFile( sqlite3_file pFile, long offset, long length )
|
1243
|
+
{
|
1244
|
+
return 1;
|
1245
|
+
}
|
1246
|
+
}
|
1247
|
+
}
|
1248
|
+
internal static class HelperMethods
|
1249
|
+
{
|
1250
|
+
public static bool IsRunningMediumTrust()
|
1251
|
+
{
|
1252
|
+
return true;
|
1253
|
+
}
|
1254
|
+
}
|
1255
|
+
}
|