Little Registry Cleaner/Common Tools/LittleSoftwareStats/Cache.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace LittleSoftwareStats
{
    public class Cache
    {
        private string FileName
        {
            get { return string.Format(@"{0}\{1}.{2}", Path.GetTempPath(), Config.AppId, Config.ApiFormat); }
        }

        public Cache()
        {
        }

        internal string GetCacheData()
        {
            string fileContents = "";

            if (File.Exists(FileName)) {
                fileContents = Utils.DecodeFrom64(File.ReadAllText(FileName));
            }

            return fileContents;
        }

        internal string GetPostData(Events events)
        {
            string cachedData = GetCacheData();
            string data = "";
            string output = "";

            if (Config.ApiFormat == "json")
                data = Utils.SerializeAsJSON(events);
            else
                data = Utils.SerializeAsXML(events);

            if (string.IsNullOrEmpty(cachedData))
            {
                if (Config.ApiFormat == "json")
                    output = "[" + data + "]";
                else
                    output = "<?xml version=\"1.0\"?><data>" + data + "</data>";
            }
            else
            {
                if (Config.ApiFormat == "json")
                    output += "[" + data;
                else
                    output += "<?xml version=\"1.0\"?><data>" + data;

                foreach (string line in cachedData.Split(Environment.NewLine.ToCharArray()))
                {
                    if (!string.IsNullOrEmpty(line.Trim()))
                    {
                        if (Config.ApiFormat == "json")
后面还有 39 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。