Exemple #1
0
        protected override bool InitFunctions()
        {
            d_LJST_Inits = (D_LJST_Inits)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "LJST_Inits", typeof(D_LJST_Inits));

            d_LJST_ImportUserDict = (D_LJST_ImportUserDict)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "LJST_ImportUserDict", typeof(D_LJST_ImportUserDict));

            d_LJST_GetFileSent = (D_LJST_GetFileSent)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "LJST_GetFileSent", typeof(D_LJST_GetFileSent));

            d_LJST_GetParagraphSent = (D_LJST_GetParagraphSent)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "LJST_GetParagraphSent", typeof(D_LJST_GetParagraphSent));

            d_LJST_Exits = (D_LJST_Exits)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "LJST_Exits", typeof(D_LJST_Exits));

            if (d_LJST_Inits == null || d_LJST_ImportUserDict == null ||
                d_LJST_GetFileSent == null || d_LJST_GetParagraphSent == null ||
                d_LJST_Exits == null)
            {
                return(false);
            }

            return(true);
        }
Exemple #2
0
        protected override bool InitFunctions()
        {
            d_ST_Init = (D_ST_Init)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "ST_Init", typeof(D_ST_Init));

            d_ST_GetOneObjectResult = (D_ST_GetOneObjectResult)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "ST_GetOneObjectResult", typeof(D_ST_GetOneObjectResult));

            d_ST_GetMultiObjectResult = (D_ST_GetMultiObjectResult)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "ST_GetMultiObjectResult", typeof(D_ST_GetMultiObjectResult));

            d_ST_GetLastErrMsg = (D_ST_GetLastErrMsg)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "ST_GetLastErrMsg", typeof(D_ST_GetLastErrMsg));

            d_ST_Exit = (D_ST_Exit)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "ST_Exit", typeof(D_ST_Exit));

            d_ST_ImportUserDict = (D_ST_ImportUserDict)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "ST_ImportUserDict", typeof(D_ST_ImportUserDict));

            d_ST_GetSentencePoint = (D_ST_GetSentencePoint)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "ST_GetSentencePoint", typeof(D_ST_GetSentencePoint));

            //             d_ST_SentiDictIO = (D_ST_SentiDictIO)dllWrapper.GetFunctionAddress(
            //                 dllWrapper.hModule, "ST_SentiDictIO", typeof(D_ST_SentiDictIO));

            if (d_ST_Init == null || d_ST_GetOneObjectResult == null ||
                d_ST_GetMultiObjectResult == null || d_ST_GetLastErrMsg == null ||
                d_ST_Exit == null)
            {
                return(false);
            }

            return(true);
        }
Exemple #3
0
 private void UpdateMotors()
 {
     foreach (MotorDrive motor in GetComponentsInChildren <MotorDrive>())
     {
         DllWrapper.setMotorRotation(motor.GetComponent <Joint>().index, Mathf.Deg2Rad * motor.currentRotation);
     }
 }
