internal static extern void SnapshotManager_Open(
     HandleRef self,
      /* from(DataSource_t) */ Types.DataSource data_source,
      /* from(char const *) */ string file_name,
      /* from(SnapshotConflictPolicy_t) */ Types.SnapshotConflictPolicy conflict_policy,
      /* from(SnapshotManager_OpenCallback_t) */ OpenCallback callback,
      /* from(void *) */ IntPtr callback_arg);
    public void Open(OpenCallback callback)
    {
      if(IsOpen == false)
      {
        fDataSources = new List<InterfaceDataSource>();

        if(fTwain.Open())
        {
          fDataSources.AddRange(fTwain.GetDataSources());
        }
        if(fWia.Open())
        {
          fDataSources.AddRange(fWia.GetDataSources());
        }

        foreach(InterfaceDataSource ds in fDataSources)
        {
          ds.OnNewPictureData += fActiveDataSource_OnNewPictureData;
          ds.OnScanningComplete += fActiveDataSource_OnScanningComplete;
        }
      }

      if(callback != null)
      {
        callback(IsOpen);
      }
    }
 internal static extern void SnapshotManager_ResolveConflict(
     HandleRef self,
     /* from(char const *) */ string conflict_id,
     /* from(SnapshotMetadata_t) */ IntPtr snapshot_metadata,
     /* from(SnapshotManager_OpenCallback_t) */ OpenCallback callback,
     /* from(void *) */ IntPtr callback_arg);
		public OpenState(string filename, OpenCallback callback, object state){
			this.filename = filename; 
			this.callback = callback;
			this.state = state;
		}
	public ThreadQueue.TaskControl Open(string filename, OpenCallback callback, object state)
	{
		return ThreadQueue.QueueUserWorkItem(new ThreadQueue.WorkCallback(OpenDatabase), new WaitCallback(OpenDatabaseComplete), new OpenState(filename,callback,state));
	}
Beispiel #6
0
 public OpenState(string filename, OpenCallback callback, object state)
 {
     this.filename = filename;
     this.callback = callback;
     this.state    = state;
 }
Beispiel #7
0
 public ThreadQueue.TaskControl Open(string filename, OpenCallback callback, object state)
 {
     return(ThreadQueue.QueueUserWorkItem(new ThreadQueue.WorkCallback(OpenDatabase), new WaitCallback(OpenDatabaseComplete), new OpenState(filename, callback, state)));
 }
 internal static extern void SnapshotManager_Open(HandleRef self, Types.DataSource data_source, string file_name, Types.SnapshotConflictPolicy conflict_policy, OpenCallback callback, IntPtr callback_arg);
Beispiel #9
0
 internal static extern void SnapshotManager_ResolveConflict(HandleRef self, string conflict_id, IntPtr snapshot_metadata, IntPtr metadata_change, byte[] data, UIntPtr data_size, OpenCallback callback, IntPtr callback_arg);
Beispiel #10
0
 internal static extern void SnapshotManager_ResolveConflict(HandleRef self, string conflict_id, IntPtr snapshot_metadata, OpenCallback callback, IntPtr callback_arg);
Beispiel #11
0
    // 基本的にはオープンとやることは同じなんですけど、
    // StreamingAssetにファイルがあるかどうかの確認を行う
    public ThreadQueue.TaskControl AutoOpen(string filename, string _strDirectory, OpenCallback callback, object state)
    {
        string pathDB = System.IO.Path.Combine(Application.persistentDataPath, filename);
        //Debug.Log( pathDB );
        bool bFileCtrlError = false;

        if (!System.IO.File.Exists(pathDB))
        {
            //Debug.Log ("DB not Exists in documents folder");
            //original path
            string sourcePath = System.IO.Path.Combine(Application.streamingAssetsPath, _strDirectory + filename);
            //Debug.Log( sourcePath );
            if (sourcePath.Contains("://"))
            {
                // Android
                WWW www = new WWW(sourcePath);
                // Wait for download to complete - not pretty at all but easy hack for now
                // and it would not take long since the data is on the local device.
                while (!www.isDone)
                {
                    ;
                }
                if (String.IsNullOrEmpty(www.error))
                {
                    System.IO.File.WriteAllBytes(pathDB, www.bytes);
                }
                else
                {
                    bFileCtrlError = true;
                    //CanExQuery = false;
                    // エラーで返す
                }
            }
            else
            {
                // Mac, Windows, Iphone
                //validate the existens of the DB in the original folder (folder "streamingAssets")
                if (System.IO.File.Exists(sourcePath))
                {
                    //copy file - alle systems except Android
                    System.IO.File.Copy(sourcePath, pathDB, true);
                }
                else
                {
                    bFileCtrlError = true;
                    //CanExQuery = false;
                    // エラーで返す
                    Debug.Log("ERROR: the file DB named " + filename + " doesn't exist in the StreamingAssets Folder, please copy it there.");
                }
            }
        }
        if (bFileCtrlError)
        {
            //Debug.Log( "open error");
            ThreadQueue.TaskControl retError = new ThreadQueue.TaskControl();
            retError.Cancel();
            return(retError);
        }

        //Debug.Log( "open:"+pathDB );
        return(Open(pathDB, callback, state));
    }