public void LoadPDBResource(string resource_name) { TextAsset text_data = Resources.Load(resource_name) as TextAsset; StringReader sr = new StringReader(text_data.text); //ReadPDB(sr); ControlMolecule.CreateMolecule(sr); }
public void LoadPDBRequest(string file_base_name, bool withData = true) { StreamReader sr; // FileInfo file=new FileInfo(file_base_name+".pdb"); sr = new StreamReader(file_base_name + ".pdb"); //ReadPDB(sr); ControlMolecule.CreateMolecule(sr); if (withData) { FileInfo fieldlinefile = new FileInfo(file_base_name + ".json"); FileInfo apffile = new FileInfo(file_base_name + ".apf"); if (fieldlinefile.Exists) { LoadJsonRequest("file://" + file_base_name + ".json", MoleculeModel.Offset); MoleculeModel.fieldLineFileExists = true; } else if (apffile.Exists) { LoadJsonRequest("file://" + file_base_name + ".apf", MoleculeModel.Offset); MoleculeModel.fieldLineFileExists = true; } else { MoleculeModel.fieldLineFileExists = false; MoleculeModel.FieldLineList = null; } FileInfo Surfacefile = new FileInfo(file_base_name + ".obj"); FileInfo Surfacefile0 = new FileInfo(file_base_name + "0.obj"); if (Surfacefile.Exists || Surfacefile0.Exists) { LoadOBJRequest(file_base_name); MoleculeModel.surfaceFileExists = true; GUIMoleculeController.modif = true; } else { MoleculeModel.surfaceFileExists = false; } FileInfo dxfile = new FileInfo(file_base_name + ".dx"); MoleculeModel.dxFileExists = false; // otherwise a molecule might load dx data from a previous molecule if (dxfile.Exists) { MoleculeModel.dxFileExists = true; LoadDxRequest(file_base_name + ".dx", MoleculeModel.Offset); } } }
public IEnumerator LoadPDBWWW(string file_name) { WWW www = new WWW(file_name); progress = 0; isDone = false; while (!www.isDone) { // Debug.Log("*** PDB: "+www.progress); progress = www.progress; yield return(new WaitForEndOfFrame()); } Debug.Log("read"); //ReadPDB(new StringReader(www.text)); ControlMolecule.CreateMolecule(new StringReader(www.text)); isDone = true; }
public void FetchPDB(string url, string id, string proxyserver = "", int proxyport = 0) { StreamReader sr; Stream dataStream = null; HttpWebResponse response = null; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url + id + ".pdb"); // If required by the server, set the credentials. request.Credentials = CredentialCache.DefaultCredentials; //Set proxy information if needed Debug.Log("LoadPDB: " + proxyserver + " " + proxyport); if (proxyserver != "") { request.Proxy = new WebProxy(proxyserver, proxyport); } // Get the response. response = (HttpWebResponse)request.GetResponse(); // Display the status. Debug.Log("LoadPDB Status :: " + response.StatusDescription); // Get the stream containing content returned by the server. dataStream = response.GetResponseStream(); // Open the stream using a StreamReader for easy access. sr = new StreamReader(dataStream); ControlMolecule.CreateMolecule(sr); //ReadPDB(sr); if (dataStream != null && response != null) { dataStream.Close(); response.Close(); } }