Exemple #4
0
        protected override bool InitFunctions()
        {
            d_RR_Init = (D_RR_Init)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "RR_Init", typeof(D_RR_Init));

            d_RR_FileProcess = (D_RR_FileProcess)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "RR_FileProcess", typeof(D_RR_FileProcess));

            d_RR_FindRepeat = (D_RR_FindRepeat)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "RR_FindRepeat", typeof(D_RR_FindRepeat));

            d_RR_Output = (D_RR_Output)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "RR_Output", typeof(D_RR_Output));

            d_RR_SaveHistoryData = (D_RR_SaveHistoryData)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "RR_SaveHistoryData", typeof(D_RR_SaveHistoryData));

            d_RR_Exit = (D_RR_Exit)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "RR_Exit", typeof(D_RR_Exit));

            d_RR_GetLastErrMsg = (D_RR_GetLastErrMsg)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "RR_GetLastErrMsg", typeof(D_RR_GetLastErrMsg));

            if (d_RR_Init == null || d_RR_FileProcess == null || d_RR_FindRepeat == null ||
                d_RR_Output == null || d_RR_SaveHistoryData == null || d_RR_Exit == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemple #5
0
        public ShapedForm()
        {
            if (dllWrapper == null)
            {
                dllWrapper = new DllWrapper(@"dwmapi.dll");
                if (dllWrapper.IsDllLoaded)
                {
                    dwmIsCompositionEnabled = (DwmIsCompositionEnabled)dllWrapper.GetFunctionAsDelegate(
                        "DwmIsCompositionEnabled", typeof(DwmIsCompositionEnabled));
                    if (dwmIsCompositionEnabled != null)
                    {
                        bool enabled = false;
                        dwmIsCompositionEnabled(ref enabled);
                        if (enabled)
                        {
                            dwmEnableBlurBehindWindow = (DwmEnableBlurBehindWindow)dllWrapper.GetFunctionAsDelegate(
                                "DwmEnableBlurBehindWindow", typeof(DwmEnableBlurBehindWindow));
                            isCompositionAvailable = true;
                        }
                    }
                }
            }

            InitializeComponent();
        }
Exemple #6
0
 private void UpdateJointPositions()
 {
     float[] xCoordinates = new float[joints.Length];
     float[] yCoordinates = new float[joints.Length];
     DllWrapper.getSimulatedPositions(xCoordinates, yCoordinates);
     for (int i = 0; i < joints.Length; i++)
     {
         joints[i].transform.position = new Vector2(xCoordinates[i], yCoordinates[i]);
     }
 }
Exemple #7
0
        /// <summary>
        /// Creates an instance of the <typeparamref name="RadRibbonFormBehavior"/> class.
        /// This instance is not associated with an <typeparamref name="IComponentTreeHandler"/> implementation.
        /// </summary>
        public RadRibbonFormBehavior()
            : base()
        {
            DllWrapper dwmapi = new DllWrapper("dwmapi.dll");

            DwmExtendFrameIntoClientArea =
                (DwmExtendFrameIntoClientAreaDelegate)dwmapi.GetFunctionAsDelegate("DwmExtendFrameIntoClientArea", typeof(DwmExtendFrameIntoClientAreaDelegate));

            DwmDefWindowProc =
                (DwmDefWindowProcDelegate)dwmapi.GetFunctionAsDelegate("DwmDefWindowProc", typeof(DwmDefWindowProcDelegate));
        }
Exemple #8
0
        /// <summary>
        /// Creates an instance of the <typeparamref name="RadRibbonFormBehavior"/> class.
        /// </summary>
        /// <param name="treeHandler">The associated <typeparamref name="IComponentTreeHandler"/> implementation.</param>
        /// <param name="shouldHandleCreateChildItems">Determines whether the behavior
        /// handles the CreateChildItems call.</param>
        public RadRibbonFormBehavior(IComponentTreeHandler treeHandler, bool shouldHandleCreateChildItems)
            : base(treeHandler, shouldHandleCreateChildItems)
        {
            DllWrapper dwmapi = new DllWrapper("dwmapi.dll");

            DwmExtendFrameIntoClientArea =
                (DwmExtendFrameIntoClientAreaDelegate)dwmapi.GetFunctionAsDelegate("DwmExtendFrameIntoClientArea", typeof(DwmExtendFrameIntoClientAreaDelegate));

            DwmDefWindowProc =
                (DwmDefWindowProcDelegate)dwmapi.GetFunctionAsDelegate("DwmDefWindowProc", typeof(DwmDefWindowProcDelegate));
        }
Exemple #9
0
    private void ShowEdgeGradients()
    {
        Vector2 targetPos = Camera.main.ScreenToWorldPoint(
            new Vector3(Input.mousePosition.x, Input.mousePosition.y, -Camera.main.transform.position.z));

        Debug.Log("Calculate gradient of target vertex towards " + targetPos);
        firstEnd     = new float[dynamicEdgeCount];
        secondEnd    = new float[dynamicEdgeCount];
        edgeGradient = new float[dynamicEdgeCount];
        DllWrapper.GetEdgeLengthGradientsForTargetPosition(jointToBeOptimized.index, targetPos, firstEnd, secondEnd, edgeGradient);
    }
Exemple #10
0
    private void TransferLinkageToDLL()
    {
        DllWrapper.Init();
        // vertices
        joints = GetComponentsInChildren <Joint>();
        for (int i = 0; i < joints.Length; i++)
        {
            joints[i].index = i;
        }
        foreach (Joint j in joints)
        {
            MotorDrive motor;
            if (motor = j.GetComponent <MotorDrive>()) // motorized
            {
                DllWrapper.AddMotorizedVertex(
                    j.transform.position,
                    motor.originJoint.index
                    );
            }
            else if (j.isAnchored) // static
            {
                DllWrapper.AddStaticVertex(j.transform.position);
            }
            else // dymanic
            {
                DllWrapper.AddDynamicVertex(j.transform.position);
            }
        }

        // edges
        foreach (Joint j1 in joints)
        {
            foreach (Joint j2 in j1.initialEdges)
            {
                if ((!j1.isAnchored && !j1.GetComponent <MotorDrive>()) ||
                    (!j2.isAnchored && !j2.GetComponent <MotorDrive>()))
                {
                    DllWrapper.addEdge(j1.index, j2.index);
                    dynamicEdgeCount++;
                }
            }
        }
        if (!DllWrapper.PrepareSimulation())
        {
            Debug.LogError("DLL-ERROR: Simulation could not be prepared");
        }
        else
        {
            isSimulationPrepared = true;
        }
    }
Exemple #11
0
        protected override bool InitFunctions()
        {
            d_DE_Init = (D_DE_Init)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "DE_Init", typeof(D_DE_Init));

            d_DE_ParseDocE = (D_DE_ParseDocE)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "DE_ParseDocE", typeof(D_DE_ParseDocE));

            d_DE_GetResult = (D_DE_GetResult)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "DE_GetResult", typeof(D_DE_GetResult));

            d_DE_GetLastErrMsg = (D_DE_GetLastErrMsg)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "DE_GetLastErrMsg", typeof(D_DE_GetLastErrMsg));

            d_DE_GetSentimentScore = (D_DE_GetSentimentScore)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "DE_GetSentimentScore", typeof(D_DE_GetSentimentScore));

            d_DE_ReleaseHandle = (D_DE_ReleaseHandle)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "DE_ReleaseHandle", typeof(D_DE_ReleaseHandle));

            d_DE_ImportSentimentDict = (D_DE_ImportSentimentDict)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "DE_GetResult", typeof(D_DE_ImportSentimentDict));

            d_DE_ImportUserDict = (D_DE_ImportUserDict)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "DE_ImportUserDict", typeof(D_DE_ImportUserDict));

            d_DE_ImportKeyBlackList = (D_DE_ImportKeyBlackList)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "DE_ImportUserDict", typeof(D_DE_ImportKeyBlackList));

            d_DE_ComputeSentimentDoc = (D_DE_ComputeSentimentDoc)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "DE_ComputeSentimentDoc", typeof(D_DE_ComputeSentimentDoc));

            d_DE_Exit = (D_DE_Exit)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "DE_Exit", typeof(D_DE_Exit));

            if (d_DE_Exit == null || d_DE_ComputeSentimentDoc == null ||
                d_DE_ImportKeyBlackList == null || d_DE_ImportUserDict == null ||
                d_DE_ImportSentimentDict == null || d_DE_ReleaseHandle == null ||
                d_DE_GetSentimentScore == null || d_DE_GetLastErrMsg == null ||
                d_DE_GetResult == null || d_DE_ParseDocE == null ||
                d_DE_Init == null)
            {
                return(false);
            }

            return(true);
        }
