Example #1
0
        // called when the compilation ended
        private void OnCompilationEnd(DeploymentHandler proDeployment)
        {
            Task.Factory.StartNew(() => {
                this.SafeInvoke(page => {
                    // get rid of the timer
                    if (_progressTimer != null)
                    {
                        _progressTimer.Stop();
                        _progressTimer.Dispose();
                        _progressTimer = null;
                    }
                    ResetScreen();
                    UpdateReport(_proDeployment.FormatDeploymentReport());
                    btReport.Visible = true;

                    // notify the user
                    if (!_proDeployment.HasBeenCancelled)
                    {
                        UserCommunication.NotifyUnique("ReportAvailable", "The requested deployment is over,<br>please check the generated report to see the result :<br><br><a href= '#'>Click here to see the report</a>", MessageImg.MsgInfo, "Deploy your application", "Report available", args => {
                            Appli.GoToPage(PageNames.MassCompiler);
                            UserCommunication.CloseUniqueNotif("ReportAvailable");
                        }, Appli.IsFocused() ? 10 : 0);
                    }
                });
            });
        }
Example #2
0
        public HomePage()
        {
            InitializeComponent();

            var prolintVer    = Updater <ProlintUpdaterWrapper> .Instance.LocalVersion;
            var proparseVer   = Updater <ProparseUpdaterWrapper> .Instance.LocalVersion;
            var datadiggerVer = Updater <DataDiggerUpdaterWrapper> .Instance.LocalVersion;


            html.Text = HtmlResources.home.Replace("%version%", AssemblyInfo.Version)
                        .Replace("%disclaimer%", AssemblyInfo.IsPreRelease ? HtmlResources.disclaimer : "")
                        .Replace("%YamuiFrameworkVersion%", LibLoader.GetYamuiAssemblyVersion())
                        .Replace("%ProlintVersion%", prolintVer.Equals("v0") ? "*not installed*" : prolintVer)
                        .Replace("%ProparseVersion%", proparseVer.Equals("v0") ? "*not installed*" : proparseVer)
                        .Replace("%DataDiggerVersion%", datadiggerVer.Equals("v0") ? "*not installed*" : datadiggerVer)
                        .Replace("%getting-started.md%", HtmlResources.getting_started.MdToHtml());

            html.LinkClicked += (sender, args) => {
                if (args.Link.Equals("update"))
                {
                    Appli.GoToPage(PageNames.OptionsUpdate);
                    args.Handled = true;
                }
            };

            yamuiScrollPage1.ContentPanel.Height = html.Height;
        }
Example #3
0
File: Plug.cs Project: devjerome/3P
        /// <summary>
        /// Called on Npp shutdown
        /// </summary>
        internal static void DoNppShutDown()
        {
            try {
                if (OnShutDown != null)
                {
                    OnShutDown();
                }

                // clean up timers
                ReccurentAction.CleanAll();
                DelayedAction.CleanAll();

                // export modified conf
                FileTag.Export();

                // save config (should be done but just in case)
                CodeExplorer.UpdateMenuItemChecked();
                FileExplorer.UpdateMenuItemChecked();
                Config.Save();

                // remember the most used keywords
                Keywords.SaveRanking();

                // close every form
                AutoComplete.ForceClose();
                InfoToolTip.ForceClose();
                Appli.ForceClose();
                FileExplorer.ForceClose();
                CodeExplorer.ForceClose();
                UserCommunication.ForceClose();
                AppliMenu.ForceCloseMenu();
            } catch (Exception e) {
                ErrorHandler.ShowErrors(e, "Stop");
            }
        }
Example #4
0
        private void InitMembers()
        {
            appli     = null;
            reference = null;

            this.DisposeAllCSVFile();

            sectionCSVManage   = null;
            blockCSVManage     = null;
            articleCSVManage   = null;
            translateCSVManage = null;

            sceneInfo              = null;
            catalogFilePath        = String.Empty;
            catalogFileName        = String.Empty;
            catalogFileDir         = String.Empty;
            this.Status_TSPB.Value = 0;
            this.Status_TSSL.Text  = KD.StringTools.Const.Zero + KD.StringTools.Const.WhiteSpace + KD.StringTools.Const.Percent;

            spaceIniFile = new KD.Config.IniFile(spaceIniPath);
            kdsdkIniFile = new KD.Config.IniFile(kdsdkIniPath);

            exportDir = spaceIniFile.ReadValue(MainForm.SectionExport, KD.CatalogProperties.Const.KeyDir);
            this.SaveFilesDirectory_TBX.Text = exportDir;
        }
Example #5
0
    void OnEnable()
    {
        switch (Application.systemLanguage.ToString())
        {
        case "Japanese":
            SelectJapanese();
            break;

        case "ChineseTraditional":
            SelectChinese1();
            break;

        case "ChineseSimplified":
            SelectChinese2();
            break;

        case "Thai":
            SelectThai();
            break;

        default:
            SelectEnglish();
            break;
        }
        txtLanguage.text = Appli.GetLocaleText(LocaleTyp.TermLimitedYokai); //key value language
    }
Example #6
0
        //交換申請されているか
        //引数1:アクセスユーザ
        //引数2:DB
        //引数3:相手
        //戻り値:申請されているとき、交換期間。されていないとき、null
        public async static Task <int?> applied(ClaimsPrincipal user, ExchaDContext9 context, Diary diary)
        {
            if (!user.Identity.IsAuthenticated)
            {
                return(null);
            }

            int?period = null;

            string authId = user.FindFirst(ClaimTypes.NameIdentifier).Value;
            //交換申請されているか
            IQueryable <Leaf> leaves = context.leaves.Where(l => l.diaryId == authId);

            if (leaves.Count() != 0)
            {
                DateTime latest = await leaves.MaxAsync(l => l.time);

                Appli appli = context.appli
                              .Where(a =>
                                     (a.diaryId == authId) &&
                                     (a.leafTime == latest) &&
                                     (a.accept == EXCHA_ACCEPT.yet) &&
                                     (a.apid == diary.Id))
                              .FirstOrDefault();
                if (appli != null)
                {
                    period = appli.period;
                }
            }
            return(period);
        }
