sfFile.as
上传用户:lctyggxszx
上传日期:2022-06-30
资源大小:280k
文件大小:16k
- if (_global.$sfFileClass == undefined) {
- _global.$sfFileClass = function() {};
-
- var p = _global.$sfFileClass.prototype;
-
- // Attribute Masks - these values line up with the integer vales in
- // the FileAttributes Enumeration in the .NET Framework Class Library
- p.Archive = 32;
- p.Compressed = 2048;
- p.Device = 64;
- p.Directory = 16;
- p.Encrypted = 16384;
- p.Hidden = 2;
- p.Normal = 128;
- p.NotContentIndexed = 8192;
- p.Offline = 4096;
- p.ReadOnly = 1;
- p.ReparsePoint = 1024;
- p.SparseFile = 512;
- p.System = 4;
- p.Temporary = 256;
-
- //========================================
- // Copy / Delete / Exists / Move
- //========================================
-
- p.copy = function(from, to, overwrite, callback, scope) {
- var args = new Object();
- args.from = from;
- args.to = to;
- args.overwrite = (overwrite == undefined) ? false : overwrite;
- args.callback_id = Math.random().toString().split(".")[1];
- // save a reference to the callback function at a location that
- // the wrapper program "knows" about
- if (callback != undefined) {
- if (scope == undefined) {
- scope = this;
- }
- _global.$SharpFlash.CallBackList[args.callback_id] = new Object();
- _global.$SharpFlash.CallBackList[args.callback_id].callback = callback;
- _global.$SharpFlash.CallBackList[args.callback_id].scope = scope;
- }
-
- fscommand("sfFile.copy", _global.$SharpFlash.WDDX.serialize(args));
- }
-
- p.deleteFile = function(path, callback, scope){
- var args = new Object();
- args.path = path;
- args.callback_id = Math.random().toString().split(".")[1];
-
- // save a reference to the callback function at a location that
- // the wrapper program "knows" about
- if (callback != undefined) {
- if (scope == undefined) {
- scope = this;
- }
- _global.$SharpFlash.CallBackList[args.callback_id] = new Object();
- _global.$SharpFlash.CallBackList[args.callback_id].callback = callback;
- _global.$SharpFlash.CallBackList[args.callback_id].scope = scope;
- }
-
- fscommand("sfFile.deleteFile", _global.$SharpFlash.WDDX.serialize(args));
- }
-
- p.exists = function(path, callback, scope){
- var args = new Object();
- args.path = path;
- args.callback_id = Math.random().toString().split(".")[1];
-
- // save a reference to the callback function at a location that
- // the wrapper program "knows" about
- if (callback != undefined) {
- if (scope == undefined) {
- scope = this;
- }
- _global.$SharpFlash.CallBackList[args.callback_id] = new Object();
- _global.$SharpFlash.CallBackList[args.callback_id].callback = callback;
- _global.$SharpFlash.CallBackList[args.callback_id].scope = scope;
- }
-
- fscommand("sfFile.exists", _global.$SharpFlash.WDDX.serialize(args));
- }
-
- p.move = function(from, to, callback, scope) {
- var args = new Object();
- args.from = from;
- args.to = to;
- args.callback_id = Math.random().toString().split(".")[1];
- // save a reference to the callback function at a location that
- // the wrapper program "knows" about
- if (callback != undefined) {
- if (scope == undefined) { scope = this; }
- _global.$SharpFlash.CallBackList[args.callback_id] = new Object();
- _global.$SharpFlash.CallBackList[args.callback_id].callback = callback;
- _global.$SharpFlash.CallBackList[args.callback_id].scope = scope;
- }
-
- fscommand("sfFile.move", _global.$SharpFlash.WDDX.serialize(args));
- }
-
- //========================================
- // Save / Load
- //========================================
- p.saveText = function(file, text, append, callback, scope) {
- var args = new Object();
- args.file = file;
- args.text = text;
- args.append = (append == undefined ? false : append);
- args.callback_id = Math.random().toString().split(".")[1];
- // save a reference to the callback function at a location that
- // the wrapper program "knows" about
- if (callback != undefined) {
- if (scope == undefined) { scope = this; }
- _global.$SharpFlash.CallBackList[args.callback_id] = new Object();
- _global.$SharpFlash.CallBackList[args.callback_id].callback = callback;
- _global.$SharpFlash.CallBackList[args.callback_id].scope = scope;
- }
-
- fscommand("sfFile.saveText", _global.$SharpFlash.WDDX.serialize(args));
- }
-
- p.loadText = function(file, callback, scope) {
- var args = new Object();
- args.file = file;
- args.callback_id = Math.random().toString().split(".")[1];
- // save a reference to the callback function at a location that
- // the wrapper program "knows" about
- if (callback != undefined) {
- if (scope == undefined) { scope = this; }
- _global.$SharpFlash.CallBackList[args.callback_id] = new Object();
- _global.$SharpFlash.CallBackList[args.callback_id].callback = callback;
- _global.$SharpFlash.CallBackList[args.callback_id].scope = scope;
- }
-
- fscommand("sfFile.loadText", _global.$SharpFlash.WDDX.serialize(args));
- }
-
- p.saveObject = function(file, obj, callback, scope) {
- var args = new Object();
- args.file = file;
- args.obj = obj;
- args.callback_id = Math.random().toString().split(".")[1];
- // save a reference to the callback function at a location that
- // the wrapper program "knows" about
- if (callback != undefined) {
- if (scope == undefined) { scope = this; }
- _global.$SharpFlash.CallBackList[args.callback_id] = new Object();
- _global.$SharpFlash.CallBackList[args.callback_id].callback = callback;
- _global.$SharpFlash.CallBackList[args.callback_id].scope = scope;
- }
-
- fscommand("sfFile.saveObject", _global.$SharpFlash.WDDX.serialize(args));
- }
-
- p.loadObject = function(file, callback, scope) {
- var args = new Object();
- args.file = file;
- args.callback_id = Math.random().toString().split(".")[1];
- // save a reference to the callback function at a location that
- // the wrapper program "knows" about
- if (callback != undefined) {
- if (scope == undefined) { scope = this; }
- _global.$SharpFlash.CallBackList[args.callback_id] = new Object();
- _global.$SharpFlash.CallBackList[args.callback_id].callback = callback;
- _global.$SharpFlash.CallBackList[args.callback_id].scope = scope;
- }
-
- fscommand("sfFile.loadObject", _global.$SharpFlash.WDDX.serialize(args));
- }
-
- //========================================
- // Attributes
- //========================================
-
- p.getAttributes = function(path, callback, scope) {
- var args = new Object();
- args.path = path;
- args.callback_id = Math.random().toString().split(".")[1];
-
- // save a reference to the callback function at a location that
- // the wrapper program "knows" about
- if (callback != undefined) {
- if (scope == undefined) {
- scope = this;
- }
- _global.$SharpFlash.CallBackList[args.callback_id] = new Object();
- _global.$SharpFlash.CallBackList[args.callback_id].callback = callback;
- _global.$SharpFlash.CallBackList[args.callback_id].scope = scope;
- }
-
- fscommand("sfFile.getAttributes", _global.$SharpFlash.WDDX.serialize(args));
- }
-
- p.setAttributes = function(path, attributeMask, callback, scope) {
- var args = new Object();
- args.path = path;
- args.attributeMask = attributeMask;
- args.callback_id = Math.random().toString().split(".")[1];
-
- // save a reference to the callback function at a location that
- // the wrapper program "knows" about
- if (callback != undefined) {
- if (scope == undefined) {
- scope = this;
- }
- _global.$SharpFlash.CallBackList[args.callback_id] = new Object();
- _global.$SharpFlash.CallBackList[args.callback_id].callback = callback;
- _global.$SharpFlash.CallBackList[args.callback_id].scope = scope;
- }
-
- fscommand("sfFile.setAttributes", _global.$SharpFlash.WDDX.serialize(args));
- }
-
- p.getCreationTime = function(path, callback, scope) {
- var args = new Object();
- args.path = path;
- args.callback_id = Math.random().toString().split(".")[1];
-
- // save a reference to the callback function at a location that
- // the wrapper program "knows" about
- if (callback != undefined) {
- if (scope == undefined) {
- scope = this;
- }
- _global.$SharpFlash.CallBackList[args.callback_id] = new Object();
- _global.$SharpFlash.CallBackList[args.callback_id].callback = callback;
- _global.$SharpFlash.CallBackList[args.callback_id].scope = scope;
- }
-
- fscommand("sfFile.getCreationTime", _global.$SharpFlash.WDDX.serialize(args));
- }
-
- p.setCreationTime = function(path, creationTime, callback, scope) {
- var args = new Object();
- args.path = path;
- args.creationTime = creationTime;
- args.callback_id = Math.random().toString().split(".")[1];
-
- // save a reference to the callback function at a location that
- // the wrapper program "knows" about
- if (callback != undefined) {
- if (scope == undefined) {
- scope = this;
- }
- _global.$SharpFlash.CallBackList[args.callback_id] = new Object();
- _global.$SharpFlash.CallBackList[args.callback_id].callback = callback;
- _global.$SharpFlash.CallBackList[args.callback_id].scope = scope;
- }
-
- fscommand("sfFile.setCreationTime", _global.$SharpFlash.WDDX.serialize(args));
- }
-
- p.getCreationTimeUtc = function(path, callback, scope) {
- var args = new Object();
- args.path = path;
- args.callback_id = Math.random().toString().split(".")[1];
-
- // save a reference to the callback function at a location that
- // the wrapper program "knows" about
- if (callback != undefined) {
- if (scope == undefined) {
- scope = this;
- }
- _global.$SharpFlash.CallBackList[args.callback_id] = new Object();
- _global.$SharpFlash.CallBackList[args.callback_id].callback = callback;
- _global.$SharpFlash.CallBackList[args.callback_id].scope = scope;
- }
-
- fscommand("sfFile.getCreationTimeUtc", _global.$SharpFlash.WDDX.serialize(args));
- }
-
- p.setCreationTimeUtc = function(path, creationTime, callback, scope) {
- var args = new Object();
- args.path = path;
- args.creationTime = creationTime;
- args.callback_id = Math.random().toString().split(".")[1];
-
- // save a reference to the callback function at a location that
- // the wrapper program "knows" about
- if (callback != undefined) {
- if (scope == undefined) {
- scope = this;
- }
- _global.$SharpFlash.CallBackList[args.callback_id] = new Object();
- _global.$SharpFlash.CallBackList[args.callback_id].callback = callback;
- _global.$SharpFlash.CallBackList[args.callback_id].scope = scope;
- }
-
- fscommand("sfFile.setCreationTimeUtc", _global.$SharpFlash.WDDX.serialize(args));
- }
-
- p.getLastAccessTime = function(path, callback, scope) {
- var args = new Object();
- args.path = path;
- args.callback_id = Math.random().toString().split(".")[1];
-
- // save a reference to the callback function at a location that
- // the wrapper program "knows" about
- if (callback != undefined) {
- if (scope == undefined) {
- scope = this;
- }
- _global.$SharpFlash.CallBackList[args.callback_id] = new Object();
- _global.$SharpFlash.CallBackList[args.callback_id].callback = callback;
- _global.$SharpFlash.CallBackList[args.callback_id].scope = scope;
- }
-
- fscommand("sfFile.getLastAccessTime", _global.$SharpFlash.WDDX.serialize(args));
- }
-
- p.setLastAccessTime = function(path, accessTime, callback, scope) {
- var args = new Object();
- args.path = path;
- args.accessTime = accessTime;
- args.callback_id = Math.random().toString().split(".")[1];
-
- // save a reference to the callback function at a location that
- // the wrapper program "knows" about
- if (callback != undefined) {
- if (scope == undefined) {
- scope = this;
- }
- _global.$SharpFlash.CallBackList[args.callback_id] = new Object();
- _global.$SharpFlash.CallBackList[args.callback_id].callback = callback;
- _global.$SharpFlash.CallBackList[args.callback_id].scope = scope;
- }
-
- fscommand("sfFile.setLastAccessTime", _global.$SharpFlash.WDDX.serialize(args));
- }
-
- p.getLastAccessTimeUtc = function(path, callback, scope) {
- var args = new Object();
- args.path = path;
- args.callback_id = Math.random().toString().split(".")[1];
-
- // save a reference to the callback function at a location that
- // the wrapper program "knows" about
- if (callback != undefined) {
- if (scope == undefined) {
- scope = this;
- }
- _global.$SharpFlash.CallBackList[args.callback_id] = new Object();
- _global.$SharpFlash.CallBackList[args.callback_id].callback = callback;
- _global.$SharpFlash.CallBackList[args.callback_id].scope = scope;
- }
-
- fscommand("sfFile.getLastAccessTimeUtc", _global.$SharpFlash.WDDX.serialize(args));
- }
-
- p.setLastAccessTimeUtc = function(path, accessTime, callback, scope) {
- var args = new Object();
- args.path = path;
- args.accessTime = accessTime;
- args.callback_id = Math.random().toString().split(".")[1];
-
- // save a reference to the callback function at a location that
- // the wrapper program "knows" about
- if (callback != undefined) {
- if (scope == undefined) {
- scope = this;
- }
- _global.$SharpFlash.CallBackList[args.callback_id] = new Object();
- _global.$SharpFlash.CallBackList[args.callback_id].callback = callback;
- _global.$SharpFlash.CallBackList[args.callback_id].scope = scope;
- }
-
- fscommand("sfFile.setLastAccessTimeUtc", _global.$SharpFlash.WDDX.serialize(args));
- }
-
- p.getLastWriteTime = function(path, callback, scope) {
- var args = new Object();
- args.path = path;
- args.callback_id = Math.random().toString().split(".")[1];
-
- // save a reference to the callback function at a location that
- // the wrapper program "knows" about
- if (callback != undefined) {
- if (scope == undefined) {
- scope = this;
- }
- _global.$SharpFlash.CallBackList[args.callback_id] = new Object();
- _global.$SharpFlash.CallBackList[args.callback_id].callback = callback;
- _global.$SharpFlash.CallBackList[args.callback_id].scope = scope;
- }
-
- fscommand("sfFile.getLastWriteTime", _global.$SharpFlash.WDDX.serialize(args));
- }
-
- p.setLastWriteTime = function(path, writeTime, callback, scope) {
- var args = new Object();
- args.path = path;
- args.writeTime = writeTime;
- args.callback_id = Math.random().toString().split(".")[1];
-
- // save a reference to the callback function at a location that
- // the wrapper program "knows" about
- if (callback != undefined) {
- if (scope == undefined) {
- scope = this;
- }
- _global.$SharpFlash.CallBackList[args.callback_id] = new Object();
- _global.$SharpFlash.CallBackList[args.callback_id].callback = callback;
- _global.$SharpFlash.CallBackList[args.callback_id].scope = scope;
- }
-
- fscommand("sfFile.setLastWriteTime", _global.$SharpFlash.WDDX.serialize(args));
- }
-
- p.getLastWriteTimeUtc = function(path, callback, scope) {
- var args = new Object();
- args.path = path;
- args.callback_id = Math.random().toString().split(".")[1];
-
- // save a reference to the callback function at a location that
- // the wrapper program "knows" about
- if (callback != undefined) {
- if (scope == undefined) {
- scope = this;
- }
- _global.$SharpFlash.CallBackList[args.callback_id] = new Object();
- _global.$SharpFlash.CallBackList[args.callback_id].callback = callback;
- _global.$SharpFlash.CallBackList[args.callback_id].scope = scope;
- }
-
- fscommand("sfFile.getLastWriteTimeUtc", _global.$SharpFlash.WDDX.serialize(args));
- }
-
- p.setLastWriteTimeUtc = function(path, writeTime, callback, scope) {
- var args = new Object();
- args.path = path;
- args.writeTime = writeTime;
- args.callback_id = Math.random().toString().split(".")[1];
-
- // save a reference to the callback function at a location that
- // the wrapper program "knows" about
- if (callback != undefined) {
- if (scope == undefined) {
- scope = this;
- }
- _global.$SharpFlash.CallBackList[args.callback_id] = new Object();
- _global.$SharpFlash.CallBackList[args.callback_id].callback = callback;
- _global.$SharpFlash.CallBackList[args.callback_id].scope = scope;
- }
-
- fscommand("sfFile.setLastWriteTimeUtc", _global.$SharpFlash.WDDX.serialize(args));
- }
-
- delete p;
-
- _global.sfFile = new _global.$sfFileClass();
- }