예제 #1
0
 public static void DeleteFile(FileType fileType)
 {
     if (fileType == FileType.Account)
     {
         FileIOHelper.DeleteAccountFileOnApplieDevice();
     }
 }
예제 #2
0
 private static void SetAccountContent(string content)
 {
     if (GlobalManager.ClientType == 2)
     {
         FileIOHelper.PutAccountContentToAppleDevice(content);
     }
 }
예제 #3
0
        public static void WriteFile(FileType fileType, string content)
        {
            switch (fileType)
            {
            case FileType.Account:
                FileIOHelper.SetAccountContent(content);
                break;

            case FileType.DropCache:
                FileIOHelper.SetDropCache(content);
                break;

            case FileType.Duration:
                FileIOHelper.SetDuration(content);
                break;

            case FileType.SerializeError:
                FileIOHelper.SetSerializeError(content);
                break;

            case FileType.SuspendError:
                FileIOHelper.SetSuspendError(content);
                break;
            }
        }
예제 #4
0
 private static void DeleteAccountFileOnApplieDevice()
 {
     if (GlobalManager.ClientType == 2)
     {
         string accountFilePath = FileIOHelper.GetAccountFilePath();
         Log.debug("@@@@ DeleteAccountFileOnApplieDevice");
         if (File.Exists(accountFilePath))
         {
             Log.debug("@@@ begin to delete file!");
             File.Delete(accountFilePath);
         }
     }
 }
예제 #5
0
        private static string GetAccountContent()
        {
            string result;

            if (GlobalManager.ClientType == 2)
            {
                result = FileIOHelper.GetAccountContentFromAppleDevice();
            }
            else
            {
                result = null;
            }
            return(result);
        }
예제 #6
0
 private static void PutAccountContentToAppleDevice(string content)
 {
     if (GlobalManager.ClientType == 2)
     {
         string accountFilePath = FileIOHelper.GetAccountFilePath();
         if (File.Exists(accountFilePath))
         {
             File.Delete(accountFilePath);
         }
         FileStream fileStream = new FileStream(accountFilePath, FileMode.Create);
         byte[]     bytes      = new UTF8Encoding(true).GetBytes(content);
         fileStream.Write(bytes, 0, bytes.Length);
         fileStream.Close();
     }
 }
예제 #7
0
        private static string GetAccountContentFromAppleDevice()
        {
            string text = string.Empty;
            string result;

            if (GlobalManager.ClientType == 2)
            {
                string accountFilePath = FileIOHelper.GetAccountFilePath();
                if (!File.Exists(accountFilePath))
                {
                    result = text;
                    return(result);
                }
                FileStream   fileStream   = new FileStream(accountFilePath, FileMode.OpenOrCreate, FileAccess.Read);
                BinaryReader binaryReader = new BinaryReader(fileStream);
                int          num          = (int)fileStream.Length;
                byte[]       array        = new byte[num];
                binaryReader.Read(array, 0, array.Length);
                text = Encoding.Default.GetString(array);
                fileStream.Close();
            }
            result = text;
            return(result);
        }
예제 #8
0
        public static string ReadFile(FileType fileType)
        {
            string result;

            switch (fileType)
            {
            case FileType.Account:
                result = FileIOHelper.GetAccountContent();
                break;

            case FileType.DropCache:
                result = FileIOHelper.GetDropCache();
                break;

            case FileType.Duration:
                result = FileIOHelper.GetDuration();
                break;

            default:
                result = string.Empty;
                break;
            }
            return(result);
        }