Example #7
0
File: Plug.cs Project: massreuy/3P
        /// <summary>
        /// Called on Npp shutdown
        /// </summary>
        internal static void DoNppShutDown()
        {
            try {
                if (OnShutDown != null)
                {
                    OnShutDown();
                }

                // clean up timers
                RecurentAction.CleanAll();
                DelayedAction.CleanAll();
                AsapButDelayableAction.CleanAll();

                // Triggered when the resolution of an assembly fails, gives us the opportunity to feed the required assembly
                AppDomain.CurrentDomain.AssemblyResolve -= LibLoader.AssemblyResolver;

                // catch unhandled errors to log them
                AppDomain.CurrentDomain.UnhandledException -= ErrorHandler.UnhandledErrorHandler;
                Application.ThreadException           -= ErrorHandler.ThreadErrorHandler;
                TaskScheduler.UnobservedTaskException -= ErrorHandler.UnobservedErrorHandler;

                // unsubscribe to static events
                ProEnvironment.OnEnvironmentChange -= FileExplorer.Instance.RebuildFileList;
                ProEnvironment.OnEnvironmentChange -= DataBase.Instance.UpdateDatabaseInfo;
                ProEnvironment.OnEnvironmentChange -= ParserHandler.ClearStaticData;

                Keywords.Instance.OnImport         -= AutoCompletion.SetStaticItems;
                DataBase.Instance.OnDatabaseUpdate -= AutoCompletion.SetStaticItems;
                AutoCompletion.OnUpdateStaticItems -= ParserHandler.UpdateKnownStaticItems;

                ParserHandler.OnEndSendCompletionItems -= AutoCompletion.SetDynamicItems;
                ParserHandler.OnStart -= CodeExplorer.Instance.OnStart;
                ParserHandler.OnEndSendParserItems       -= CodeExplorer.Instance.OnParseEndParserItems;
                ParserHandler.OnEndSendCodeExplorerItems -= CodeExplorer.Instance.OnParseEndCodeExplorerItems;
                ParserHandler.OnEnd -= CodeExplorer.Instance.OnParseEnd;

                ProExecutionHandleCompilation.OnEachCompilationOk -= FilesInfo.ProExecutionHandleCompilationOnEachCompilationOk;

                // export modified conf
                FileTag.Export();

                // save config (should be done but just in case)
                Config.Save();

                // remember the most used keywords
                Keywords.Instance.SaveRanking();

                // close every form
                FileExplorer.Instance.ForceClose();
                CodeExplorer.Instance.ForceClose();
                AutoCompletion.ForceClose();
                InfoToolTip.ForceClose();
                Appli.ForceClose();
                UserCommunication.ForceClose();
                AppliMenu.ForceClose();
            } catch (Exception e) {
                ErrorHandler.ShowErrors(e, "Stop");
            }
        }
Example #8
0
 public void SetName(string name)
 {
     Name = name;
     // ButtonText.text = name;
     nameLable.text   = name;
     txtLanguage.text = Appli.GetLocaleText(LocaleTyp.TermLimitedYokai); //key value language
     //  demotext.text = Appli.GetLocaleText(LocaleTyp.TermLimitedYokai); //key value language
 }
Example #9
0
 private void BtOkOnButtonPressed(object sender, EventArgs buttonPressedEventArgs)
 {
     Save(_filename);
     Save(FileTag.LastTag);
     UpdateInfo();
     FileTag.Export();
     Appli.ToggleView();
 }
Example #10
0
        internal static long GetUserId(int iCallParamsBlock)
        {
            long   result = 0;
            Appli  appli  = new Appli();
            string userId = appli.GetAccountNumber();

            long.TryParse(userId, out result);
            return(result);
        }
Example #11
0
        /// <summary>
        /// force everything to redraw to apply a new theme
        /// </summary>
        public static void RefreshApplicationWithTheme(Theme theme)
        {
            Current = theme;
            Config.Instance.AccentColor = theme.AccentColor;

            // force the autocomplete to redraw
            AutoComplete.ForceClose();
            CodeExplorer.ApplyColorSettings();
            FileExplorer.ApplyColorSettings();
            Application.DoEvents();
            Appli.Refresh();
        }
Example #12
0
 void DisalbeButton(string name)
 {
     try
     {
         List <Button> lstTemp = lstButton.FindAll(x => x.name != name);
         Button        bt      = lstButton.Find(x => x.name == name);
         txtLanguage.text = Appli.GetLocaleText(LocaleTyp.TermLimitedYokai); //key value language
     }
     catch (System.Exception e)
     {
         Debug.Log(e.Message);
     }
 }