Exemple #12
0
    private void OptimizeForTargetLocation()
    {
        Vector2 targetPos = Camera.main.ScreenToWorldPoint(
            new Vector3(Input.mousePosition.x, Input.mousePosition.y, -Camera.main.transform.position.z));

        Debug.Log("Optimize edge lengths to move target vertex towards " + targetPos);
        bool success = DllWrapper.OptimizeForTargetLocation(jointToBeOptimized.index, targetPos);

        if (success)
        {
            Debug.Log("Sucessfully optimized");
        }
        else
        {
            Debug.Log("Optimization failed");
        }
    }
        static void Main(string[] args)
        {
            DllWrapper wrapper = new DllWrapper();

            int testOneResult = wrapper.GetOne();

            Console.WriteLine($"GetOne() returned {testOneResult}");

            int testTwoResult = wrapper.GetTwo();

            Console.WriteLine($"GetTwo() returned {testTwoResult}");

            DllWrapper.ManagedData data = new DllWrapper.ManagedData();
            wrapper.GetThree(out data);
            Console.WriteLine($"GetThree() returned {data.BigValue} and \"{data.Text}\"");

            Console.Read();
        }
Exemple #14
0
    private void SimulateLinkages()
    {
        List <Joint> calculated = new List <Joint>();

        foreach (Joint current in orderedJoints)
        {
            List <Joint> fixedJoints = new List <Joint>();
            foreach (Edge edge in current.edges)
            {
                Joint adj = edge.GetOtherJoint(current);
                if (adj.isAnchored || calculated.Contains(adj))
                {
                    fixedJoints.Add(adj);
                    if (fixedJoints.Count >= 2)
                    {
                        break;
                    }
                }
            }

            // ensure correct order of i and j
            int     indexI = 0, indexJ = 1;
            Vector3 triNormal = new Plane(
                fixedJoints[indexI].transform.position,
                fixedJoints[indexJ].transform.position,
                current.transform.position).normal;
            if (triNormal.z < 0)
            {
                indexI = 1; indexJ = 0;
            }

            // i, j, k according to Disney paper
            Vector3 i      = fixedJoints[indexI].transform.position;
            Vector3 j      = fixedJoints[indexJ].transform.position;
            float   distIK = fixedJoints[indexI].GetEdgeToJoint(current).length;
            float   distJK = fixedJoints[indexJ].GetEdgeToJoint(current).length;

            Vector3 k = DllWrapper.SymbolicKinematic(i, j, distIK, distJK);
            current.transform.position = k;

            calculated.Add(current);
        }
    }
