chore: 初始化 TFS 2013 工作项批量导入工具集
- TfsExcelImporter: WinForms 桌面版,走 TFS Client OM(本环境 wit REST 路由 404,OM 是唯一可行通道) - tfs_import.py: REST 版命令行导入器,供 wit 接口可用的 TFS 实例使用 - templates: Excel 导入模板及其 OOXML 源部件 - README: 两套工具定位、配置、环境坑点与验证方式 - 真实台账与本机工作笔记不入库,仅提交 work_items.example.csv 说明列结构
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace TfsExcelImporter
|
||||
{
|
||||
/// <summary>
|
||||
/// 程序配置。保存于 exe 同目录 config.json,界面修改后自动写回。
|
||||
/// </summary>
|
||||
public class AppConfig
|
||||
{
|
||||
public string TfsUrl { get; set; } = "http://pdtfs01.dev.goldenstand.cn:8080/tfs/DefaultCollection";
|
||||
public string Project { get; set; } = "Tools_Dev";
|
||||
public string WorkItemType { get; set; } = "Task";
|
||||
|
||||
// 目标迭代:完整迭代路径,如 Tools_Dev\2026年Sprint\2026年Sprint10
|
||||
public string IterationPath { get; set; } = "";
|
||||
// 可选:区域路径
|
||||
public string AreaPath { get; set; } = "";
|
||||
|
||||
// ntlm | basic | default(当前 Windows 凭据)
|
||||
public string AuthMode { get; set; } = "ntlm";
|
||||
public string Username { get; set; } = "";
|
||||
public string Password { get; set; } = "";
|
||||
public string Domain { get; set; } = "";
|
||||
|
||||
// 是否走 IE 系统代理。内网 TFS 请保持 false(直连);
|
||||
// 代理/网关常对 HttpClient 请求返回 502(浏览器例外名单直连,.NET 不一定继承)
|
||||
public bool UseSystemProxy { get; set; } = false;
|
||||
|
||||
public bool BypassRules { get; set; } = true;
|
||||
public bool SkipExistingTitles { get; set; } = true;
|
||||
public string DefaultState { get; set; } = "To Do";
|
||||
|
||||
// 自定义字段引用名;留空则按 DisplayName 自动解析
|
||||
public string FinancialProjectRef { get; set; } = "";
|
||||
public string CompletedRef { get; set; } = "";
|
||||
public string LogDateRef { get; set; } = "";
|
||||
|
||||
public string LastExcelPath { get; set; } = "";
|
||||
|
||||
// 父 Product Backlog Item:所有 Task 默认挂接的 PBI Id(如 219975);Excel 每行 PBI Id 列可覆盖
|
||||
public string ParentPbiId { get; set; } = "";
|
||||
|
||||
private static string ConfigPath
|
||||
{
|
||||
get { return Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config.json"); }
|
||||
}
|
||||
|
||||
public static AppConfig Load()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists(ConfigPath))
|
||||
{
|
||||
var cfg = JsonConvert.DeserializeObject<AppConfig>(File.ReadAllText(ConfigPath));
|
||||
if (cfg != null) return cfg;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("读取 config.json 失败: " + ex.Message);
|
||||
}
|
||||
return new AppConfig();
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
try
|
||||
{
|
||||
File.WriteAllText(ConfigPath, JsonConvert.SerializeObject(this, Formatting.Indented));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("写入 config.json 失败: " + ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user