Example #13
0
        //[ValidateAntiForgeryToken]
        public async Task <bool> apply(string diaryId, int exchaPeriod, string token)
        {
            //POSTデータを取得する
            // 引数で受け取る方法がわからないので、HttpContextから取得する
            var form = HttpContext.Request.Form;

            Microsoft.Extensions.Primitives.StringValues value;
            form.TryGetValue("diaryId", out value);
            diaryId = value.ToString();
            form.TryGetValue("exchaPeriod", out value);
            exchaPeriod = int.Parse(value.ToString());
            form.TryGetValue("token", out value);
            token = value.ToString();
            if (!PBKDF2.Verify(HttpContext.User.FindFirst(ClaimTypes.Sid).Value, token))
            {
                return(false);
            }
            string authId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;

            //最新のleafの日時を取得
            DateTime latest = await _context.leaves
                              .Where(l => l.diaryId == diaryId)
                              .MaxAsync(l => l.time);

            Appli appli = new Appli(diaryId, latest, authId, EXCHA_ACCEPT.yet, exchaPeriod);

            _context.appli.Add(appli);

            try {
                await _context.SaveChangesAsync();
            } catch (DbUpdateException) {
                //申請済みか確認
                if (_context.appli.Any(a => (
                                           (a.diaryId == appli.diaryId) &&
                                           (a.leafTime == appli.leafTime) &&
                                           (a.apid == authId)
                                           )))
                {
                    return(false);                      //Conflict();
                }
                else
                {
                    throw;
                }
            }
            return(true);
        }
Example #14
0
        /// <summary>
        /// Called to save all the options of the page
        /// </summary>
        private void Save()
        {
            bool needApplySetting = false;

            // refresh stuff on screen
            foreach (Control inputControl in scrollPanel.ContentPanel.Controls)
            {
                if (inputControl.Name.StartsWith("option_"))
                {
                    var    property   = (FieldInfo)inputControl.Tag;
                    var    attr       = property.GetCustomAttributes(typeof(Config.ConfigAttribute), false).FirstOrDefault() as Config.ConfigAttribute;
                    object inputValue = null;

                    if (inputControl is YamuiComboBox)
                    {
                        inputValue = Enum.GetNames(property.FieldType).ToList()[((YamuiComboBox)inputControl).SelectedIndex].ConvertFromStr(property.FieldType);
                    }
                    else if (inputControl is YamuiButtonToggle)
                    {
                        inputValue = ((YamuiButtonToggle)inputControl).Checked;
                    }
                    else if (inputControl is YamuiTextBox)
                    {
                        var cancelArg = new CancelEventArgs();
                        ValidateTextBox(inputControl, cancelArg);
                        if (cancelArg.Cancel)
                        {
                            continue;
                        }
                        inputValue = ((YamuiTextBox)inputControl).Text.ConvertFromStr(property.FieldType);
                    }

                    Config.Instance.SetValueOf(property.Name, inputValue);

                    needApplySetting = needApplySetting || attr != null && attr.NeedApplySetting;
                }
            }

            // need to refresh stuff to really apply this option?
            if (needApplySetting)
            {
                ApplySettings();
            }

            Config.Save();
            Appli.Notify("Options saved successfully", 2);
        }
Example #15
0
 void DisalbeButton(string name)
 {
     try
     {
         List <Button> lstTemp = lstButton.FindAll(x => x.name != name);
         Button        bt      = lstButton.Find(x => x.name == name);
         // txtLanguage.text = Appli.GetLocaleText(LocaleTyp.TermLimitedYokai); //key value language
         backgroud.sprite  = Appli.GetLocaleImage(LocaleTyp.TermLimitedYokai);
         khung.sprite      = Appli.GetLocaleImage(LocaleTyp.MiddleEnding1);
         ball.sprite       = Appli.GetLocaleImage(LocaleTyp.ball);
         ball1.sprite      = Appli.GetLocaleImage(LocaleTyp.ball1);
         ball2.sprite      = Appli.GetLocaleImage(LocaleTyp.ball2);
         playerball.sprite = Appli.GetLocaleImage(LocaleTyp.ball1);
     }
     catch (System.Exception e)
     {
         Debug.Log(e.Message);
     }
 }
Example #16
0
        public static bool MouseMessageHandler(WinApi.Messages message, Win32Api.MOUSEHOOKSTRUCT mouseStruct)
        {
            switch (message)
            {
            // middle click : go to definition
            case WinApi.Messages.WM_MBUTTONDOWN:
                if (Npp.CurrentFileInfo.IsProgress)
                {
                    if (KeyboardMonitor.GetModifiers.IsCtrl)
                    {
                        Npp.GoBackFromDefinition();
                    }
                    else
                    {
                        ProMisc.GoToDefinition(true);
                    }
                }
                return(true);

            //break;
            // (CTRL + ) Right click : show main menu
            case WinApi.Messages.WM_RBUTTONUP:
                if (KeyboardMonitor.GetModifiers.IsCtrl)
                {
                    // we need the cursor to be in scintilla but not on the application or the autocompletion!
                    if ((!Appli.IsVisible || !Appli.IsMouseIn()) &&
                        (!InfoToolTip.IsVisible || !InfoToolTip.IsMouseIn()) &&
                        (!AutoCompletion.IsVisible || !AutoCompletion.IsMouseIn()))
                    {
                        AppliMenu.ShowMainMenu(true);
                        return(true);
                    }
                }
                break;
            }

            return(false);
        }
Example #17
0
        /// <summary>
        /// Créer la base de donnée
        /// </summary>
        private async Task CreateDb()
        {
            await Connection.CreateTableAsync <Appli>();

            await Connection.CreateTableAsync <User>();

            await Connection.CreateTableAsync <Score>();

            await Connection.CreateTableAsync <TutorielPasse>();

            var resultatAppli = await Connection.Table <Appli>().Where(x => x.Id == 1).CountAsync();

            if (resultatAppli == 0)
            {
                var app = new Appli
                {
                    Id      = 1,
                    IsFull  = false,
                    Version = ContextStatic.Version
                };
                await Connection.InsertAsync(app);
            }
        }