Exemple #15
0
        protected override bool InitFunctions()
        {
            d_DC_Init = (D_DC_Init)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "DC_Init", typeof(D_DC_Init));

            d_DC_Exit = (D_DC_Exit)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "DC_Exit", typeof(D_DC_Exit));

            d_DC_AddTrain = (D_DC_AddTrain)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "DC_AddTrain", typeof(D_DC_AddTrain));

            d_DC_AddTrainFile = (D_DC_AddTrainFile)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "DC_AddTrainFile", typeof(D_DC_AddTrainFile));

            d_DC_Train = (D_DC_Train)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "DC_Train", typeof(D_DC_Train));

            d_DC_LoadTrainResult = (D_DC_LoadTrainResult)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "DC_LoadTrainResult", typeof(D_DC_LoadTrainResult));

            d_DC_Classify = (D_DC_Classify)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "DC_Classify", typeof(D_DC_Classify));

            d_DC_ClassifyFile = (D_DC_ClassifyFile)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "DC_ClassifyFile", typeof(D_DC_ClassifyFile));

            d_DC_GetLastErrorMsg = (D_DC_GetLastErrorMsg)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "DC_GetLastErrorMsg", typeof(D_DC_GetLastErrorMsg));

            if (d_DC_Init == null || d_DC_Exit == null || d_DC_AddTrain == null ||
                d_DC_AddTrainFile == null || d_DC_Train == null || d_DC_LoadTrainResult == null ||
                d_DC_Classify == null || d_DC_ClassifyFile == null || d_DC_GetLastErrorMsg == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemple #16
0
 public ShapedForm()
 {
     if (ShapedForm.dllWrapper == null)
     {
         ShapedForm.dllWrapper = new DllWrapper("dwmapi.dll");
         if (ShapedForm.dllWrapper.IsDllLoaded)
         {
             ShapedForm.dwmIsCompositionEnabled = (ShapedForm.DwmIsCompositionEnabled)ShapedForm.dllWrapper.GetFunctionAsDelegate("DwmIsCompositionEnabled", typeof(ShapedForm.DwmIsCompositionEnabled));
             if (ShapedForm.dwmIsCompositionEnabled != null)
             {
                 bool isEnabled = false;
                 int  num       = ShapedForm.dwmIsCompositionEnabled(ref isEnabled);
                 if (isEnabled)
                 {
                     ShapedForm.dwmEnableBlurBehindWindow = (ShapedForm.DwmEnableBlurBehindWindow)ShapedForm.dllWrapper.GetFunctionAsDelegate("DwmEnableBlurBehindWindow", typeof(ShapedForm.DwmEnableBlurBehindWindow));
                     ShapedForm.isCompositionAvailable    = true;
                 }
             }
         }
     }
     this.InitializeComponent();
 }
Exemple #17
0
        protected override bool InitFunctions()
        {
            d_DS_Init = (D_DS_Init)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "DS_Init", typeof(D_DS_Init));

            d_DS_SingleDoc = (D_DS_SingleDoc)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "DS_SingleDoc", typeof(D_DS_SingleDoc));

            d_DS_Exit = (D_DS_Exit)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "DS_Exit", typeof(D_DS_Exit));

            d_DS_GetLastErrMsg = (D_DS_GetLastErrMsg)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "DS_GetLastErrMsg", typeof(D_DS_GetLastErrMsg));

            if (d_DS_Init == null || d_DS_SingleDoc == null ||
                d_DS_Exit == null || d_DS_GetLastErrMsg == null)
            {
                return(false);
            }

            return(true);
        }
