Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by phonearc · Jun 24, 2016 at 04:59 AM · build-errorwindows phone 8framework

Getting a Build error for Windows Phone 8 Platform, It's working fine in PC

Error building Player: Exception: Error: method System.Void System.IO.File::AppendAllText(System.String,System.String) doesn't exist in target framework. It is referenced from Assembly-CSharp.dll at System.Void CSVReader::SaveScoreToCsv(Score).

Error: method System.String[] System.IO.File::ReadAllLines(System.String) doesn't exist in target framework. It is referenced from Assembly-CSharp.dll at System.Void CSVReader::ReadDescp(System.String).

Error: method System.String[] System.IO.File::ReadAllLines(System.String) doesn't exist in target framework. It is referenced from Assembly-CSharp.dll at System.Void CSVReader::ReadGeneralSetting().

Code for CSVReader is as following::

using UnityEngine; using System.Collections; using System.Collections.Generic; using System.IO; using System.Text; using System; using System.Linq; using UnityEngine.UI;

public class CSVReader : MonoBehaviour { public TextAsset QuestionMSTxt; public TextAsset scoreSettingText;

 public static GeneralSettings generalSettings;

 string[] lines = null;

 public static IList<MultipleQuestionAnswer> MCQList;
 public static ScoreSettings scoreSettings;
 public static GameDiscription GameDiscription;

 public Text TitleText;
 public Text DescriptionText;

 public GameObject HomeScreen;
 public GameObject UsernameInputContainer;

 void Awake()
 {
     ReadGeneralSetting();

     ReadGameDescription();

     if (GameDiscription != null)
     {
         TitleText.text = GameDiscription.heading;
         DescriptionText.text = GameDiscription.description;
     }

 }

 void Start()
 {
     if (QuestionMSTxt != null)
     {
         ReadquestionnaireCSV(FindCSV("MSQuestions.csv", QuestionMSTxt));
     }

     if (scoreSettingText != null)
     {
         ReadScoreSettingsCSV(FindCSV("ScoreSettings.csv", scoreSettingText));
     }

 }

 private string[] InitializeQuestions()
 {
     if (Application.platform == RuntimePlatform.WindowsPlayer)
     {
         int tmpIndex = Application.dataPath.LastIndexOf('/');
         if (tmpIndex > 0)
         {
             string tmpPath = Application.dataPath.Substring(0, tmpIndex);
             tmpPath += "/Configs/MSQuestions.csv";
             if (File.Exists(tmpPath))
             {
                 StreamReader sr = new StreamReader(File.OpenRead(tmpPath));
                 lines = sr.ReadToEnd().Split('\n');
                 sr.Close();
             }
         }
     }
     else
     {
         lines = QuestionMSTxt.text.Split('\n');
     }

     if (lines == null)
     {
         Debug.Log("Couldnt find Questionaire in EXE. Loading default");
         lines = QuestionMSTxt.text.Split('\n');
     }
     return lines;
 }

 string[] FindCSV(string path, TextAsset asset)
 {
     if (Application.platform == RuntimePlatform.WindowsPlayer)
     {
         Debug.Log(" FIND CSV : " + path);
         Debug.Log(generalSettings.configPath + path);
         
         if (File.Exists(generalSettings.configPath + path))
         {
             Debug.Log("in general settings");
             StreamReader sr = new StreamReader(File.OpenRead(generalSettings.configPath + path));
             lines = sr.ReadToEnd().Split('\n');
             sr.Close();
         }
         else
         {

             int tmpIndex = Application.dataPath.LastIndexOf('/');
             string tmpPath = Application.dataPath.Substring(0, tmpIndex);
             tmpPath += "/Configs/" + path;
             Debug.Log(tmpPath + "in else");
             if (File.Exists(tmpPath))
             {
                 Debug.Log("in ifd;lakj");
                 StreamReader sr = new StreamReader(File.OpenRead(tmpPath));
                 lines = sr.ReadToEnd().Split('\n');
                 sr.Close();
             }
         }
     }
     else
     {
         lines = asset.text.Split('\n');
     }

     if (lines == null)
     {
         Debug.Log("Couldnt find File in EXE. Loading default");
         lines = asset.text.Split('\n');
     }

     return lines;
 }

 void ReadScoreSettingsCSV(string[] data)
 {
     scoreSettings = new ScoreSettings();
     List<string[]> stringData = new List<string[]>();

     foreach (string s in data)
     {
         stringData.Add(s.Split(','));
     }

     int.TryParse(stringData[1][1], out scoreSettings.missionTimeScore);
     int.TryParse(stringData[2][1], out scoreSettings.missionTimerScore);
     int.TryParse(stringData[3][1], out scoreSettings.MapPuzzle);
     int.TryParse(stringData[4][1], out scoreSettings.JigSawPuzzle);
     int.TryParse(stringData[5][1], out scoreSettings.WindowsPuzzle);
     int.TryParse(stringData[6][1], out scoreSettings.Questions);


 }