Example #18
0
        /// <summary>
        /// Called when the soft is already up to date
        /// </summary>
        protected virtual void OnAlreadyUpdated(GitHubUpdater gitHubUpdater, GitHubUpdater.ReleaseInfo releaseInfo)
        {
            try {
                Config.Instance.TechnicalLastWebserviceCallOk = true;

                if (AlwaysShowNotifications)
                {
                    UserCommunication.NotifyUnique("Update" + UpdatedSoftName, "Congratulations! You already own the latest <b>" + (!gitHubUpdater.GetPreReleases ? "beta" : "stable") + "</b> version of " + UpdatedSoftName + "." + (!gitHubUpdater.GetPreReleases ? "<br><br><i>If you wish to check for beta versions as well, toggle the corresponding option in the update " + "options".ToHtmlLink("options page") + "</i>" : ""), MessageImg.MsgUpdate, UpdatedSoftName + " updater", "Local version is " + gitHubUpdater.LocalVersion, args => {
                        if (args.Link.Equals("options"))
                        {
                            args.Handled = true;
                            Appli.GoToPage(PageNames.OptionsUpdate);
                        }
                    });
                }

                if (OnUpdateDone != null)
                {
                    OnUpdateDone(this);
                }
            } finally {
                _updating = false;
            }
        }
Example #19
0
 private void BtCancelOnButtonPressed(object sender, EventArgs buttonPressedEventArgs)
 {
     UpdateInfo();
     Appli.ToggleView();
 }
Example #20
0
 private void UpdateAppli()
 {
     appli = new Appli(KD.InSitu.Ini.Const.FileNameSpaceIni);
 }
Example #21
0
File: Plug.cs Project: devjerome/3P
        /// <summary>
        /// Called when the user presses a key
        /// </summary>
        // ReSharper disable once RedundantAssignment
        private static bool KeyDownHandler(Keys key, KeyModifiers keyModifiers)
        {
            // if set to true, the keyinput is completly intercepted, otherwise npp sill does its stuff
            bool handled = false;

            MenuItem menuItem = null;

            try {
                // Since it's a keydown message, we can receive this a lot if the user let a button pressed
                var isSpamming = Utils.IsSpamming(key.ToString(), 100, true);

                //HACK:
                // Ok so... when we open a form in notepad++, we can't use the overrides PreviewKeyDown / KeyDown
                // like we normally can, for some reasons, they don't react to certain keys (like enter!)
                // It only works "almost normally" if we ShowDialog() the form?! Wtf right?
                // So i gave up and handle things here!
                if (Appli.IsFocused())
                {
                    handled = Appli.Form.HandleKeyPressed(key, keyModifiers);
                }
                else
                {
                    // same shit for the YamuiMenu
                    var curMenu = (Control.FromHandle(WinApi.GetForegroundWindow()));
                    var menu    = curMenu as YamuiMenu;
                    if (menu != null)
                    {
                        menu.OnKeyDown(key);
                    }
                }

                // check if the user triggered a 3P function defined in the AppliMenu
                menuItem = TriggeredMenuItem(AppliMenu.Instance.ShortcutableItemList, isSpamming, key, keyModifiers, ref handled);
                if (handled)
                {
                    return(true);
                }

                // The following is specific to 3P so don't go further if we are not on a valid file
                if (!IsCurrentFileProgress)
                {
                    return(false);
                }

                // Close interfacePopups
                if (key == Keys.PageDown || key == Keys.PageUp || key == Keys.Next || key == Keys.Prior)
                {
                    ClosePopups();
                }

                // Autocompletion
                if (AutoComplete.IsVisible)
                {
                    if (key == Keys.Up || key == Keys.Down || key == Keys.Tab || key == Keys.Return || key == Keys.Escape)
                    {
                        handled = AutoComplete.OnKeyDown(key);
                    }
                    else
                    {
                        if ((key == Keys.Right || key == Keys.Left) && keyModifiers.IsAlt)
                        {
                            handled = AutoComplete.OnKeyDown(key);
                        }
                    }
                }
                else
                {
                    // snippet ?
                    if (key == Keys.Tab || key == Keys.Escape || key == Keys.Return)
                    {
                        if (!keyModifiers.IsCtrl && !keyModifiers.IsAlt && !keyModifiers.IsShift)
                        {
                            if (!Snippets.InsertionActive)
                            {
                                //no snippet insertion in progress
                                if (key == Keys.Tab)
                                {
                                    if (Snippets.TriggerCodeSnippetInsertion())
                                    {
                                        handled = true;
                                    }
                                }
                            }
                            else
                            {
                                //there is a snippet insertion in progress
                                if (key == Keys.Tab)
                                {
                                    if (Snippets.NavigateToNextParam())
                                    {
                                        handled = true;
                                    }
                                }
                                else if (key == Keys.Escape || key == Keys.Return)
                                {
                                    Snippets.FinalizeCurrent();
                                    if (key == Keys.Return)
                                    {
                                        handled = true;
                                    }
                                }
                            }
                        }
                    }
                }

                // next tooltip
                if (keyModifiers.IsCtrl && InfoToolTip.IsVisible && (key == Keys.Up || key == Keys.Down))
                {
                    if (key == Keys.Up)
                    {
                        InfoToolTip.IndexToShow--;
                    }
                    else
                    {
                        InfoToolTip.IndexToShow++;
                    }
                    InfoToolTip.TryToShowIndex();
                    handled = true;
                }
            } catch (Exception e) {
                ErrorHandler.ShowErrors(e, "Occured in : " + (menuItem == null ? (new ShortcutKey(keyModifiers.IsCtrl, keyModifiers.IsAlt, keyModifiers.IsShift, key)).ToString() : menuItem.ItemId));
            }

            return(handled);
        }
