{"id":19292427,"url":"https://github.com/crequency/common.activity","last_synced_at":"2025-04-22T07:31:43.542Z","repository":{"id":64010453,"uuid":"572100394","full_name":"Crequency/Common.Activity","owner":"Crequency","description":"A library for easy logging through form in Activity!","archived":false,"fork":false,"pushed_at":"2024-03-01T00:12:48.000Z","size":54,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-11-03T00:08:49.021Z","etag":null,"topics":["activity","library"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Crequency.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":["Dynesshely"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2022-11-29T14:55:26.000Z","updated_at":"2024-03-25T10:37:10.000Z","dependencies_parsed_at":"2024-02-11T21:16:26.090Z","dependency_job_id":"c229ebb5-63c8-415b-ac5e-b5a458639e6d","html_url":"https://github.com/Crequency/Common.Activity","commit_stats":{"total_commits":36,"total_committers":2,"mean_commits":18.0,"dds":0.02777777777777779,"last_synced_commit":"16712ec5e5e440d219351b5840417c468f2f0209"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Crequency%2FCommon.Activity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Crequency%2FCommon.Activity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Crequency%2FCommon.Activity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Crequency%2FCommon.Activity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Crequency","download_url":"https://codeload.github.com/Crequency/Common.Activity/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223892087,"owners_count":17220702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["activity","library"],"created_at":"2024-11-09T22:30:47.017Z","updated_at":"2024-11-09T22:32:12.871Z","avatar_url":"https://github.com/Crequency.png","language":"C#","funding_links":["https://github.com/sponsors/Dynesshely"],"categories":[],"sub_categories":[],"readme":"# About\n\nA library for easy logging through form in `Activity` !\n\n# Advantages\n\nWith this library, you can organize your program more structured.\n\nAnd you can use this library to realize some functions like workflows.\n\n# Usage\n\n## Install\n\nThrough cli:\n\n```shell\ndotnet add package Common.Activity\n```\n\n## Import namespace\n\n```csharp\nusing Common.Activity;\n```\n\n## Use\n\n```csharp\nvar activity = new Activity()\n    {\n        Id = 1,\n        Name = \"Activity_Calculate\",\n        Author = \"Author\",\n        IconKind = null,\n        Title = null,\n        Category = null,\n    }\n    .Open(\"samples\")\n    .Assign(\"samples\", \"samples\")\n    .Assign(\"samples\", \"computer\")\n    .RemoveAssign(\"samples\", \"samples\")\n    .Label(\"samples\", \"running\")\n    .AppendTask(\n        new ActivityTask()\n            {\n                Action = controller =\u003e\n                {\n                    controller.LogContents(0, $\"1 + 0 = {1 + 0}\");\n                    controller.Result = 1 + 0;\n                    controller.Progress = new Progress(ProgressType.Tasks)\n                    {\n                        Value = new Tuple\u003cint, int\u003e(1, 1)\n                    };\n                },\n            }\n            .AppendTask(\n                new ActivityTask()\n                {\n                    Action = controller =\u003e\n                    {\n                        controller.LogContents(0, $\"1 + 1 = {1 + 1}\");\n                        controller.Result = 1 + 1;\n                        controller.Progress = new Progress(ProgressType.Tasks)\n                        {\n                            Value = new Tuple\u003cint, int\u003e(1, 1)\n                        };\n                    }\n                }\n            )\n            .AppendTask(\n                new ActivityTask()\n                {\n                    Action = controller =\u003e\n                    {\n                        controller.LogContents(0, $\"1 + 2 = {1 + 2}\");\n                        controller.Result = 1 + 2;\n                        controller.Progress = new Progress(ProgressType.Tasks)\n                        {\n                            Value = new Tuple\u003cint, int\u003e(1, 1)\n                        };\n                    }\n                }\n            )\n    )\n    .ExecuteAllTasks();\n```\n\nIf you use JsonSerializer in `System.Text.Json` to serialize `activity`,\n\n```csharp\nvar options = new JsonSerializerOptions()\n{\n    WriteIndented = true,\n    IncludeFields = true,\n};\n\nConsole.WriteLine(\n    JsonSerializer.Serialize(activity, options)\n);\n```\n\nthe output would be like:\n\n```json\n{\n  \"Id\": 1,\n  \"Name\": \"Activity_Calculate\",\n  \"Author\": \"Samples\",\n  \"Title\": null,\n  \"Category\": null,\n  \"IconKind\": null,\n  \"Assigners\": [\n    \"computer\"\n  ],\n  \"Labels\": [\n    \"running\"\n  ],\n  \"Tasks\": [\n    {\n      \"Name\": null,\n      \"Progress\": {\n        \"Value\": {\n          \"Item1\": 1,\n          \"Item2\": 1\n        }\n      },\n      \"IsLoopTask\": false,\n      \"SubTasks\": [\n        {\n          \"Name\": null,\n          \"Progress\": {\n            \"Value\": {\n              \"Item1\": 1,\n              \"Item2\": 1\n            }\n          },\n          \"IsLoopTask\": false,\n          \"SubTasks\": [],\n          \"Contents\": {\n            \"0\": \"1 \\u002B 1 = 2\"\n          },\n          \"Warnings\": {},\n          \"Errors\": {},\n          \"Status\": 3,\n          \"Result\": 2\n        },\n        {\n          \"Name\": null,\n          \"Progress\": {\n            \"Value\": {\n              \"Item1\": 1,\n              \"Item2\": 1\n            }\n          },\n          \"IsLoopTask\": false,\n          \"SubTasks\": [],\n          \"Contents\": {\n            \"0\": \"1 \\u002B 2 = 3\"\n          },\n          \"Warnings\": {},\n          \"Errors\": {},\n          \"Status\": 3,\n          \"Result\": 3\n        }\n      ],\n      \"Contents\": {\n        \"0\": \"1 \\u002B 0 = 1\"\n      },\n      \"Warnings\": {},\n      \"Errors\": {},\n      \"Status\": 3,\n      \"Result\": 1\n    }\n  ],\n  \"Operations\": {\n    \"OpenAndCloseOperations\": [\n      {\n        \"Subject\": \"samples\",\n        \"ExecuteTime\": \"2023-05-12T13:52:29.8833534Z\",\n        \"Operation\": 0\n      }\n    ],\n    \"AssignersRelatedOperations\": [\n      {\n        \"Subject\": \"samples\",\n        \"ExecuteTime\": \"2023-05-12T13:52:29.8842917Z\",\n        \"Operation\": 0,\n        \"Targets\": [\n          \"samples\"\n        ]\n      },\n      {\n        \"Subject\": \"samples\",\n        \"ExecuteTime\": \"2023-05-12T13:52:29.8846075Z\",\n        \"Operation\": 0,\n        \"Targets\": [\n          \"computer\"\n        ]\n      },\n      {\n        \"Subject\": \"samples\",\n        \"ExecuteTime\": \"2023-05-12T13:52:29.8849135Z\",\n        \"Operation\": 1,\n        \"Targets\": [\n          \"samples\"\n        ]\n      }\n    ],\n    \"LabelsRelatedOperations\": [\n      {\n        \"Subject\": \"samples\",\n        \"ExecuteTime\": \"2023-05-12T13:52:29.8854133Z\",\n        \"Operation\": 0,\n        \"Targets\": [\n          \"running\"\n        ]\n      }\n    ]\n  },\n  \"Status\": 1\n}\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrequency%2Fcommon.activity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrequency%2Fcommon.activity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrequency%2Fcommon.activity/lists"}