Esempio n. 1
0
        /// <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));
        }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
        /// <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"));
            }
        }
Esempio n. 4
0
        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));
        }
Esempio n. 5
0
        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));
        }
Esempio n. 6
0
        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));
        }
Esempio n. 7
0
        /// <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;
            }
        }