Exemple #18
0
        protected override bool InitFunctions()
        {
            d_KeyExtract_Init = (D_KeyExtract_Init)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "KeyExtract_Init", typeof(D_KeyExtract_Init));

            d_KeyExtract_GetKeyWords = (D_KeyExtract_GetKeyWords)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "KeyExtract_GetKeyWords", typeof(D_KeyExtract_GetKeyWords));

            d_KeyExtract_Exit = (D_KeyExtract_Exit)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "KeyExtract_Exit", typeof(D_KeyExtract_Exit));

            d_KeyExtract_GetFileKeyWords = (D_KeyExtract_GetFileKeyWords)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "KeyExtract_GetFileKeyWords", typeof(D_KeyExtract_GetFileKeyWords));

            if (d_KeyExtract_Init == null || d_KeyExtract_GetKeyWords == null ||
                d_KeyExtract_Exit == null || d_KeyExtract_GetFileKeyWords == null)
            {
                return(false);
            }

            return(true);
        }
Exemple #19
0
        protected override bool InitFunctions()
        {
            d_Classifier_Init = (D_Classifier_Init)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "classifier_init", typeof(D_Classifier_Init));

            d_Classifier_Exit = (D_Classifier_Exit)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "classifier_exit", typeof(D_Classifier_Exit));

            d_Classifier_Exec = (D_Classifier_Exec)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "classifier_exec", typeof(D_Classifier_Exec));

            d_Classifier_Detail = (D_Classifier_Detail)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "classifier_detail", typeof(D_Classifier_Detail));

            if (d_Classifier_Init == null || d_Classifier_Exit == null ||
                d_Classifier_Exec == null || d_Classifier_Detail == null)
            {
                return(false);
            }

            return(true);
        }
