Пример #1
0
        public static string Test06()
        {
            System.IO.FileMode a = System.IO.FileMode.Create;

            Console.WriteLine("a=" + a);
            return(a.ToString());
        }
Пример #2
0
        private static bool GetFileStream(SaveSlot slot, System.IO.FileMode fileMode, ref System.IO.FileStream outFileStream)
        {
            UnityEngine.Debug.Assert(slot != SaveSlot.None);
            UnityEngine.Debug.Assert(outFileStream == null);

            outFileStream = null;

            try
            {
                string fullPath = GetSavePath(slot);
                outFileStream = new System.IO.FileStream(fullPath, fileMode);
            }
            catch (System.IO.IOException e)
            {
                UnityEngine.Debug.Log("Failed to get file stream with mode: " + fileMode.ToString() +
                                      ". Reason: " + e.Message);
                return(false);
            }
            catch (ArgumentException e)
            {
                UnityEngine.Debug.Log("Failed to get file stream with mode: " + fileMode.ToString() +
                                      ". Reason: " + e.Message);
                return(false);
            }
            catch (NotSupportedException e)
            {
                UnityEngine.Debug.Log("Failed to get file stream with mode: " + fileMode.ToString() +
                                      ". Reason: " + e.Message);
                return(false);
            }
            catch (System.Security.SecurityException e)
            {
                UnityEngine.Debug.Log("Failed to get file stream with mode: " + fileMode.ToString() +
                                      ". Reason: " + e.Message);
                return(false);
            }

            if (outFileStream == null)
            {
                UnityEngine.Debug.Log("Failed to open save file. Unknown reason.");
                return(false);
            }

            return(true);
        }