ZoeAppClass/Assets/Scripts/GlobalClasses.cs

88 lines
2.1 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GlobalClasses : MonoBehaviour
{
[System.Serializable]
public class ClassInfo {
public string idCurso, nomeCurso;
[SerializeField]
public List<ClassDetailedInfo> infos;
}
[System.Serializable]
public class ClassDetailedInfo {
public int idclasses, idcourses, disabled, ordem, viewed, sprites, demo;
public string name, description;
}
public static string TratarTexto(string texto)
{
string returnTxt;
returnTxt = texto;
returnTxt = returnTxt.Trim();
returnTxt = returnTxt.Replace("&nbsp;", " ");
returnTxt = returnTxt.Trim();
return returnTxt;
}
public static string ImgOnSentence(string sent)
{
int theresImg = sent.IndexOf("src=");
int inicioImg = sent.IndexOf("<img");
if (theresImg != -1)
{
int endImg = sent.IndexOf("\" />") + 4;
string newsent = sent;
newsent = newsent.Remove(inicioImg, endImg - inicioImg);
int BeginImg = sent.IndexOf("<img ");
int EndImg = sent.IndexOf("\" />") + 4;
try
{
newsent = RemoverTagsHtml(sent.Remove(BeginImg, EndImg - BeginImg));
}
catch (Exception e)
{
}
return newsent;
}
else
{
return sent;
}
}
public static string RemoverTagsHtml(string Texto)
{
Texto = Texto.Replace("<p>", "");
Texto = Texto.Replace("</p>", "");
Texto = Texto.Replace("<br />", "\n");
return Texto;
}
public static string TakeIpFromHTML(string textImg)
{
int startindex = textImg.IndexOf("http");
if (startindex != -1)
{
string newtext = textImg;
newtext = newtext.Remove(0, startindex);
startindex = newtext.IndexOf("\\\"");
newtext = newtext.Remove(startindex);
return newtext;
}
else
{
return textImg;
}
}
}