Exemple #20
0
        protected override bool InitFunctions()
        {
            d_CLUS_Init = (D_CLUS_Init)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "CLUS_Init", typeof(D_CLUS_Init));

            d_CLUS_SetParameter = (D_CLUS_SetParameter)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "CLUS_SetParameter", typeof(D_CLUS_SetParameter));

            d_CLUS_AddContent = (D_CLUS_AddContent)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "CLUS_AddContent", typeof(D_CLUS_AddContent));

            d_CLUS_AddFile = (D_CLUS_AddFile)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "CLUS_AddFile", typeof(D_CLUS_AddFile));

            d_CLUS_GetLatestResult = (D_CLUS_GetLatestResult)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "CLUS_GetLatestResult", typeof(D_CLUS_GetLatestResult));

            d_CLUS_CleanData = (D_CLUS_CleanData)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "CLUS_AddFile", typeof(D_CLUS_CleanData));

            d_CLUS_Exit = (D_CLUS_Exit)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "CLUS_GetLatestResult", typeof(D_CLUS_Exit));

            d_CLUS_GetLastErrMsg = (D_CLUS_GetLastErrMsg)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "CLUS_Exit", typeof(D_CLUS_GetLastErrMsg));

            if (d_CLUS_Init == null || d_CLUS_SetParameter == null ||
                d_CLUS_AddContent == null || d_CLUS_AddFile == null ||
                d_CLUS_GetLatestResult == null || d_CLUS_CleanData == null ||
                d_CLUS_Exit == null || d_CLUS_GetLastErrMsg == null)
            {
                return(false);
            }

            return(true);
        }
