Ejemplo n.º 1
0
        private void AttachToSelectedProcess()
        {
            Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
            var  selectedRows = processesGridView.SelectedRows;
            uint processId    = 0;
            var  program      = "";

            foreach (var row in selectedRows)
            {
                var     datagridRow = (DataGridViewRow)row;
                dynamic process     = datagridRow.DataBoundItem;
                processId = process.ProcessId;
                program   = process.CommandLine;
            }

            if (processId <= 0)
            {
                return;
            }

            try
            {
                AttachService.AttachToProcess(DTE, processId, program);
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to attach to process: " + ex.ToString());
            }
        }
Ejemplo n.º 2
0
        public RemoteFileController(AttachService attachService
                                    , TokenSerivce tokenSerivce
                                    , NoteFileService noteFileService
                                    , UserService userService
                                    , ConfigFileService configFileService
                                    , IHttpContextAccessor accessor
                                    , AccessService accessService
                                    , ConfigService configService
                                    , TagService tagService
                                    , NoteService noteService
                                    , NotebookService notebookService
                                    , IWebHostEnvironment webHostEnvironment
                                    , ISevenZipCompressor sevenZipCompressor
                                    , BlogService blogService
                                    ) :
            base(attachService, tokenSerivce, noteFileService, userService, configFileService, accessor)
        {
            this.accessService      = accessService;
            this.blogService        = blogService;
            this.configService      = configService;
            this.tagService         = tagService;
            this.notebookService    = notebookService;
            this.noteService        = noteService;
            this.HostEnvironment    = webHostEnvironment;
            this.SevenZipCompressor = sevenZipCompressor;

            if (RuntimeEnvironment.IsWindows)
            {
                PathRoot = @"C:\";
            }
        }
Ejemplo n.º 3
0
        public ActionResult DeleteFile(string id, int fileId)
        {
            var files = AttachService.Find(o => o.Id == fileId && o.SourceClassify == 2);
            var re    = AttachService.Delete(files);

            return(new JsonNetResult(re));
        }
Ejemplo n.º 4
0
 public NoteAPIController(AttachService attachService
                          , TokenSerivce tokenSerivce
                          , NoteFileService noteFileService
                          , UserService userService
                          , ConfigFileService configFileService
                          , IHttpContextAccessor accessor,
                          NoteService noteService,
                          NoteContentService noteContentService,
                          NotebookService notebookService,
                          NoteRepositoryService noteRepositoryService,
                          TrashService trashService,
                          EPassService ePass,
                          GMService gMService,
                          DataSignService dataSignService
                          ) :
     base(attachService, tokenSerivce, noteFileService, userService, configFileService, accessor)
 {
     this.attachService         = attachService;
     this.noteService           = noteService;
     this.tokenSerivce          = tokenSerivce;
     this.noteContentService    = noteContentService;
     this.trashService          = trashService;
     this.accessor              = accessor;
     this.notebookService       = notebookService;
     this.noteRepositoryService = noteRepositoryService;
     this.ePassService          = ePass;
     this.dataSignService       = dataSignService;
     this.gMService             = gMService;
 }
Ejemplo n.º 5
0
        public APPController(AttachService attachService
                             , TokenSerivce tokenSerivce
                             , NoteFileService noteFileService
                             , UserService userService
                             , ConfigFileService configFileService

                             , IHttpContextAccessor accessor) :
            base(attachService, tokenSerivce, noteFileService, userService, configFileService, accessor)
        {
        }
Ejemplo n.º 6
0
 public MemberIndexController(AttachService attachService
                              , TokenSerivce tokenSerivce
                              , NoteFileService noteFileService
                              , UserService userService
                              , ConfigFileService configFileService
                              , IHttpContextAccessor accessor, NoteService noteService
                              ) :
     base(attachService, tokenSerivce, noteFileService, userService, configFileService, accessor)
 {
     this.noteService = noteService;
 }
