static void MainProcess(string[] args) { var arg = new dpz3.Console.Arguments(args); string path = arg["path"]; // 判断路径是否指定 if (path.IsNoneOrNull()) { Console.WriteLine($"[!] 未指定路径"); return; } // 将路径进行处理 if (!path.EndsWith(it.SplitChar)) { path += it.SplitChar; } // 判断页面文件夹 string pathPages = $"{path}pages"; if (!System.IO.Directory.Exists(pathPages)) { Console.WriteLine($"[!] 未找到pages文件夹"); return; } // 判断并创建控制器工程文件夹 string pathController = $"{path}controller{it.SplitChar}pages"; if (!System.IO.Directory.Exists(pathController)) { Console.WriteLine($"[+] 创建文件夹 {pathController} ..."); System.IO.Directory.CreateDirectory(pathController); return; } MakerController(pathPages, pathController, "pages", ""); }
static void Main(string[] args) { //using (dpz3.Text.Pinyin py = new dpz3.Text.Pinyin()) { // var words = py.DebugOut(); // Console.WriteLine(words.Count); // foreach (var item in words) { // Console.WriteLine($"dicSpecial.Add('{item.Key}', new PinyinInfo(\"{item.Value.Pinyin}\", {item.Value.Tone}));"); // } //} string sz = "进入手机界面后,你会发现页面变得十分简洁,就算没登陆账号也能进行复制,手机网页的格式较为单一,你直接复制到word等其他地方,格式差异不大。"; Console.WriteLine(sz); Console.WriteLine(dpz3.Text.Pinyin.GetPinyinFromString(sz)); Console.WriteLine(dpz3.Text.Pinyin.GetPinyinToneFromString(sz)); Console.WriteLine(dpz3.Text.Pinyin.GetInitialLettersFromString(sz)); var arg = new dpz3.Console.Arguments(args); Console.WriteLine("path:" + arg.ContainsKey("t")); Console.WriteLine("path:" + arg.ContainsKey("n")); Console.WriteLine("path:" + arg.ContainsKey("path")); string fldHtmPath = "X:\\Projects\\beikejie\\dotnet-core-ycp-entity-bkj\\wwwroot\\pages\\Web\\WebAds\\list\\src\\field.Operate.htm"; string htmlContent = dpz3.File.UTF8File.ReadAllText(fldHtmPath, true); using (var doc = new dpz3.Html.HtmlDocument()) { var div = doc.CreateElement("div"); doc.Nodes.Add(div); div.InnerHTML = htmlContent; Console.WriteLine($"div:\r\n{doc.InnerHTML}"); } string xml = "<div class=\"dig-body\">"; xml += "<div dpz-id=\"Tool\" class=\"dig-tools\">"; xml += "<a href=\"javascript:;\" v-on:click=\"onSave\"><img v-bind:src=\"Images.Save\" />保存</a>"; xml += "<a href=\"javascript:;\" v-on:click=\"onCancel\"><img v-bind:src=\"Images.Cancel\" />取消</a>"; xml += "</div>"; xml += "<div dpz-id=\"Form\" class=\"dig-form\">"; xml += "<div class=\"dig-form-box\">"; xml += "<xorm src=\"orm.xml\" type=\"form\"></xorm>"; xml += "</div>"; xml += "</div>"; xml += "</div>"; using (dpz3.Html.HtmlDocument doc = new dpz3.Html.HtmlDocument(xml)) { Console.WriteLine($"html:\r\n{doc.InnerHTML}"); } using (dpz3.Xml.XmlDocument doc = new dpz3.Xml.XmlDocument(xml)) { Console.WriteLine($"xml:\r\n{doc.InnerXml}"); } string urlCss = "https://v5.lywos.com/css/Shared/Home.css"; string szCss = dpz3.Net.HttpClient.Get(urlCss); using (dpz3.Html.HtmlCss css = new dpz3.Html.HtmlCss(szCss)) { Console.WriteLine($"css:\r\n{css.ToString()}"); } // 测试http方式获取数据 string http = dpz3.Net.HttpClient.Get("http://v3.lywos.com/"); Console.WriteLine($"http:{http.Length}"); // 测试https方式获取数据 string https = dpz3.Net.HttpClient.Get("https://v5.lywos.com/"); Console.WriteLine($"https:{https.Length}"); //int tick = Environment.TickCount; //long lastLoad = 0; //dpz3.Net.HttpClient.Download("https://jx3wscs-fullupdatehttps.dl.kingsoft.com/jx3v4_launcher/JX3Installer_1.0.0.522_Official.exe", @"X:\temp\JX3Installer_1.0.0.522_Official.exe", (long size, long loaded) => { // int ts = Environment.TickCount - tick; // tick = Environment.TickCount; // float speed = (int)(((loaded - lastLoad) / (float)ts) * 1000 / 10.24) / (float)100; // lastLoad = loaded; // string speedStr = ""; // if (speed < 1024) { // speedStr = $"{speed}KB/s"; // } else { // float speedMb = (int)(speed / 10.24) / (float)100; // speedStr = $"{speedMb}MB/s"; // } // Console.WriteLine($"{loaded}/{size} - {speedStr}"); //}); }
static void MainProcess(string[] args) { var arg = new dpz3.Console.Arguments(args); // 帮助模式 if (arg.ContainsKey("help") || arg.ContainsKey("h")) { SayHelp(); return; } // 读取模式 string mode = arg["mode"]; if (arg.ContainsKey("list") || arg.ContainsKey("l")) { mode = "list"; } else if (arg.ContainsKey("build") || arg.ContainsKey("b")) { mode = "build"; } else if (arg.ContainsKey("uninstall") || arg.ContainsKey("u")) { mode = "uninstall"; } else { mode = "install"; } // 读取路径 string path = arg["path"]; // 判断路径是否指定 if (path.IsNoneOrNull()) { path = it.WorkPath; } // 将路径进行处理 if (!path.EndsWith(it.SplitChar)) { path += it.SplitChar; } Console.WriteLine($"[*] 工作目录 {path}"); // 卸载模式 switch (mode.ToLower()) { case "list": ListPacks(path); break; case "build": BuildDatabase(path); break; case "uninstall": UninstallPack(path, arg["name"]); break; default: InstallPack(path, arg["name"], arg["version"], arg["url"]); break; } }
static void MainProcess(string[] args) { var arg = new dpz3.Console.Arguments(args); string path = arg["path"]; // 判断路径是否指定 if (path.IsNoneOrNull()) { Console.WriteLine($"[!] 未指定路径"); return; } // 将路径进行处理 if (!path.EndsWith(it.SplitChar)) { path += it.SplitChar; } string pathCfg = $"{path}modular.json"; if (!System.IO.File.Exists(pathCfg)) { Console.WriteLine($"[!] 未找到配置文件"); return; } // 读取配置文件 Console.WriteLine($"[*] 读取配置文件 {pathCfg} ..."); string szJson = dpz3.File.UTF8File.ReadAllText(pathCfg); string name; string version; using (var json = dpz3.Json.Parser.ParseJson(szJson)) { name = json.Str["name"]; version = json.Str["version"]; Console.WriteLine($"[*] 当前版本 {version}"); var ver = new dpz3.TimeVersion(version); version = ver.GetNextVersion().ToString(); Console.WriteLine($"[*] 新版本 {version}"); json.Str["version"] = version; dpz3.File.UTF8File.WriteAllText(pathCfg, json.ToJsonString()); } // 创建临时输出目录 string pathOutput = $"{path}output"; if (!System.IO.Directory.Exists(pathOutput)) { Console.WriteLine($"[+] 创建目录 {pathOutput} ..."); System.IO.Directory.CreateDirectory(pathOutput); } // 复制配置文件 string pathOutputCfg = $"{pathOutput}{it.SplitChar}modular.json"; Console.WriteLine($"[+] 增加拷贝文件 {pathOutputCfg} ..."); System.IO.File.Copy(pathCfg, pathOutputCfg, true); // 复制静态页面 string pathRoot = $"{path}wwwroot"; if (System.IO.Directory.Exists(pathRoot)) { string pathOutputRoot = $"{pathOutput}{it.SplitChar}wwwroot"; if (!System.IO.Directory.Exists(pathOutputRoot)) { Console.WriteLine($"[+] 创建目录 {pathOutputRoot} ..."); System.IO.Directory.CreateDirectory(pathOutputRoot); } // 复制需要打包的文件到临时文件夹中 CopyFolder(pathRoot, pathOutputRoot); } // 复制数据库定义文件夹 string pathXorm = $"{path}xorm"; if (System.IO.Directory.Exists(pathXorm)) { string pathOutputXorm = $"{pathOutput}{it.SplitChar}xorm"; if (!System.IO.Directory.Exists(pathOutputXorm)) { Console.WriteLine($"[+] 创建目录 {pathOutputXorm} ..."); System.IO.Directory.CreateDirectory(pathOutputXorm); } // 复制需要打包的文件到临时文件夹中 CopyFolder(pathXorm, pathOutputXorm); } // 复制控制器 string pathController = $"{path}controller{it.SplitChar}bin{it.SplitChar}Debug{it.SplitChar}netcoreapp3.1"; if (System.IO.Directory.Exists(pathController)) { // 复制需要打包的文件到临时文件夹中 CopyFolder(pathController, pathOutput); } // 建立包文件夹 string pathPackage = $"{path}package"; if (!System.IO.Directory.Exists(pathPackage)) { Console.WriteLine($"[+] 创建目录 {pathPackage} ..."); System.IO.Directory.CreateDirectory(pathPackage); } // 打包文件 string pathPackageFile = $"{pathPackage}{it.SplitChar}{name}-{version}.zip"; Console.WriteLine($"[+] 输出包文件 {pathPackageFile} ..."); ZipFile.CreateFromDirectory(pathOutput, pathPackageFile); // 清理临时目录 if (System.IO.Directory.Exists(pathOutput)) { Console.WriteLine($"[-] 清理目录 {pathOutput} ..."); System.IO.Directory.Delete(pathOutput, true); } // 生成脚本文件 string pathBatFile = $"{pathPackage}{it.SplitChar}{name}.bat"; string cmd = $"@echo off\r\n" + $"cd ..\r\n" + $".\\pm /name {name} /version {version}\r\n" + $"cd downloads\r\n" + $"del {name}.bat\r\n" + $"pause"; dpz3.File.TextFile.WriteAllBytes(pathBatFile, System.Text.Encoding.ASCII.GetBytes(cmd)); }