示例#1
0
        public void SerializeTest()
        {
            ApplicationInfoCollection collection = new ApplicationInfoCollection();
            ApplicationInfo           info       = new ApplicationInfo
            {
                Name      = "proc1",
                PPID      = 3333,
                IsRunning = true,
                Modules   = new List <ModuleInfo> {
                    new ModuleInfo {
                        Name = "lib.dll"
                    }
                }
            };

            collection.Add(info);
            string       result         = JsonSerializer.ConvertToJson(collection);
            const string expectedResult = "[{\"Name\":\"proc1\",\"PPID\":3333,\"StartTime\":null,\"ActivityTime\":null,\"EndTime\":null,\"IsRunning\":true,\"Modules\":[{\"Name\":\"lib.dll\"}]}]";

            Assert.AreEqual(result, expectedResult);
        }
示例#2
0
文件: Sync.cs 项目: terryxym/DiscuzNT
        /// <summary>
        /// 获取需要数据同步的应用程序列表
        /// </summary>
        /// <param name="actionName"></param>
        /// <returns></returns>
        private static ApplicationInfoCollection GetAsyncTarget(string action)
        {
            ApplicationInfoCollection appCollection = new ApplicationInfoCollection();
            APIConfigInfo             apiInfo       = APIConfigs.GetConfig();

            if (!apiInfo.Enable)
            {
                return(appCollection);
            }
            foreach (ApplicationInfo appInfo in apiInfo.AppCollection)
            {
                if (appInfo.SyncMode == 1 || (appInfo.SyncMode == 2 && Utils.InArray(action, appInfo.SyncList)))
                {
                    if (appInfo.SyncUrl.Trim() == string.Empty)
                    {
                        continue;
                    }
                    appCollection.Add(appInfo);
                }
            }
            return(appCollection);
        }