예제 #1
0
        public static T Load <T>(params string[] subPaths)
        {
            T      t;
            string fileName     = ProtoStorage.GetFileName(subPaths);
            string fileDataPath = ProtoStorage.GetFileDataPath(fileName);

            try
            {
                if (File.Exists(fileDataPath))
                {
                    using (FileStream fileStream = File.OpenRead(fileDataPath))
                    {
                        t = Serializer.Deserialize <T>(fileStream);
                    }
                    return(t);
                }
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                Interface.Oxide.LogException(string.Concat("Failed to load protobuf data from ", fileName), exception);
            }
            return(default(T));
        }
예제 #2
0
 public static bool Exists(params string[] subPaths)
 {
     return(File.Exists(ProtoStorage.GetFileDataPath(ProtoStorage.GetFileName(subPaths))));
 }