Example #22
0
        public static bool MouseMessageHandler(WinApi.Messages message, Win32Api.MOUSEHOOKSTRUCT mouseStruct)
        {
            switch (message)
            {
            // middle click : go to definition
            case WinApi.Messages.WM_MBUTTONDOWN:
                if (Npp.CurrentFileInfo.IsProgress)
                {
                    if (KeyboardMonitor.GetModifiers.IsCtrl)
                    {
                        Npp.GoBackFromDefinition();
                    }
                    else
                    {
                        ProMisc.GoToDefinition(true);
                    }
                }
                return(true);

            //break;
            // (CTRL + ) Right click : show main menu
            case WinApi.Messages.WM_RBUTTONUP:
                if (KeyboardMonitor.GetModifiers.IsCtrl)
                {
                    // we need the cursor to be in scintilla but not on the application or the autocompletion!
                    if ((!Appli.IsVisible || !Appli.IsMouseIn()) &&
                        (!InfoToolTip.IsVisible || !InfoToolTip.IsMouseIn()) &&
                        (!AutoCompletion.IsVisible || !AutoCompletion.IsMouseIn()))
                    {
                        AppliMenu.ShowMainMenu(true);
                        return(true);
                    }
                }
                break;
            }

            // HACK: The following is to handle the MOVE/RESIZE event of npp's window.
            // It would be cleaner to use a WndProc bypass but it costs too much... this is a cheaper solution
            switch (message)
            {
            case WinApi.Messages.WM_NCLBUTTONDOWN:
                if (!WinApi.GetWindowRect(Npp.CurrentSci.Handle).Contains(Cursor.Position))
                {
                    MouseMonitor.Instance.Add(WinApi.Messages.WM_MOUSEMOVE);
                }
                break;

            case WinApi.Messages.WM_LBUTTONUP:
            case WinApi.Messages.WM_NCLBUTTONUP:
                if (MouseMonitor.Instance.Remove(WinApi.Messages.WM_MOUSEMOVE))
                {
                    if (OnNppWindowsMove != null)
                    {
                        OnNppWindowsMove();
                    }
                }
                break;

            case WinApi.Messages.WM_MOUSEMOVE:
                if (OnNppWindowsMove != null)
                {
                    OnNppWindowsMove();
                }
                break;
            }

            return(false);
        }
Example #23
0
        // called when the compilation ended
        private void OnCompilationEnd()
        {
            Task.Factory.StartNew(() => {
                _filesToDeployPerStep.Add(0, _currentCompil.TransferedFiles);

                // if it went ok, move on to deploying files
                if (_currentCompil.DeploymentDone)
                {
                    // hook
                    ExecuteDeploymentHook();

                    _currentStep++; // move on to step 1

                    // Update the progress bar
                    UpdateProgressBar();

                    // transfer rules found for this step?
                    while (_proEnv.Deployer.DeployTransferRules.Exists(rule => rule.Step == _currentStep))
                    {
                        _filesToDeployPerStep.Add(_currentStep,
                                                  _proEnv.Deployer.DeployFilesForStep(_currentStep, new List <string> {
                            _currentStep == 1 ? _currentProfile.SourceDirectory : _proEnv.BaseCompilationPath
                        }, _currentProfile.ExploreRecursively ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly, f => _deploymentPercentage = f));

                        // hook
                        ExecuteDeploymentHook();

                        _currentStep++;
                    }
                }

                this.SafeInvoke(page => {
                    // Update the progress bar
                    progressBar.Progress = 100;
                    progressBar.Text     = @"Generating the report, please wait...";

                    // get rid of the timer
                    if (_progressTimer != null)
                    {
                        _progressTimer.Stop();
                        _progressTimer.Dispose();
                        _progressTimer = null;
                    }

                    // create the report and display it
                    BuildReport();

                    ResetScreen();

                    // notify the user
                    if (!_currentCompil.HasBeenCancelled)
                    {
                        UserCommunication.NotifyUnique("ReportAvailable", "The requested deployment is over,<br>please check the generated report to see the result :<br><br><a href= '#'>Cick here to see the report</a>", MessageImg.MsgInfo, "Deploy your application", "Report available", args => {
                            Appli.GoToPage(PageNames.MassCompiler);
                            UserCommunication.CloseUniqueNotif("ReportAvailable");
                        }, Appli.IsFocused() ? 10 : 0);
                    }

                    btReport.Visible = true;
                });
            });
        }
Example #24
0
        internal static void DoPlugStart()
        {
            if (OnPlugReady != null)
            {
                OnPlugReady();
            }

            ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

            // subscribe to static events
            ProEnvironment.OnEnvironmentChange += FileExplorer.Instance.RebuildFileList;
            ProEnvironment.OnEnvironmentChange += DataBase.Instance.UpdateDatabaseInfo;
            ProEnvironment.OnEnvironmentChange += ParserHandler.ClearStaticData;

            Keywords.Instance.OnImport         += AutoCompletion.SetStaticItems;
            DataBase.Instance.OnDatabaseUpdate += AutoCompletion.SetStaticItems;
            AutoCompletion.OnUpdateStaticItems += ParserHandler.UpdateKnownStaticItems;

            ParserHandler.OnStart += CodeExplorer.Instance.OnStart;
            ParserHandler.OnEndSendCompletionItems   += AutoCompletion.SetDynamicItems;
            ParserHandler.OnEndSendParserItems       += CodeExplorer.Instance.OnParseEndParserItems;
            ParserHandler.OnEndSendParserItems       += SyntaxFolding.OnParseEndParserItems;
            ParserHandler.OnEndSendCodeExplorerItems += CodeExplorer.Instance.OnParseEndCodeExplorerItems;
            ParserHandler.OnEnd += CodeExplorer.Instance.OnParseEnd;

            ProExecutionHandleCompilation.OnEachCompilationOk += OpenedFilesInfo.ProExecutionHandleCompilationOnEachCompilationOk;

            // Clear the %temp% directory if we didn't do it properly last time
            Utils.DeleteDirectory(Config.FolderTemp, true);

            //Snippets.Init();
            FileCustomInfo.Import();

            DelayedAction.StartNew(100, () => {
                if (Config.Instance.InstallStep == 0)
                {
                    Config.Instance.InstallStep++;

                    // we are at the first notepad++ start
                    Npp.ConfXml.FinishPluginInstall(); // will apply npp options and restart npp
                    return;
                }
                if (Config.Instance.InstallStep == 1)
                {
                    Config.Instance.InstallStep++;

                    // global options applied, we are at the second startup
                    UserCommunication.NotifyUnique("welcome", "Thank you for installing 3P, you are awesome!<br><br>If this is your first look at 3P you should probably read the <b>getting started</b> section of the home page by clicking " + "go".ToHtmlLink("on this link right here") + ".<br><br><div align='right'>And as always... Enjoy!</div>", MessageImg.MsgInfo, "Fresh install", "Hello and welcome aboard!", args => {
                        Appli.ToggleView();
                        UserCommunication.CloseUniqueNotif("welcome");
                        args.Handled = true;
                    });
                }
                else if (!Config.Instance.NppStoppedCorrectly)
                {
                    // Npp didn't stop correctly, if the backup mode is activated, inform the user
                    if (Npp.ConfXml.BackupMode > 0)
                    {
                        UserCommunication.Notify("It seems that notepad++ didn't stop correctly.<br>If you lost some modifications, don't forget that you have a backup folder here :<br><br><div>" + Npp.ConfXml.BackupDirectory.ToHtmlLink() + "</div>" + (Npp.ConfXml.BackupUseCustomDir ? "<div>" + Npp.ConfXml.CustomBackupDirectory.ToHtmlLink() + "</div>" : ""), MessageImg.MsgInfo, "Notepad++ crashed", "Backup folder location");
                    }
                }

                Config.Instance.NppStoppedCorrectly = false;

                // check if an update was done and start checking for new updates
                Updater <MainUpdaterWrapper> .Instance.CheckForUpdateDoneAndStartCheckingForUpdates();

                if (Updater <ProlintUpdaterWrapper> .Instance.LocalVersion.IsHigherVersionThan("v0"))
                {
                    Updater <ProlintUpdaterWrapper> .Instance.StartCheckingForUpdate();
                }
                if (Updater <ProparseUpdaterWrapper> .Instance.LocalVersion.IsHigherVersionThan("v0"))
                {
                    Updater <ProparseUpdaterWrapper> .Instance.StartCheckingForUpdate();
                }

                // Try to update the configuration from the distant shared folder
                ShareExportConf.StartCheckingForUpdates();
            });

            // check if npp version is meeting current recommended version
            if (!string.IsNullOrEmpty(Npp.SoftwareStringVersion) && !Npp.SoftwareStringVersion.IsHigherOrEqualVersionThan(Config.RequiredNppVersion))
            {
                if (!Config.Instance.NppOutdatedVersion)
                {
                    UserCommunication.Notify("This version of 3P has been developed for Notepad++ " + Config.RequiredNppVersion + ", your version (" + Npp.SoftwareStringVersion + ") is outdated.<br><br>Using an outdated version, you might encounter bugs that would not occur otherwise.<br>Try to update your version of Notepad++ as soon as possible, or use 3P at your own risks.<br><br><a href='https://notepad-plus-plus.org/download/'>Download the latest version of Notepad++ here</a>", MessageImg.MsgHighImportance, "Outdated version", "3P requirements are not met");
                    Config.Instance.NppOutdatedVersion = true;
                }
            }
            else
            {
                Config.Instance.NppOutdatedVersion = false;
            }

            // ReSharper disable once ObjectCreationAsStatement
            RecurentAction.StartNew(User.Ping, 1000 * 60 * 120);

            // Make sure to give the focus to scintilla on startup
            Sci.GrabFocus();

            DelayedAction.StartNew(1000, Config.Save);
        }
