/// <summary> /// Das tttool kann OID-Muster in verschiedenen Formaten erzeugen – das brauchst du dann, wenn du deine eigenen ///Tiptoi-Produkte gestalten willst.Es versteht dazu mehrere Befehle, je nach dem woher es wissen soll, zu welche /// Codes es die Muster erzeugen soll, und mehrere Optionen, die steuern, wie die Muster auszusehen haben. /// </summary> /// <param name="tttSettings"></param> /// <param name="yamlFile"></param> /// <returns></returns> public static string CreateOidCodes(TTToolSettings tttSettings, string yamlFile, string outPath = "") { var path = TTGRegistry.Read("tttoolPath"); var yf = yamlFile.EndsWith(".yaml") ? "yamlFile" : $"{yamlFile}.yaml"; var arg = $"{ConvertSettingsToArguments(tttSettings)} oid-codes {yf}"; if (!string.IsNullOrEmpty(outPath)) { arg = $"{arg} \"{outPath}\""; } return(CMD.GetMultiline(path, arg)); }
public static string Play(string yamlFile) { if (!File.Exists(yamlFile)) { return($"{yamlFile} file not exists"); } var path = TTGRegistry.Read("tttoolPath"); var arg = $"assemble \"{fileExtension(yamlFile, "yaml")}\""; return(CMD.GetMultiline(path, arg)); }
public void Save() { var s = JsonConvert.SerializeObject(this); var file = $"{Path.Combine(ProjectPath, Name)}.ttproj"; using (var fileStream = new FileStream(file, FileMode.Create, FileAccess.Write)) { using (StreamWriter writer = new StreamWriter(fileStream)) { writer.WriteLine(s); } } TTGRegistry.SetRecentProject(file); }
/// <summary> /// Das tttool kann OID-Muster in verschiedenen Formaten erzeugen – das brauchst du dann, wenn du deine eigenen /// Tiptoi-Produkte gestalten willst.Es versteht dazu mehrere Befehle, je nach dem woher es wissen soll, zu welche /// Codes es die Muster erzeugen soll, und mehrere Optionen, die steuern, wie die Muster auszusehen haben. /// </summary> /// <param name="tttSettings"></param> /// <param name="code"></param> public static string CreateOidCodes(TTToolSettings tttSettings, short code, string workdir = "") { var path = TTGRegistry.Read("tttoolPath"); var arg = $"{ConvertSettingsToArguments(tttSettings)} oid-code {code}"; if (string.IsNullOrEmpty(workdir)) { CMD.GetMultiline(path, arg); return(Path.Combine(Assembly.GetAssembly(typeof(MainForm)).Location, $"oid-{code}.png")); } else { CMD.GetMultiline(path, workdir, arg); return(Path.Combine(workdir, $"oid-{code}.png")); } }
public static string ExtractMediaFromGME(string gmeFile, string mediaPath = "") { if (!File.Exists(gmeFile)) { return($"{gmeFile} file not exists"); } var path = TTGRegistry.Read("tttoolPath"); var arg = $" media {gmeFile}"; if (!string.IsNullOrEmpty(mediaPath)) { arg = $"{arg} -d {mediaPath}"; } return(CMD.GetMultiline(path, arg)); }
public static string Assemble(string yamlFile, string gmeFile = "") { if (!File.Exists(yamlFile)) { return($"{yamlFile} file not exists"); } var path = TTGRegistry.Read("tttoolPath"); var arg = $"assemble \"{fileExtension(yamlFile, "yaml")}\""; if (!string.IsNullOrEmpty(gmeFile)) { arg = $"{arg} \"{fileExtension(gmeFile, "gme")}\""; } return(CMD.GetMultiline(path, arg)); }
public static string ExtractYamlFromGME(string gmeFile, string yamlFile = "") { var f = fileExtension(gmeFile, "gme"); if (!File.Exists(f)) { return($"{f} file not exists"); } var path = TTGRegistry.Read("tttoolPath"); var arg = $" export {gmeFile}"; if (!string.IsNullOrEmpty(yamlFile)) { arg = $"{arg} \"{fileExtension(yamlFile, "yaml")}\""; } return(CMD.GetMultiline(path, arg)); }
/// <summary> /// Das tttool kann OID-Muster in verschiedenen Formaten erzeugen – das brauchst du dann, wenn du deine eigenen ///Tiptoi-Produkte gestalten willst.Es versteht dazu mehrere Befehle, je nach dem woher es wissen soll, zu welche /// Codes es die Muster erzeugen soll, und mehrere Optionen, die steuern, wie die Muster auszusehen haben. /// </summary> /// <param name="tttSettings"></param> /// <param name="from"></param> /// <param name="to"></param> /// <returns></returns> public static string CreateOidCodes(TTToolSettings tttSettings, short from, short to, string workdir = "") { if (from < to) { var t = from; from = to; to = t; } var path = TTGRegistry.Read("tttoolPath"); var arg = $"{ConvertSettingsToArguments(tttSettings)} oid-code {from}-{to}"; if (string.IsNullOrEmpty(workdir)) { return(CMD.GetMultiline(path, arg)); } return(CMD.GetMultiline(path, workdir, arg)); }
private void Play_Click(object sender, EventArgs e) { if (!PlayMode) { if (MainForm.Project != null) { MainForm.Project.Save(); var file = MainForm.Project.SaveYaml(); string ttool = TTGRegistry.Read("tttoolPath"); if (File.Exists(file) && File.Exists(ttool)) { _PlayTTTool = new PlayTTTool(ttool, $"play {file}"); _PlayTTTool.OnRaiseMessageEvent += PlayTTTool_OnRaiseMessageEvent; PlayMode = true; tsPlay.BackgroundImage = global::TipToyGui.Properties.Resources.TipToiStop; var s = GetEmbeddedResourceStream(@"Tip.cur"); var c = new Cursor(s); pbDrawSpace.Cursor = c; tsPolyMove.PerformClick(); tsImgMove.Enabled = false; tsImgRotate.Enabled = false; tsImgScale.Enabled = false; tsImgMove.BackgroundImage = Resources.i_imgMove; tsImgRotate.BackgroundImage = Resources.i_imgRotate; tsImgScale.BackgroundImage = Resources.i_imgScale; } } } else { _PlayTTTool?.Dispose(); PlayMode = false; tsPlay.BackgroundImage = Resources.TipToiPlay; pbDrawSpace.Cursor = default; tsImgMove.Enabled = true; tsImgRotate.Enabled = true; tsImgScale.Enabled = true; tsImgMove.BackgroundImage = Resources.imgMove; tsImgRotate.BackgroundImage = Resources.imgRotate; tsImgScale.BackgroundImage = Resources.imgScale; } }
private void RefreshRecentItems() { MenuRecent.DropDownItems.Clear(); foreach (var item in TTGRegistry.GetRecentProjectPath()) { var mi = new ToolStripMenuItem(item); mi.Click += (_, __) => { Project = OIDProject.Load(item); RefreshNodes(); RefreshOid(); if (lbOidCodes.Items != null && lbOidCodes.Items.Count > 0) { lbOidCodes.SelectedIndex = 0; } }; MenuRecent.DropDownItems.Add(mi); } }