 private void ReadquestionnaireCSV(string[] data)
 {
     MCQList = new List<MultipleQuestionAnswer>();
     for (int i = 1; i < data.Length; i++)
     {
         string[] fields = data[i].Split(',');
         if (fields.Length <= 1)
         {
         }
         else
         {
             MultipleQuestionAnswer _mtmp = new MultipleQuestionAnswer();
             if (fields[0].Length > 0)
             {
                 _mtmp.Question = fields[0];
                 _mtmp.Answer = new List<string>();
                 if (fields[1].Length > 0)
                 {
                     _mtmp.CorrectAnswer = fields[1];
                     for (int j = 1; j < fields.Length; j++)
                     {
                         _mtmp.Answer.Add(fields[j]);
                     }
                     MCQList.Add(_mtmp);
                 }
             }
         }
     }
 }

 //TODO update score. Writing dummy value for now
 public static void SaveScoreToCsv(Score scoreDetails)
 {
     var csv = new StringBuilder();
     csv.AppendLine(scoreDetails.scoreBreakdown);

     if (Application.platform == RuntimePlatform.WindowsPlayer)
     {
         string path = null;

         if (!CSVReader.generalSettings.useLocal)
         {
             path = CSVReader.generalSettings.configPath + "/Scores.csv";
         }
         else
         {
             int tmpIndex = Application.dataPath.LastIndexOf('/');
             string tmpPath = Application.dataPath.Substring(0, tmpIndex);
             tmpPath += "/Configs/Scores.csv";
             path = tmpPath;
         }

         try
         {
             File.AppendAllText(path, csv.ToString());
         }
         catch (Exception e)
         {
             Debug.Log("Error saving to scores");
         }
     }
 }

 public void ReadGameDescription()
 {
     if (Application.platform == RuntimePlatform.WindowsPlayer)
     {
         var tmpPath = generalSettings.configPath + "Description.txt";

         if (File.Exists(tmpPath))
         {
             ReadDescp(tmpPath);
         }
         else 
         {
             int tmpIndex = Application.dataPath.LastIndexOf('/');
             tmpPath = Application.dataPath.Substring(0, tmpIndex);
             tmpPath += "/Configs/Description.txt";
             generalSettings.useLocal = true;
             if(File.Exists(tmpPath))
                 ReadDescp(tmpPath);
         }
     }
 }

 void ReadDescp(string path) {
     string[] descriptions = System.IO.File.ReadAllLines(path);
     GameDiscription = new GameDiscription();
     GameDiscription.heading = descriptions[0];
     var totalDesc = "";
     for (int i = 1; i < descriptions.Length; i++)
     {
         totalDesc += descriptions[i];
     }
     GameDiscription.description = totalDesc;
 }

 public void PlayBtnClicked()
 {
     HomeScreen.SetActive(false);
     UsernameInputContainer.SetActive(true);
 }

 public void ReadGeneralSetting() {
     if (Application.platform == RuntimePlatform.WindowsPlayer)
     {
         int tmpIndex = Application.dataPath.LastIndexOf('/');
         if (tmpIndex > 0)
         {
             string tmpPath = Application.dataPath.Substring(0, tmpIndex);
             tmpPath += "/Configs/Settings.csv";
             if (File.Exists(tmpPath))
             {
                 string[] descriptions = System.IO.File.ReadAllLines(tmpPath);
                 generalSettings = new GeneralSettings();
                 
                 var desc = descriptions[0].Split(',');
                 int.TryParse(desc[1], out generalSettings.timeOut);

                 desc = descriptions[1].Split(',');
                 desc[1] = desc[1].Replace(@"\", "\\");
                 generalSettings.configPath = desc[1];
                 
                 desc = descriptions[2].Split(',');
                 int.TryParse(desc[1], out generalSettings.lobbyWaitTime);
             }
         }
     }

     if (generalSettings == null)
     {
         generalSettings = new GeneralSettings();
         generalSettings.timeOut = 60;
         generalSettings.configPath = "/Configs/";
         generalSettings.lobbyWaitTime = 100;
         generalSettings.useLocal = true;
     }

     Debug.Log("Config Path: " + generalSettings.configPath);
 }

} Thanks in advance Jash

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers

Unity 5 Windows Phone 8.1 Build Error 0 Answers

XCode Swift Compiler Error Use of Unresolved Identifier "UnitySendMessage" how to fix? 2 Answers

arm64 function not 4-byte aligned _unwind_tester from libiphone-lib.a(unwind_test_arm64.o).,106 duplicate symbols -arm64 function not 4-byte aligned _unwind_tester from libiphone-lib.a(unwind_test_arm64.o) 2 Answers

How can I stop the variable values reverting to its default values after being built? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges