参考OPPO主题设计师站:
http://dev.theme.oppomobile.com/user/user_start
想要打包成Theme文件,必须把需要打包的文件夹拖到oppo-themepack.exe这个应用程序上执行:
每次拖来拖去都很麻烦,然后就写个程序一键执行:
主要代码:
/// <summary> /// 生成Theme文件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnGenerate_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(this.txtPathFolder.Text)) { return; } var packToolPath = @"....PackToolsoppo-themepack.exe"; // 打包的exe程序绝对路径 var themeFolderPath = this.txtPathFolder.Text.Trim(); // 需要打包的文件夹目录 var myProcess = new Process(); var myStartInfo = new ProcessStartInfo(packToolPath, themeFolderPath); myProcess.StartInfo = myStartInfo; myProcess.Start(); myProcess.WaitForExit(); //等待程序退出 var generateThemeFolder = Directory.GetParent(themeFolderPath).ToString(); DialogResult dr = MessageBox.Show($"打包完成,文件存放路径:{generateThemeFolder},是否打开Theme文件所在文件夹?", "提示", MessageBoxButtons.OKCancel); if (dr == DialogResult.OK) { Process.Start("Explorer.exe", generateThemeFolder); } this.txtPathFolder.Text = string.Empty; } /// <summary> /// 选择需要打包的Theme文件目录 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPathFolder_Click(object sender, EventArgs e) { FolderBrowserDialog dialog = new FolderBrowserDialog(); dialog.Description = "请选择文件路径"; if (dialog.ShowDialog() == DialogResult.OK) { this.txtPathFolder.Text = dialog.SelectedPath; } }