123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Runtime.Serialization.Formatters.Binary;
- using System.Runtime.Serialization;
- using System.Text;
- using System.Threading.Tasks;
- namespace Venus_MainPages.Unity
- {
- public static class CommonFunction
- {
- //internal T
- public static T GetValue<T>(Dictionary<string, object> RtDataValues, string str)
- {
- if (RtDataValues.Keys.Contains(str))
- {
- try
- {
- if(RtDataValues[str]!=null)
- return (T)Convert.ChangeType(RtDataValues[str], typeof(T));
- else
- {
- return default(T);
- }
-
- }
- catch
- {
- return default(T);
- }
- }
- else
- {
- return default(T);
- }
- }
- public static IEnumerable<string> GetFilesNames(string path)
- {
- if (Directory.Exists(path))
- {
- return Directory.GetFiles(path, "*.rcp")?
- .Select(Path.GetFileNameWithoutExtension);
- }
- else
- {
- return new List<string>();
- }
- }
- }
- }
|