locked
Migration from system.io.fileinfo to windows.Storage

    Question

  • hi all :)

    can anyone help me to change the script below from using system.io to windows.storage ..

    sourceFile = new FileInfo(path); //Application.dataPath + "/Models/" + 
            if (sourceFile != null && sourceFile.Exists)
                reader = new StreamReader(path);
     
            if (reader == null)
            {
                Debug.Log(sourceFile + " not found");
            } // if
            else
            {
                string nameExt = sourceFile.Name;
                string nameShort = nameExt.Substring(0, nameExt.Length - 4); //name without extension
     
                baseGO = new GameObject(nameShort);
                impMeshes = new List<ClassImpMesh>();
                depth = 0;
                iterator = 0;
     
                //read entire file into char array
                //reader.BaseStream.Seek(0,SeekOrigin.Begin);
                reader.BaseStream.Position = 0;
                reader.DiscardBufferedData();
                //reader.BaseStream.Seek(0,SeekOrigin.End);
                fileCompl = reader.ReadToEnd();
                //fileCompl = new char[(int)reader.BaseStream.Position];
                //Debug.Log(reader.BaseStream.Position + " :reader pos;fileCompl size: " + fileCompl.Length);
                //reader.Read(fileCompl, 0, 12367);
                reader.Close();

    Monday, May 11, 2015 11:00 PM

Answers