ShanxiKnowledgeBase/SXElectricity Marketing 2.0/Assets/Zion/Scripts/YL/AddConfing.cs

28 lines
685 B
C#

using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using static InterfaceManager;
public class AddConfing : MonoBehaviour
{
private void Awake()
{
string[] datas = ReadFromLocal("IPPort.txt").Split(':');
IP = datas[0];
Port = datas[1];
}
public string ReadFromLocal(string fileName)
{
string path = GetPath(fileName);
if (!File.Exists(path)) return "ÎÞ";
string data = File.ReadAllText(path);
return data;
}
public string GetPath(string fileName)
{
string path = Application.streamingAssetsPath + "/" + fileName;
return path;
}
}