Ejemplo n.º 7
0
        public ActionResult DeleteFile(string Id, int fileId)
        {
            var files = AttachService.Find(o => o.Id == fileId && o.SourceClassify == 1);
            var re    = AttachService.Delete(files);

            #region 操作日志
            var msg = LogEngine.CompareModelToLog <Attachment>(LogModule.合同管理, null, files);
            new LogEngine().WriteDelete(msg, LogModule.合同管理);
            #endregion
            return(new JsonNetResult(re));
        }
Ejemplo n.º 8
0
 public JoplinTestingController(AttachService attachService
                                , TokenSerivce tokenSerivce
                                , NoteFileService noteFileService
                                , UserService userService
                                , ConfigFileService configFileService
                                , IHttpContextAccessor accessor
                                , AuthService authService
                                ) :
     base(attachService, tokenSerivce, noteFileService, userService, configFileService, accessor)
 {
     this.AuthService = authService;
 }
Ejemplo n.º 9
0
 public SpamController(AttachService attachService
                       , TokenSerivce tokenSerivce
                       , NoteFileService noteFileService
                       , UserService userService
                       , ConfigFileService configFileService
                       , IHttpContextAccessor accessor,
                       SpamService spamService
                       ) :
     base(attachService, tokenSerivce, noteFileService, userService, configFileService, accessor)
 {
     this.spamService = spamService;
 }
Ejemplo n.º 10
0
 public TagAPIController(AttachService attachService
                         , TokenSerivce tokenSerivce
                         , NoteFileService noteFileService
                         , UserService userService
                         , ConfigFileService configFileService
                         , IHttpContextAccessor accessor,
                         TagService tagService
                         ) :
     base(attachService, tokenSerivce, noteFileService, userService, configFileService, accessor)
 {
     this.tokenSerivce = tokenSerivce;
     this.tagService   = tagService;
 }
Ejemplo n.º 11
0
 public VditorController(AttachService attachService
                         , TokenSerivce tokenSerivce
                         , NoteFileService noteFileService
                         , UserService userService
                         , ConfigFileService configFileService
                         , IHttpContextAccessor accessor, AuthService authService
                         ) :
     base(attachService, tokenSerivce, noteFileService, userService, configFileService, accessor)
 {
     this.authService  = authService;
     this.userService  = userService;
     this.tokenSerivce = tokenSerivce;
 }
Ejemplo n.º 12
0
 public FileAPIController(AttachService attachService
                          , TokenSerivce tokenSerivce
                          , NoteFileService noteFileService
                          , UserService userService
                          , ConfigFileService configFileService
                          , IHttpContextAccessor accessor,
                          NoteService noteService
                          ) :
     base(attachService, tokenSerivce, noteFileService, userService, configFileService, accessor)
 {
     this.noteService   = noteService;
     this.webSiteConfig = configFileService.WebConfig;
 }
