コード例 #1
0
        protected internal override void Write()
        {
            try
            {
                var ScriptVer = IniHelper.GetScriptVersion();
                if (ScriptVer < this.CurrentProfile.FullMinVersion)
                {
                    this.ExitReason = ExitCodeEnum.MinVersionError;
                    return;
                }

                w.WriteLine(AppCommon.Instance.CodeAutoGenMsg);
                w.WriteLine(AppCommon.Instance.CodeLicenseHeader);
                if (this.CurrentProfile.profileEndChars != null && this.CurrentProfile.profileEndChars.Length > 0)
                {
                    EndCharsSelectedOptions EndingChars = (EndCharsSelectedOptions)EndCharsSelectedOptions.FromArray(this.CurrentProfile.profileEndChars);

                    if (EndingChars.Count > 0)
                    {
                        w.Write("#Hotstring EndChars ");
                        w.WriteLine(EndingChars.ToAutoHotkeyString());
                    }
                }
                this.ExitReason = ExitCodeEnum.NoError;
            }
            catch (Exception)
            {
                if (this.ExitReason == ExitCodeEnum.NotSet || this.ExitReason == ExitCodeEnum.NoError)
                {
                    this.ExitReason = ExitCodeEnum.EndCharsGeneralError;
                }
                return;
            }
        }
コード例 #2
0
        public profile ToProfile()
        {
            pf.name    = this.ProfileName.FileName;
            pf.version = this.ProfileVersion.Version;
            if (pf.codeLanguage == null)
            {
                pf.codeLanguage = new profileCodeLanguage();
            }
            pf.codeLanguage.codeName    = this.ProfileName.FileName;
            pf.codeLanguage.codeName    = this.ProfileDisplayName.FieldText;
            pf.codeLanguage.description = this.ProfileDisplayDescription.FieldText;
            pf.globalProfile            = chkGlobal.Checked;

            List <profileWindow> pWindows = new List <profileWindow>();

            foreach (var w in this.windows)
            {
                profileWindow pw = new profileWindow();
                pw.name  = w.name;
                pw.value = w.value;
                pWindows.Add(pw);
            }
            pf.windows = pWindows.ToArray();

            if (this.IsNew == true)
            {
                pf.codeLanguage.paths.mainData = pf.name;
                pf.codeLanguage.paths.plugin   = pf.name;
                pf.codeLanguage.paths.snips    = pf.name;
            }

            var ec = EndCharsSelectedOptions.FromList(this.EndCharsBindingList);

            pf.profileEndChars = ec.ToArray();

            return(pf);
        }
コード例 #3
0
        private void frmProfile_Load(object sender, EventArgs e)
        {
            windowsBindingSource.DataSource = windows;
            ProfileName.FieldEnabled        = this.IsNew;
            if (this.IsNew)
            {
                // this app knows what the min version it works on for any
                // profile it creates so no reason to bother end user with min version.
                pf.minVersion = AppCommon.Instance.DefaultMinVersion.ToString();
            }


            if (pf.profileEndChars == null)
            {
                EndCharsBindingList = EndCharKeyMap.Instance.ToBindingList();
            }
            else
            {
                if (pf.profileEndChars == null || pf.profileEndChars.Length == 0)
                {
                    EndCharsBindingList = EndCharKeyMap.Instance.ToBindingList();
                }
                else
                {
                    var ec = EndCharsSelectedOptions.FromArray(pf.profileEndChars);
                    EndCharsBindingList = EndCharKeyMap.Instance.ToBindingList(ec);
                }
            }
            bsEndChars.DataSource = this.EndCharsBindingList;


            ((ListBox)this.clbEndChars).DataSource    = bsEndChars;
            ((ListBox)this.clbEndChars).DisplayMember = "DisplayValue";
            ((ListBox)this.clbEndChars).ValueMember   = "Selected";

            for (int i = 0; i < clbEndChars.Items.Count; i++)
            {
                AhkKeyMapAhkMapValue mv = (AhkKeyMapAhkMapValue)clbEndChars.Items[i];
                clbEndChars.SetItemChecked(i, mv.Selected);
            }

            if (Properties.Settings.Default.ProWindowState == FormWindowState.Maximized)
            {
                WindowState = FormWindowState.Maximized;
                Location    = Properties.Settings.Default.ProLocation;
                Size        = Properties.Settings.Default.ProSize;
            }
            else if (Properties.Settings.Default.ProWindowState == FormWindowState.Minimized)
            {
                WindowState = FormWindowState.Minimized;
                Location    = Properties.Settings.Default.ProLocation;
                Size        = Properties.Settings.Default.ProSize;
            }
            else
            {
                Location = Properties.Settings.Default.ProLocation;
                Size     = Properties.Settings.Default.ProSize;
            }
            mnuEditCut.Image    = Z.IconLibrary.Silk.Icon.Cut.GetImage();
            mnuEditCopy.Image   = Z.IconLibrary.Silk.Icon.PageCopy.GetImage();
            mnuEditPaste.Image  = Z.IconLibrary.Silk.Icon.PagePaste.GetImage();
            mnuEditDelete.Image = Z.IconLibrary.Silk.Icon.Delete.GetImage();
            mnuEditUndo.Image   = Z.IconLibrary.Silk.Icon.ArrowUndo.GetImage();

            cMnuEditCut.Image    = Z.IconLibrary.Silk.Icon.Cut.GetImage();
            cMnuEditCopy.Image   = Z.IconLibrary.Silk.Icon.PageCopy.GetImage();
            cMnuEditPaste.Image  = Z.IconLibrary.Silk.Icon.PagePaste.GetImage();
            cMnuEditDelete.Image = Z.IconLibrary.Silk.Icon.Delete.GetImage();
            cMnuEditUndo.Image   = Z.IconLibrary.Silk.Icon.ArrowUndo.GetImage();

            this.SetTextBoxGeneralEvents();
            this.AddTextBoxEditHandlers();
        }