예제 #1
0
        public static string GetLastPath(Guid UserId)
        {
            var find = LastPath.Get(UserId);

            if (find != null && find.ContainsKey("Path"))
            {
                var obj = find["Path"];
                if (obj != null)
                {
                    return(ClarifyPath(obj.ToString()));
                }
            }
            return(null);
        }
예제 #2
0
        void miCopySpectr_Click(object sender, EventArgs e)
        {
            try
            {
                if (Selected == null)
                {
                    MessageBox.Show(MainForm.MForm,
                                    Common.MLS.Get(MLSConst, "Выберите спектр который нужно перемерить"),
                                    Common.MLS.Get(MLSConst, "Предупреждение"),
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Warning
                                    );
                    return;
                }

                LastPath = SelectedTag.GetPath();

                /*DialogResult dr = MessageBox.Show(MainForm.MForm,
                 *      Common.MLS.Get(MLSConst, "Вы действительно хотите перемерить спектр: ") + LastPath,
                 *      Common.MLS.Get(MLSConst, "Осторожно!!!"),
                 *      MessageBoxButtons.YesNo,
                 *      MessageBoxIcon.Warning);
                 *
                 * if (dr == DialogResult.No)
                 *  return;*/

                string name = util.StringDialog.GetString(MainForm.MForm,
                                                          Common.MLS.Get(MLSConst, "Копирование пробы"),
                                                          Common.MLS.Get(MLSConst, "Введите имя для копии пробы:") + LastPath,
                                                          "", true);

                if (name == null)
                {
                    return;
                }

                Spectr sp       = new Spectr(LastPath);
                int    path_ind = LastPath.LastIndexOf('\\');
                string path     = LastPath.Substring(0, path_ind + 1);
                sp.SaveAs(path + name);
                ReLoadList();
            }
            catch (Exception ex)
            {
                Common.Log(ex);
            }
        }
예제 #3
0
        public static void UpdateLastPath(BackendLog log)
        {
            if (log == null || log.UserId == default(Guid) || log.Url == null)
            {
                return;
            }

            if (log.Url.Length > 700)
            {
                return;  // too long.
            }

            var lower = log.Url.ToLower();

            if (lower.StartsWith("/_admin"))
            {
                foreach (var item in IgnorePath)
                {
                    if (lower.StartsWith(item))
                    {
                        return;
                    }
                }

                if (lower.EndsWith(".html") || lower.EndsWith(".js") || lower.EndsWith(".css") || lower.EndsWith(".png"))
                {
                    return;
                }

                var find = LastPath.Get(log.UserId);
                if (find != null && find.ContainsKey("_id"))
                {
                    LastPath.UpdateColumn(find["_id"], "Path", log.Url);
                }
                else
                {
                    Dictionary <string, object> data = new Dictionary <string, object>();
                    data["_id"]  = log.UserId;
                    data["Path"] = log.Url;
                    LastPath.Add(data);
                }

                LastPath.Close();
            }
        }