Example #25
0
File: Plug.cs Project: massreuy/3P
        /// <summary>
        /// Called on npp ready
        /// </summary>
        internal static bool DoNppReady()
        {
            try {
                // need to set some values in the yamuiThemeManager
                ThemeManager.OnStartUp();

                // if the UDL is not installed
                if (!Style.InstallUdl(true))
                {
                    Style.InstallUdl();
                }
                else
                {
                    // first use message?
                    if (Config.Instance.UserFirstUse)
                    {
                        UserCommunication.NotifyUnique("welcome", "<div>Dear user,<br><br>Thank you for installing 3P, you are awesome!<br><br>If this is your first look at 3P I invite you to read the <b>Getting started</b> section of the home page by clicking <a href='go'>on this link right here</a>.<br><br></div><div align='right'>Enjoy!</div>", MessageImg.MsgInfo, "Information", "Hello and welcome aboard!", args => {
                            Appli.ToggleView();
                            UserCommunication.CloseUniqueNotif("welcome");
                            args.Handled = true;
                        });
                        Config.Instance.UserFirstUse = false;
                    }
                }

                // check if npp version is meeting current recommended version
                if (!string.IsNullOrEmpty(Npp.SoftwareVersion) && !Npp.SoftwareVersion.IsHigherOrEqualVersionThan(Config.RequiredNppVersion))
                {
                    if (!Config.Instance.NppOutdatedVersion)
                    {
                        UserCommunication.Notify("This version of 3P has been developed for Notepad++ " + Config.RequiredNppVersion + ", your version (" + Npp.SoftwareVersion + ") is outdated.<br><br>Using an outdated version, you might encounter bugs that would not occur otherwise.<br>Try to update your version of Notepad++ as soon as possible, or use 3P at your own risks.<br><br><a href='https://notepad-plus-plus.org/download/'>Download the latest version of Notepad++ here</a>", MessageImg.MsgHighImportance, "Outdated version", "3P requirements are not met");
                        Config.Instance.NppOutdatedVersion = true;
                    }
                }
                else
                {
                    Config.Instance.NppOutdatedVersion = false;
                }

                // code explorer
                if (Config.Instance.CodeExplorerAutoHideOnNonProgressFile)
                {
                    CodeExplorer.Instance.Toggle(Npp.NppFileInfo.GetFullPathApi.TestAgainstListOfPatterns(Config.Instance.FilesPatternProgress));
                }
                else if (Config.Instance.CodeExplorerVisible)
                {
                    CodeExplorer.Instance.Toggle();
                }

                // File explorer
                if (Config.Instance.FileExplorerAutoHideOnNonProgressFile)
                {
                    FileExplorer.Instance.Toggle(Npp.NppFileInfo.GetFullPathApi.TestAgainstListOfPatterns(Config.Instance.FilesPatternProgress));
                }
                else if (Config.Instance.FileExplorerVisible)
                {
                    FileExplorer.Instance.Toggle();
                }

                return(true);
            } catch (Exception e) {
                ErrorHandler.ShowErrors(e, "Plugin startup");
            }
            return(false);
        }
Example #26
0
 public KdSdkApiImpl(int iParamsBlock)
 {
     this.iParamsBlock = iParamsBlock;
     _appli            = new Appli();
     _scene            = _appli.Scene;
 }
Example #27
0
        /// <summary>
        /// Called when an error occurred during the update
        /// </summary>
        /// <param name="gitHubUpdater"></param>
        /// <param name="e"></param>
        /// <param name="gitHubUpdaterFailReason"></param>
        protected virtual void OnErrorOccured(GitHubUpdater gitHubUpdater, Exception e, GitHubUpdater.GitHubUpdaterFailReason gitHubUpdaterFailReason)
        {
            try {
                switch (gitHubUpdaterFailReason)
                {
                case GitHubUpdater.GitHubUpdaterFailReason.ReleaseApiUnreachable:

                    if (Config.Instance.TechnicalLastWebserviceCallOk || AlwaysShowNotifications)
                    {
                        // only show this message once in case of repetitive failures
                        UserCommunication.NotifyUnique("Update" + UpdatedSoftName, "For your information, it has not been possible to check for new releases on GITHUB.<br><br>The API requested was :<br>" + gitHubUpdater.GitHubReleaseApi.ToHtmlLink() + "<br>You might want to check your proxy settings on the " + "options".ToHtmlLink("update options page") + HowToInstallManually, MessageImg.MsgHighImportance, UpdatedSoftName + " updater", "Couldn't query GITHUB API", args => {
                            if (args.Link.Equals("options"))
                            {
                                args.Handled = true;
                                Appli.GoToPage(PageNames.OptionsUpdate);
                            }
                        });
                    }

                    Config.Instance.TechnicalLastWebserviceCallOk = false;

                    // check if there is an update available in the Shared config folder
                    if (!String.IsNullOrEmpty(Config.Instance.SharedConfFolder) && Directory.Exists(Config.Instance.SharedConfFolder))
                    {
                        var potentialUpdate = Path.Combine(Config.Instance.SharedConfFolder, AssemblyInfo.AssemblyName);

                        // if the .dll exists, is higher version and (the user get beta releases or it's a stable release)
                        if (File.Exists(potentialUpdate) &&
                            Utils.GetDllVersion(potentialUpdate).IsHigherVersionThan(AssemblyInfo.Version) &&
                            (Config.Instance.UserGetsPreReleases || AssemblyInfo.IsPreRelease || Utils.GetDllVersion(potentialUpdate).EndsWith(".0")))
                        {
                            // copy to local update folder and warn the user
                            if (Utils.CopyFile(potentialUpdate, Path.Combine(FolderUnzip, AssemblyInfo.AssemblyName)))
                            {
                                gitHubUpdater.LatestReleaseInfo = new GitHubUpdater.ReleaseInfo {
                                    tag_name     = Utils.GetDllVersion(potentialUpdate),
                                    prerelease   = Utils.GetDllVersion(potentialUpdate).EndsWith(".1"),
                                    published_at = "???",
                                    html_url     = Config.UrlCheckReleases
                                };

                                if (ExtraActionWhenDownloaded != null)
                                {
                                    ExtraActionWhenDownloaded(gitHubUpdater);
                                }

                                gitHubUpdater.VersionLog.Append("Version found on the shared folder : \n" + Config.Instance.SharedConfFolder.ToHtmlLink() + "\n\nCheck the official website to learn more about this release");

                                NotifyUpdateAvailable(Updater);
                            }
                        }
                    }

                    break;

                default:
                    ErrorHandler.ShowErrors(e, "Update error for " + UpdatedSoftName + " : " + gitHubUpdaterFailReason);
                    break;
                }
            } finally {
                _updating = false;
            }
        }