Ejemplo n.º 13
0
        public void SaveAttach(string fileName, string fileType, string filePath, string thumbPath, string fileSize, string fileExt)
        {
            AttachService  attachService  = new AttachService();
            AttachInputDto attachInputDto = new AttachInputDto();

            attachInputDto.FileName  = fileName;
            attachInputDto.FileType  = fileType;
            attachInputDto.FilePath  = filePath;
            attachInputDto.FileSize  = Convert.ToInt64(fileSize);
            attachInputDto.FileExt   = fileExt;
            attachInputDto.ThumbPath = thumbPath;
            attachService.SubmitForm(attachInputDto, "");
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 附件操作
        /// </summary>
        /// <param name="httpFiles"></param>
        /// <param name="fileId"></param>
        /// <param name="isTrans">回复或转发</param>
        /// <returns></returns>
        static List <Attachment> GetAttachs(System.Web.HttpFileCollectionBase httpFiles, string fileId, bool isTrans)
        {
            var relativePath = "";
            var path         = Sys.SysConstPool.SaveAttachPath(ref relativePath);
            var root         = Sys.SysConstPool.GetRoot;
            var list         = new List <Attachment>();

            if (isTrans && !fileId.IsNullOrEmpty())
            {
                var ids     = fileId.Split(',').Select(o => int.Parse(o)).ToList();
                var attachs = AttachService.FindList(o => ids.Contains(o.Id));
                foreach (var att in attachs)
                {
                    var      full = Path.Combine(root, att.SaveUrl);
                    FileInfo file = new FileInfo(full);
                    if (!file.Exists)
                    {
                        continue;
                    }
                    var destFileName = att.SaveUrl.Replace(file.Name, CommonRules.GUID + file.Extension);
                    var destFile     = Path.Combine(root, destFileName);
                    var info         = file.CopyTo(destFile);
                    list.Add(new Attachment()
                    {
                        SourceClassify = 3,
                        Title          = att.Title,
                        Size           = att.Size,
                        SaveUrl        = destFileName
                    });
                }
            }
            for (int i = 0; i < httpFiles.Count; i++)
            {
                var file = httpFiles[i];
                if (file.ContentLength <= 0)
                {
                    continue;
                }
                var    filename = CommonRules.GUID + Path.GetExtension(file.FileName);
                string fullname = path + filename;
                file.SaveAs(fullname);
                list.Add(new Attachment()
                {
                    SourceClassify = 3,
                    Title          = Path.GetFileName(file.FileName),
                    Size           = file.ContentLength / 1024,
                    SaveUrl        = relativePath + filename
                });
            }
            return(list);
        }
Ejemplo n.º 15
0
 public OrganizationController(AttachService attachService
                               , TokenSerivce tokenSerivce
                               , NoteFileService noteFileService
                               , UserService userService
                               , ConfigFileService configFileService
                               , IHttpContextAccessor accessor,
                               NotebookService notebookService,
                               OrganizationService organizationService,
                               NoteRepositoryService noteRepositoryService
                               ) :
     base(attachService, tokenSerivce, noteFileService, userService, configFileService, accessor)
 {
     this.organizationService = organizationService;
 }
Ejemplo n.º 16
0
 public FIDO2Controller(AttachService attachService
                        , TokenSerivce tokenSerivce
                        , NoteFileService noteFileService
                        , UserService userService
                        , ConfigFileService configFileService
                        , IHttpContextAccessor accessor
                        , AuthService authService
                        , FIDO2Service fIDO2Service
                        ) :
     base(attachService, tokenSerivce, noteFileService, userService, configFileService, accessor)
 {
     this.authService  = authService;
     this.fido2Service = fIDO2Service;
 }
Ejemplo n.º 17
0
 public USBKeyController(AttachService attachService
                         , TokenSerivce tokenSerivce
                         , NoteFileService noteFileService
                         , UserService userService
                         , ConfigFileService configFileService
                         , IHttpContextAccessor accessor
                         , AuthService authService
                         , EPassService ePassService
                         ) :
     base(attachService, tokenSerivce, noteFileService, userService, configFileService, accessor)
 {
     this.authService = authService;
     this.ePass       = ePassService;
 }
Ejemplo n.º 18
0
 public PayJSController(AttachService attachService
                        , TokenSerivce tokenSerivce
                        , NoteFileService noteFileService
                        , UserService userService
                        , ConfigFileService configFileService
                        , IHttpContextAccessor accessor
                        , DataContext dataContext
                        ) :
     base(attachService, tokenSerivce, noteFileService, userService, configFileService, accessor)
 {
     this.dataContext       = dataContext;
     this.configFileService = configFileService;
     webSiteConfig          = configFileService.WebConfig;
     pay = new Payjs(webSiteConfig.Payjs.PayJS_MCHID, webSiteConfig.Payjs.PayJS_Key);
 }
Ejemplo n.º 19
0
        public BaseController(AttachService attachService
                              , TokenSerivce tokenSerivce
                              , NoteFileService noteFileService
                              , UserService userService
                              , ConfigFileService configFileService
                              , IHttpContextAccessor accessor

                              )
        {
            this.attachService     = attachService;
            this.tokenSerivce      = tokenSerivce;
            this.noteFileService   = noteFileService;
            this.configFileService = configFileService;
            this.userService       = userService;
            this._accessor         = accessor;

            config = configFileService.WebConfig;
        }
Ejemplo n.º 20
0
        public AuthController(AttachService attachService
                              , TokenSerivce tokenSerivce
                              , NoteFileService noteFileService
                              , UserService userService
                              , ConfigFileService configFileService
                              , IDistributedCache distributedCache

                              , IHttpContextAccessor accessor,
                              AuthService authService,
                              ConfigService configService
                              ) :
            base(attachService, tokenSerivce, noteFileService, userService, configFileService, accessor)
        {
            this.distributedCache = distributedCache;
            this.authService      = authService;
            this.configService    = configService;
            this.config           = configService.config;
        }
Ejemplo n.º 21
0
 public NotesRepositoryController(AttachService attachService
                                  , TokenSerivce tokenSerivce
                                  , NoteFileService noteFileService
                                  , UserService userService
                                  , ConfigFileService configFileService
                                  , IHttpContextAccessor accessor,
                                  NotebookService notebookService,
                                  NoteRepositoryService noteRepositoryService,
                                  OrganizationService organizationService,
                                  EPassService ePassService,
                                  DataSignService dataSignService
                                  ) :
     base(attachService, tokenSerivce, noteFileService, userService, configFileService, accessor)
 {
     this.notebookService       = notebookService;
     this.noteRepositoryService = noteRepositoryService;
     this.ePassService          = ePassService;
     this.dataSignService       = dataSignService;
 }
Ejemplo n.º 22
0
        public ActionResult DeleteFile(int fileId, string isBack)
        {
            var op = new OpResult();

            if (isBack == "1")//在转发或恢复中删除
            {
                op.Successed = true;
            }
            else
            {
                var file = AttachService.Find(o => o.Id == fileId && o.SourceClassify == 3);
                var re   = AttachService.Delete(file);
                if (re.Successed)
                {
                    System.IO.File.Delete(System.IO.Path.Combine(Pharos.Sys.SysConstPool.GetRoot, file.SaveUrl));
                }
            }
            return(new JsonNetResult(op));
        }
Ejemplo n.º 23
0
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void Execute(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            if (!string.IsNullOrWhiteSpace(AttachService.PreviousProgram))
            {
                var success = AttachService.AttachToProgram(_dte, AttachService.PreviousProgram);
                if (success)
                {
                    return;
                }
            }

            var form = new AttachForm
            {
                DTE = _dte
            };

            form.ShowDialog();
        }
Ejemplo n.º 24
0
        public APIController(AttachService attachService
                             , TokenSerivce tokenSerivce
                             , NoteFileService noteFileService
                             , UserService userService
                             , ConfigFileService configFileService
                             , IHttpContextAccessor accessor,
                             AccessService accessService,
                             DataContext dataContext


                             ) : base(attachService, tokenSerivce, noteFileService, userService, configFileService, accessor)
        {
            this.AccessService = accessService;
            this.dataContext   = dataContext;

            this.configFileService = configFileService;
            webcConfig             = configFileService.WebConfig;

            _randomImageFuseSize = webcConfig.PublicAPI.RandomImageFuseSize;
        }
Ejemplo n.º 25
0
 public UserAPIController(AttachService attachService
                          , TokenSerivce tokenSerivce
                          , NoteFileService noteFileService
                          , UserService userService
                          , ConfigFileService configFileService
                          , GMService gMService
                          , RealNameService realNameService
                          , IHttpContextAccessor accessor, AuthService authService
                          , EPassService ePass
                          , DataSignService dataSignService
                          ) :
     base(attachService, tokenSerivce, noteFileService, userService, configFileService, accessor)
 {
     this.authService     = authService;
     this.userService     = userService;
     this.tokenSerivce    = tokenSerivce;
     this.realNameService = realNameService;
     this.ePassService    = ePass;
     this.gMService       = gMService;
     this.dataSignService = dataSignService;
 }
Ejemplo n.º 26
0
 public CommonController(AttachService attachService
                         , TokenSerivce tokenSerivce
                         , NoteFileService noteFileService
                         , UserService userService
                         , ConfigFileService configFileService
                         , IHttpContextAccessor accessor,
                         NoteService noteService,
                         NoteContentService noteContentService,
                         NotebookService notebookService,
                         NoteRepositoryService noteRepositoryService,
                         TrashService trashService
                         ) :
     base(attachService, tokenSerivce, noteFileService, userService, configFileService, accessor)
 {
     this.attachService         = attachService;
     this.noteService           = noteService;
     this.tokenSerivce          = tokenSerivce;
     this.noteContentService    = noteContentService;
     this.trashService          = trashService;
     this.accessor              = accessor;
     this.notebookService       = notebookService;
     this.noteRepositoryService = noteRepositoryService;
 }
Ejemplo n.º 27
0
 public NoteController(AttachService attachService
                       , TokenSerivce tokenSerivce
                       , NoteFileService noteFileService
                       , UserService userService
                       , ShareService shareService
                       , ConfigFileService configFileService
                       , IWebHostEnvironment env
                       , TagService tagService
                       , TrashService trashService
                       , IHttpContextAccessor accessor
                       , NotebookService notebookService
                       , NoteService noteService
                       , NoteContentService noteContentService
                       ) :
     base(attachService, tokenSerivce, noteFileService, userService, configFileService, accessor)
 {
     this.notebookService    = notebookService;
     this.noteService        = noteService;
     this.noteContentService = noteContentService;
     this.env          = env;
     this.tagService   = tagService;
     this.trashService = trashService;
 }
Ejemplo n.º 28
0
        //todo:下载附件
        public IActionResult GetAttach(string fileId)
        {
            if (string.IsNullOrEmpty(fileId))
            {
                return(Content("error"));
            }
            if (fileId.Length == 24)
            {
                fileId = fileId.Substring(0, 16);
            }
            var attachFile = AttachService.GetAttach(MyConvert.HexToLong(fileId));

            if (attachFile == null)
            {
                return(Content("NoFoundAttach"));
            }
            var    stream  = System.IO.File.OpenRead(attachFile.Path);
            string fileExt = Path.GetExtension(attachFile.Name);
            //获取文件的ContentType
            var provider = new FileExtensionContentTypeProvider();
            var memi     = provider.Mappings[fileExt];

            return(File(stream, memi, Path.GetFileName(attachFile.Path)));
        }
Ejemplo n.º 29
0
 public BlogController(AttachService attachService
                       , TokenSerivce tokenSerivce
                       , NoteFileService noteFileService
                       , UserService userService
                       , ConfigFileService configFileService
                       , IHttpContextAccessor accessor
                       , AccessService accessService
                       , ConfigService configService
                       , TagService tagService
                       , NoteService noteService
                       , NotebookService notebookService
                       , BlogService blogService
                       , NoteRepositoryService noteRepository
                       ) :
     base(attachService, tokenSerivce, noteFileService, userService, configFileService, accessor)
 {
     this.accessService   = accessService;
     this.blogService     = blogService;
     this.configService   = configService;
     this.tagService      = tagService;
     this.notebookService = notebookService;
     this.noteService     = noteService;
     this.noteRepository  = noteRepository;
 }
Ejemplo n.º 30
0
 public AttachController(AttachService attachService, IHostingEnvironment env)
 {
     _service          = attachService;
     _env              = env;
     _uploadAttachPath = Path.Combine(_env.WebRootPath, "Uploads", "Attach");
 }