public String ReadData()
        {
            HECRASController hrc = new HECRASController();

            hrc.Project_Open(@"C:\Users\hqngh\OneDrive\Documents\Hello World Coupling\HelloWorldCoupling.prj");

            int    nmsg   = 0;
            bool   block  = true;
            Array  sa     = null;
            String result = "";

            try
            {
                hrc.Compute_HideComputationWindow();

                hrc.Compute_CurrentPlan(ref nmsg, ref sa);
            }
            catch (Exception ex)
            {
                result = ex.ToString();
            }
            hrc.Project_Close();
            hrc.QuitRas();
            return(result);
        }
Esempio n. 2
0
    void Start()
    {
        hrc = new HECRASController();
        //--------------------------------------------
        int   nmsg  = 0;
        bool  block = true;
        Array sa    = null;

        hrc.Project_Open("C:/Users/admin/Documents/HEC Data/HEC-RAS/Example Projects/1D Steady Flow Hydraulics/Chapter 4 Example Data/Ex1.prj");
        Debug.Log(hrc.Project_Current());
        Debug.Log(hrc.CurrentGeomFile());
        Debug.Log(hrc.CurrentSteadyFile());
        Debug.Log(hrc.CurrentProjectFile());
        Debug.Log(hrc.CurrentPlanFile());
        hrc.Compute_ShowComputationWindow();

        try
        {
            hrc.Compute_CurrentPlan(ref nmsg, ref sa, ref block);
        }
        catch (Exception e)
        {
            Console.WriteLine(e.ToString());
        }
        //hrc = null; //kills the process faster than waiting for GC
        //--------------------------------------------
        //Console.WriteLine("Press any key to quit.");
        //Console.ReadKey();
        hrc.Project_Save();
        hrc.Project_Close();
        hrc.QuitRas();
    }
 public string Project_Open(string path)
 {
     hrc.Project_Open(path);
     return("");
 }