Exemple #21
0
/*
 *      private Dictionary<Type, Delegate> delegates = new Dictionary<Type, Delegate>()
 *      {
 *          { typeof(D_JZIndexer_Init), null},
 *          { typeof(D_JZIndexer_FieldAdd), null},
 *          { typeof(D_JZIndexer_FieldSave), null},
 *          { typeof(D_JZIndexer_FieldLoad), null},
 *          { typeof(D_JZIndexer_NewInstance), null},
 *          { typeof(D_JZIndexer_MemIndexing), null},
 *          { typeof(D_JZIndexer_FileIndexing), null},
 *          { typeof(D_JZIndexer_BigFileIndexing), null},
 *          { typeof(D_JZIndexer_IntIndexing), null},
 *          { typeof(D_JZIndexer_FloatIndexing), null},
 *          { typeof(D_JZIndexer_Save), null},
 *          { typeof(D_JZIndexer_AddDoc), null},
 *          { typeof(D_JZIndexer_DeleteInstance), null},
 *          { typeof(D_JZIndexer_Exit), null},
 *          { typeof(D_JZSearch_Init), null},
 *          { typeof(D_JZSearch_Reload), null},
 *          { typeof(D_JZSearch_Exit), null},
 *          { typeof(D_JZSearcher_NewInstance), null},
 *          { typeof(D_JZSearcher_Search), null},
 *          { typeof(D_JZSearcher_DeleteInstance), null},
 *          { typeof(D_JZSearch_SetAbstractArgu), null},
 *      };
 */

        protected override bool InitFunctions()
        {
            d_JZIndexer_Init = (D_JZIndexer_Init)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "JZIndexer_Init", typeof(D_JZIndexer_Init));

            d_JZIndexer_FieldAdd = (D_JZIndexer_FieldAdd)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "JZIndexer_FieldAdd", typeof(D_JZIndexer_FieldAdd));

            d_JZIndexer_FieldSave = (D_JZIndexer_FieldSave)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "JZIndexer_FieldSave", typeof(D_JZIndexer_FieldSave));

            d_JZIndexer_FieldLoad = (D_JZIndexer_FieldLoad)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "JZIndexer_FieldLoad", typeof(D_JZIndexer_FieldLoad));

            d_JZIndexer_NewInstance = (D_JZIndexer_NewInstance)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "JZIndexer_NewInstance", typeof(D_JZIndexer_NewInstance));

            d_JZIndexer_MemIndexing = (D_JZIndexer_MemIndexing)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "JZIndexer_MemIndexing", typeof(D_JZIndexer_MemIndexing));

            d_JZIndexer_FileIndexing = (D_JZIndexer_FileIndexing)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "JZIndexer_FileIndexing", typeof(D_JZIndexer_FileIndexing));

            d_JZIndexer_BigFileIndexing = (D_JZIndexer_BigFileIndexing)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "JZIndexer_BigFileIndexing", typeof(D_JZIndexer_BigFileIndexing));

            d_JZIndexer_IntIndexing = (D_JZIndexer_IntIndexing)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "JZIndexer_IntIndexing", typeof(D_JZIndexer_IntIndexing));

            d_JZIndexer_FloatIndexing = (D_JZIndexer_FloatIndexing)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "JZIndexer_FloatIndexing", typeof(D_JZIndexer_FloatIndexing));

            d_JZIndexer_Save = (D_JZIndexer_Save)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "JZIndexer_Save", typeof(D_JZIndexer_Save));

            d_JZIndexer_AddDoc = (D_JZIndexer_AddDoc)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "JZIndexer_AddDoc", typeof(D_JZIndexer_AddDoc));

            d_JZIndexer_DeleteInstance = (D_JZIndexer_DeleteInstance)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "JZIndexer_DeleteInstance", typeof(D_JZIndexer_DeleteInstance));

            d_JZIndexer_Exit = (D_JZIndexer_Exit)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "JZIndexer_Exit", typeof(D_JZIndexer_Exit));

            d_JZSearch_Init = (D_JZSearch_Init)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "JZSearch_Init", typeof(D_JZSearch_Init));

            d_JZSearch_Reload = (D_JZSearch_Reload)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "JZSearch_Reload", typeof(D_JZSearch_Reload));

            d_JZSearch_Exit = (D_JZSearch_Exit)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "JZSearch_Exit", typeof(D_JZSearch_Exit));

            d_JZSearcher_NewInstance = (D_JZSearcher_NewInstance)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "JZSearcher_NewInstance", typeof(D_JZSearcher_NewInstance));

            d_JZSearcher_Search = (D_JZSearcher_Search)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "JZSearcher_Search", typeof(D_JZSearcher_Search));

            d_JZSearcher_DeleteInstance = (D_JZSearcher_DeleteInstance)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "JZSearcher_DeleteInstance", typeof(D_JZSearcher_DeleteInstance));

            d_JZSearch_SetAbstractArgu = (D_JZSearch_SetAbstractArgu)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "JZSearch_SetAbstractArgu", typeof(D_JZSearch_SetAbstractArgu));

            d_JZSearch_DocDelete = (D_JZSearch_DocDelete)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "JZSearch_DocDelete", typeof(D_JZSearch_DocDelete));

            d_JZSearch_SetIndexSizeLimit = (D_JZSearch_SetIndexSizeLimit)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "JZSearch_SetIndexSizeLimit", typeof(D_JZSearch_SetIndexSizeLimit));

            if (d_JZSearcher_DeleteInstance == null || d_JZSearcher_Search == null ||
                d_JZSearcher_NewInstance == null || d_JZSearch_Exit == null ||
                d_JZSearch_Reload == null || d_JZSearch_Init == null ||
                d_JZIndexer_Exit == null || d_JZIndexer_DeleteInstance == null ||
                d_JZIndexer_AddDoc == null || d_JZIndexer_Save == null ||
                d_JZIndexer_FloatIndexing == null || d_JZIndexer_IntIndexing == null ||
                d_JZIndexer_BigFileIndexing == null || d_JZIndexer_FileIndexing == null ||
                d_JZIndexer_MemIndexing == null || d_JZIndexer_NewInstance == null ||
                d_JZIndexer_FieldLoad == null || d_JZIndexer_FieldSave == null ||
                d_JZIndexer_FieldAdd == null || d_JZIndexer_Init == null ||
                d_JZSearch_SetAbstractArgu == null || d_JZSearch_DocDelete == null ||
                d_JZSearch_SetIndexSizeLimit == null)
            {
                return(false);
            }

            return(true);
            // return InitFunctions(delegates);
        }