Example #28
0
        public async Task <bool> reply(EXCHA_ACCEPT excha, string exid, string token)
        {
            //POSTデータを取得する
            var form = HttpContext.Request.Form;

            Microsoft.Extensions.Primitives.StringValues value;
            form.TryGetValue("excha", out value);
            if (value.ToString() == "accept")
            {
                excha = EXCHA_ACCEPT.accept;
            }
            else if (value.ToString() == "reject")
            {
                excha = EXCHA_ACCEPT.reject;
            }
            form.TryGetValue("exid", out value);
            exid = value.ToString();
            form.TryGetValue("token", out value);
            token = value.ToString();
            if (!PBKDF2.Verify(HttpContext.User.FindFirst(ClaimTypes.Sid).Value, token))
            {
                return(false);
            }

            //日記の情報を取得する
            Diary diary = await _context.diaries.FindAsync(exid);

            if (diary == null)
            {
                return(false);
            }
            //日記が存在するとき
            //交換可能か
            if (!await DiaryAuth.authExcha(HttpContext.User, _context, diary))
            {
                return(false);
            }
            //交換可能なとき

            //appliへ承諾を登録
            //お互いの日記に交換相手を記録
            //返却日時の記録

            //appliへ承諾を登録
            string   authId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;
            DateTime latest = await _context.leaves
                              .Where(l => l.diaryId == authId)
                              .MaxAsync(l => l.time);

            Appli appli = await _context.appli
                          .Where(a =>
                                 (a.diaryId == authId) &&
                                 (a.leafTime == latest) &&
                                 (a.apid == exid)
                                 )
                          .FirstOrDefaultAsync();

            appli.accept = excha;
            _context.Attach(appli).State = EntityState.Modified;

            if (excha == EXCHA_ACCEPT.accept)
            {
                //承諾のとき
                //お互いの日記に交換を記録
                Diary my = await _context.diaries.FindAsync(authId);

                Diary your = await _context.diaries.FindAsync(appli.apid);

                my.exid      = your.Id;
                my.retTime   = DateTime.Now.AddHours(appli.period);
                your.exid    = my.Id;
                your.retTime = DateTime.Now.AddHours(appli.period);
                _context.Attach(my).State   = EntityState.Modified;
                _context.Attach(your).State = EntityState.Modified;
            }

            await _context.SaveChangesAsync();

            return(true);
        }
Example #29
0
 void Awake()
 {
     appli = this;
 }
Example #30
0
File: Plug.cs Project: devjerome/3P
        /// <summary>
        /// Called on npp ready
        /// </summary>
        internal static bool DoNppReady()
        {
            try {
                // need to set some values in the yamuiThemeManager
                ThemeManager.OnStartUp();

                // init an empty form, this gives us a Form to hook onto if we want to do stuff on the UI thread
                // from a back groundthread with BeginInvoke()
                // once this method is done, we are able to publish notifications
                UserCommunication.Init();

                // if the UDL is not installed
                if (!Style.InstallUdl(true))
                {
                    Style.InstallUdl();
                }
                else
                {
                    // first use message?
                    if (Config.Instance.UserFirstUse)
                    {
                        UserCommunication.NotifyUnique("welcome", "<div>Dear user,<br><br>Thank you for installing 3P, you are awesome!<br><br>If this is your first look at 3P I invite you to read the <b>Getting started</b> section of the home page by clicking <a href='go'>on this link right here</a>.<br><br></div><div align='right'>Enjoy!</div>", MessageImg.MsgInfo, "Information", "Hello and welcome aboard!", args => {
                            Appli.ToggleView();
                            UserCommunication.CloseUniqueNotif("welcome");
                            args.Handled = true;
                        });
                        Config.Instance.UserFirstUse = false;
                    }
                }

                // check Npp version, 3P requires version 6.8 or higher
                if (!String.IsNullOrEmpty(Npp.GetNppVersion) && !Npp.GetNppVersion.IsHigherVersionThan("6.7"))
                {
                    UserCommunication.Notify("Dear user,<br><br>Your version of notepad++ (" + Npp.GetNppVersion + ") is outdated.<br>3P <b>requires</b> the version <b>6.8</b> or above, <b>there are known issues with inferior versions</b>. Please upgrade to an up-to-date version of Notepad++ or use 3P at your own risks.<br><br><a href='https://notepad-plus-plus.org/download/'>Download the lastest version of Notepad++ here</a>", MessageImg.MsgError, "Outdated version", "3P requirements are not met");
                }

                // Check if an update has been done and start checking for new updates
                UpdateHandler.CheckForUpdateDone();
                UpdateHandler.StartCheckingForUpdate(); // async

                // Try to update the configuration from the distant shared folder
                ShareExportConf.StartCheckingForUpdates();

                // ReSharper disable once ObjectCreationAsStatement
                new ReccurentAction(User.Ping, 1000 * 60 * 120);

                // code explorer
                if (Config.Instance.CodeExplorerAutoHideOnNonProgressFile)
                {
                    CodeExplorer.Toggle(Abl.IsCurrentProgressFile);
                }
                else if (Config.Instance.CodeExplorerVisible)
                {
                    CodeExplorer.Toggle();
                }

                // File explorer
                if (Config.Instance.FileExplorerAutoHideOnNonProgressFile)
                {
                    FileExplorer.Toggle(Abl.IsCurrentProgressFile);
                }
                else if (Config.Instance.FileExplorerVisible)
                {
                    FileExplorer.Toggle();
                }

                return(true);
            } catch (Exception e) {
                ErrorHandler.ShowErrors(e, "Plugin startup");
            }
            return(false);
        }