Ejemplo n.º 1
0
        private void WritePlugin(plugin p)
        {
            if (p.hotstrings == null)
            {
                return;
            }
            try
            {
                foreach (var hs in p.hotstrings)
                {
                    if (hs.enabled == false)
                    {
                        continue;
                    }
                    switch (hs.type)
                    {
                    case hotstringType.Paste:
                        HashBuilder.AppendLine(hs.UniqueName);
                        this.WriteHotstringPaste(hs);
                        break;

                    case hotstringType.Inline:
                        HashBuilder.AppendLine(hs.UniqueName);
                        this.WriteHotstringInline(hs);
                        break;

                    case hotstringType.Code:
                        HashBuilder.AppendLine(hs.UniqueName);
                        this.WriteHotstringCode(hs);
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
        protected internal override void Write()
        {
            try
            {
                if (this.CurrentInstal == null)
                {
                    this.ExitReason = ExitCodeEnum.NoInstall;
                    return;
                }

                if (this.m_CurrentInstal.profile == null)
                {
                    this.ExitReason = ExitCodeEnum.NoProfile;
                    return;
                }


                if (this.ScriptMinVersion < this.CurrentInstal.profile.FullMinVersion)
                {
                    this.ExitReason = ExitCodeEnum.MinVersionError;
                    return;
                }

                w.WriteLine(AppCommon.Instance.CodeAutoGenMsg);
                w.WriteLine(AppCommon.Instance.CodeLicenseHeader);

                w.Write("; Profile Hash:");
                w.WriteLine(this.CurrentInstal.profile.UniqueName);

                //string PluginKeyFile = Path.Combine(AppCommon.Instance.PathData, Properties.Settings.Default.PluginKeysFile);
                //w.Write(@"#Include *I ");
                //w.WriteLine(PluginIncludFile);

                if (this.m_CurrentInstal.plugin == null)
                {
                    this.SetExitReason(ExitCodeEnum.NoPlugins);
                    return;
                }
                string sPath    = this.m_CurrentInstal.profile.codeLanguage.paths.PluginFullPath;
                string sPathInc = this.m_CurrentInstal.profile.codeLanguage.paths.PluginIncludeFullPath;
                foreach (var p in this.m_CurrentInstal.plugin)
                {
                    if (p.enabled == false)
                    {
                        continue;
                    }
                    if (this.ScriptMinVersion < p.FullMinVersion)
                    {
                        // The Script version is not high enough to run this plugin.
                        continue;
                    }

                    HashBuilder.AppendLine(p.UniqueName);

                    if (p.commands != null)
                    {
                        foreach (var cmd in p.commands)
                        {
                            if (cmd.enabled == false)
                            {
                                continue;
                            }

                            if (cmd.type == commandType.include)
                            {
                                string sFile = cmd.UniqueName + ".ahk";
                                w.Write(@"#Include *I ");
                                w.WriteLine(Path.Combine(sPath, sFile));
                            }
                        }
                    }
                    if (p.includes != null)
                    {
                        foreach (var inc in p.includes)
                        {
                            if (inc.enabled == false)
                            {
                                continue;
                            }
                            string sFile = inc.UniqueName + ".ahk";
                            w.Write(@"#Include *I ");
                            w.WriteLine(Path.Combine(sPathInc, sFile));
                        }
                    }
                } // foreach (var p in this.m_CurrentInstal.plugin)

                if (HashBuilder.Length > 0)
                {
                    w.WriteLine();
                    w.Write("; Plugin Hash Values:");
                    w.WriteLine(this.GeHashBuildertHash());
                }
            }
            catch (Exception)
            {
                this.SetExitReason(ExitCodeEnum.IwGeneralFail);
            }

            if (this.ExitReason == ExitCodeEnum.NotSet)
            {
                this.ExitReason = ExitCodeEnum.NoError;
            }
        }
Ejemplo n.º 3
0
        protected internal override void Write()
        {
            try
            {
                if (this.CurrentInstal == null)
                {
                    this.ExitReason = ExitCodeEnum.NoInstall;
                    return;
                }
                if (this.m_CurrentInstal.profile == null)
                {
                    this.ExitReason = ExitCodeEnum.NoProfile;
                    return;
                }
                if (this.m_CurrentInstal.plugin == null)
                {
                    this.ExitReason = ExitCodeEnum.NoPlugins;
                    return;
                }

                if (this.ScriptMinVersion < this.CurrentInstal.profile.FullMinVersion)
                {
                    this.ExitReason = ExitCodeEnum.MinVersionError;
                    return;
                }

                w.WriteLine(AppCommon.Instance.CodeAutoGenMsg);
                w.WriteLine(AppCommon.Instance.CodeLicenseHeader);
                w.Write("; Profile Hash:");
                w.WriteLine(this.CurrentInstal.profile.UniqueName);


                foreach (var p in this.m_CurrentInstal.plugin)
                {
                    if (p.enabled == false)
                    {
                        continue;
                    }
                    if (p.commands == null)
                    {
                        continue;
                    }

                    // HashBuilder.AppendLine(p.UniqueName);

                    if (this.ScriptMinVersion < p.FullMinVersion)
                    {
                        // The Script version is not high enough to run this plugin.
                        continue;
                    }
                    foreach (var cmd in p.commands)
                    {
                        if (cmd.enabled == false)
                        {
                            continue;
                        }
                        if (cmd.KeyData.IsValid == false)
                        {
                            continue;
                        }
                        HashBuilder.AppendLine(cmd.UniqueName);
                        if (cmd.KeyData.IsMultiKey == true)
                        {
                            string PrefixMain = cmd.KeyData.GetPrefix() + cmd.KeyData.Key1.ToString();
                            if (this.MultiKeys.ContainsKey(PrefixMain) == true)
                            {
                                this.MultiKeys[PrefixMain].Add(cmd);
                            }
                            else
                            {
                                List <command> lst = new List <command>();
                                lst.Add(cmd);
                                this.MultiKeys.Add(PrefixMain, lst);
                            }
                            continue;
                        }
                        this.WriteRegular(cmd);
                    }
                }
                this.WriteMultiKeys();

                if (HashBuilder.Length > 0)
                {
                    w.WriteLine();
                    w.Write("; HotKeys Hash Values:");
                    w.WriteLine(this.GeHashBuildertHash());
                }
            }
            catch (Exception)
            {
                if (this.ExitReason == ExitCodeEnum.NotSet || this.ExitReason == ExitCodeEnum.NoError)
                {
                    this.ExitReason = ExitCodeEnum.HkGeneralError;
                }
                return;
            }

            if (this.ExitReason == ExitCodeEnum.NotSet)
            {
                this.ExitReason = ExitCodeEnum.NoError;
            }
        }