Exemple #22
0
        protected override bool InitFunctions()
        {
            d_NLPIR_Init = (D_NLPIR_Init)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "NLPIR_Init", typeof(D_NLPIR_Init));

            d_NLPIR_GetLastErrorMsg = (D_NLPIR_GetLastErrorMsg)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "NLPIR_GetLastErrorMsg", typeof(D_NLPIR_GetLastErrorMsg));

            d_NLPIR_ParagraphProcess = (D_NLPIR_ParagraphProcess)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "NLPIR_ParagraphProcess", typeof(D_NLPIR_ParagraphProcess));

            d_NLPIR_FileProcess = (D_NLPIR_FileProcess)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "NLPIR_FileProcess", typeof(D_NLPIR_FileProcess));

            d_NLPIR_FinerSegment = (D_NLPIR_FinerSegment)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "NLPIR_FinerSegment", typeof(D_NLPIR_FinerSegment));

            d_NLPIR_GetKeyWords = (D_NLPIR_GetKeyWords)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "NLPIR_GetKeyWords", typeof(D_NLPIR_GetKeyWords));

            d_NLPIR_GetFileKeyWords = (D_NLPIR_GetFileKeyWords)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "NLPIR_GetFileKeyWords", typeof(D_NLPIR_GetFileKeyWords));

            d_NLPIR_GetNewWords = (D_NLPIR_GetNewWords)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "NLPIR_GetNewWords", typeof(D_NLPIR_GetNewWords));

            d_NLPIR_GetFileNewWords = (D_NLPIR_GetFileNewWords)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "NLPIR_GetFileNewWords", typeof(D_NLPIR_GetFileNewWords));

            d_NLPIR_AddUserWord = (D_NLPIR_AddUserWord)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "NLPIR_AddUserWord", typeof(D_NLPIR_AddUserWord));

            d_NLPIR_ImportUserDict = (D_NLPIR_ImportUserDict)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "NLPIR_ImportUserDict", typeof(D_NLPIR_ImportUserDict));

            d_NLPIR_Exit = (D_NLPIR_Exit)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "NLPIR_Exit", typeof(D_NLPIR_Exit));

            d_NLPIR_ImportKeyBlackList = (D_NLPIR_ImportKeyBlackList)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "NLPIR_ImportKeyBlackList", typeof(D_NLPIR_ImportKeyBlackList));

            d_NLPIR_FingerPrint = (D_NLPIR_FingerPrint)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "NLPIR_FingerPrint", typeof(D_NLPIR_FingerPrint));

            d_NLPIR_GetWordPOS = (D_NLPIR_GetWordPOS)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "NLPIR_GetWordPOS", typeof(D_NLPIR_GetWordPOS));

            d_NLPIR_IsWord = (D_NLPIR_IsWord)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "NLPIR_IsWord", typeof(D_NLPIR_IsWord));

            d_NLPIR_WordFreqStat = (D_NLPIR_WordFreqStat)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "NLPIR_WordFreqStat", typeof(D_NLPIR_WordFreqStat));

            d_NLPIR_FileWordFreqStat = (D_NLPIR_FileWordFreqStat)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "NLPIR_FileWordFreqStat", typeof(D_NLPIR_FileWordFreqStat));

            d_NLPIR_GetEngWordOrign = (D_NLPIR_GetEngWordOrign)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "NLPIR_GetEngWordOrign", typeof(D_NLPIR_GetEngWordOrign));

            d_NLPIR_SaveTheUsrDic = (D_NLPIR_SaveTheUsrDic)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "NLPIR_SaveTheUsrDic", typeof(D_NLPIR_SaveTheUsrDic));

            d_NLPIR_DelUsrWord = (D_NLPIR_DelUsrWord)DllWrapper.GetFunctionAddress(
                DllWrapper.hModule, "NLPIR_DelUsrWord", typeof(D_NLPIR_DelUsrWord));

            if (d_NLPIR_Init == null || d_NLPIR_GetLastErrorMsg == null || d_NLPIR_ParagraphProcess == null || d_NLPIR_FileProcess == null ||
                d_NLPIR_FinerSegment == null || d_NLPIR_GetKeyWords == null || d_NLPIR_GetFileKeyWords == null || d_NLPIR_GetNewWords == null ||
                d_NLPIR_GetFileNewWords == null || d_NLPIR_AddUserWord == null || d_NLPIR_ImportUserDict == null || d_NLPIR_Exit == null ||
                d_NLPIR_ImportKeyBlackList == null || d_NLPIR_FingerPrint == null || d_NLPIR_GetWordPOS == null || d_NLPIR_IsWord == null ||
                d_NLPIR_WordFreqStat == null || d_NLPIR_FileWordFreqStat == null || d_NLPIR_GetEngWordOrign == null || d_NLPIR_DelUsrWord == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }