Пример #1
0
        /// <summary>
        /// 上传文档的按钮点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UploadDoc_ButtonClick(object sender, RoutedEventArgs e)
        {
            string uploadDocName = string.Empty;

            if (ofd.ShowDialog() == true)
            {
                uploadDocName = ofd.FileName;
            }
            if (uploadDocName != "")
            {
                string docPath    = uploadDocName;
                string ServerPath = string.Empty;
                string docName    = string.Empty;
                //如果执行上传操作成功,将文件信息添加到数据库中
                if (waysOfWord.WayOfUploadDoc(userId, docPath, ref docName, ref ServerPath) == true)
                {
                    DocInfo docInfo = new DocInfo();
                    docInfo.DocId         = WaysOfString.ReturnNowTimeString();
                    docInfo.DocName       = docName;//更改文档名称为当前时间+队伍账号
                    docInfo.DocPath       = ServerPath;
                    docInfo.UserId        = userId;
                    docInfo.DocIsLast     = 1;//上传后为最新版本
                    docInfo.DocUploadTime = DateTime.Now;
                    docInfo.DocState      = 0;
                    db.SaveUploadDocInfo(docInfo);//插入数据库文件名和时间
                    MessageBox.Show("上传成功!");
                }
            }
            //上传文档后重新加载页面
            LoadDocInfo();
        }
Пример #2
0
        private static void OutputInfo(DocInfo info)
        {
            Message.PrintLine("Summary:\r\n{0}", ConsoleColor.Blue, info.Summary);
            Message.PrintLine("DeclaringTypName: {0}", ConsoleColor.Yellow, info.DeclaringTypeName);
            Message.PrintLine("MemberType: {0}", ConsoleColor.Magenta, info.MemberType.ToString());
            Message.PrintLine("MemberName: {0}", ConsoleColor.Yellow, info.MemberName);

            if (info.MemberType == ClassMemberType.Method)
            {
                info.ParamInfos.Each(p =>
                {
                    Message.PrintLine("Parameter: {0}, Description: {1}", p.Name, p.Description);
                });
            }
            if (info.HasExtraItems)
            {
                OutLine("Extra Items", ConsoleColor.Yellow);
                info.Items().Each(o =>
                {
                    if (o != null)
                    {
                        Message.PrintLine("\tType: {0}", ConsoleColor.Yellow, o.GetType());
                        Message.PrintLine("\t{0}", o.PropertiesToString());
                    }
                });
            }
        }
Пример #3
0
        void OnModuleLoad(object sender, CorModuleEventArgs e)
        {
            CorMetadataImport mi = new CorMetadataImport(e.Module);

            // Required to avoid the jit to get rid of variables too early
            e.Module.JITCompilerFlags = CorDebugJITCompilerFlags.CORDEBUG_JIT_DISABLE_OPTIMIZATION;

            string file = e.Module.Assembly.Name;

            lock (documents) {
                ISymbolReader reader = null;
                if (file.IndexOfAny(System.IO.Path.InvalidPathChars) == -1 && System.IO.File.Exists(System.IO.Path.ChangeExtension(file, ".pdb")))
                {
                    try {
                        reader = symbolBinder.GetReaderForFile(mi.RawCOMObject, file, ".");
                        foreach (ISymbolDocument doc in reader.GetDocuments())
                        {
                            if (string.IsNullOrEmpty(doc.URL))
                            {
                                continue;
                            }
                            string  docFile = System.IO.Path.GetFullPath(doc.URL);
                            DocInfo di      = new DocInfo();
                            di.Document        = doc;
                            di.Reader          = reader;
                            di.Module          = e.Module;
                            documents[docFile] = di;
                            NotifySourceFileLoaded(docFile);
                        }
                    }
                    catch (Exception ex) {
                        OnDebuggerOutput(true, string.Format("Debugger Error: {0}\n", ex.Message));
                    }
                    e.Module.SetJmcStatus(true, null);
                }
                else
                {
                    // Flag modules without debug info as not JMC. In this way
                    // the debugger won't try to step into them
                    e.Module.SetJmcStatus(false, null);
                }

                ModuleInfo moi;

                if (modules.TryGetValue(e.Module.Name, out moi))
                {
                    moi.References++;
                }
                else
                {
                    moi                    = new ModuleInfo();
                    moi.Module             = e.Module;
                    moi.Reader             = reader;
                    moi.Importer           = mi;
                    moi.References         = 1;
                    modules[e.Module.Name] = moi;
                }
            }
            e.Continue = true;
        }
Пример #4
0
        public void BeginExtract(DocInfo fi)
        {
            // Control.CheckForIllegalCrossThreadCalls = false;
            while (sosoForm.UR.Count >= sosoForm.MaxQue)
            {
                System.Threading.Thread.Sleep(1000);
            }
            //DocInfo fi = (DocInfo)cu.DeQueue();
            string html = GetWebHtml(fi.DownAddress);

            if (html != null)
            {
                if (fi.DocName.StartsWith("word文档下载"))
                {
                    int i = fi.DownAddress.LastIndexOf('/');
                    Surl = fi.DownAddress.Remove(i + 1);
                }
                else
                {
                    Surl = sosoForm.wi.webUrl;
                }
                fi.DownAddress = ExtractUrl(html);
                if (!string.IsNullOrEmpty(fi.DownAddress))
                {
                    sosoForm.UR.Enqueue(fi);
                    sosoForm.filecount++;
                }
            }
        }
Пример #5
0
 public StyleTag(string tagName, IAttributes attributes, string innerText, DocInfo docInfo)
 {
     Attributes = attributes;
     InnerText  = innerText;
     TagName    = tagName;
     DocInfo    = docInfo;
 }
Пример #6
0
        public ActionResult ListGrid()
        {
            XmlDocument xml = new XmlDocument();

            xml.Load(Server.MapPath("~/_Code/SysDoc/Doc.xml"));
            XmlNodeList    xmlE = xml.GetElementsByTagName("file");
            List <DocInfo> l    = new List <DocInfo>();

            foreach (XmlElement f in xmlE)
            {
                String f_name = f.GetElementsByTagName("name").Item(0).FirstChild.Value;
                String f_sort = f.GetElementsByTagName("sort").Item(0).FirstChild.Value;
                String f_memo = f.GetElementsByTagName("memo").Item(0).FirstChild.Value;

                if (System.IO.File.Exists(Server.MapPath("~/_Code/SysDoc/" + f_name)))
                {
                    DocInfo d = new DocInfo()
                    {
                        Name = f_name, Sort = int.Parse(f_sort), Momo = f_memo, Link = Url.Content("~/_Code/SysDoc/" + f_name)
                    };
                    l.Add(d);
                }
            }
            return(View("ListData", l.ToArray().OrderBy(x => x.Sort)));
        }
Пример #7
0
        public string RevsDiff(NDB.NouchDB db, RemoteDB remoteDB, DocInfo[] docInfo)
        {
            var result = "[";
            Dictionary <string, string> docList = new Dictionary <string, string>();

            for (int f = 0; f < docInfo.Length; f++)
            {
                DocInfo remoteDoc = docInfo[f];
                long    revision  = Convert.ToInt64(remoteDoc.Revision.Split('-')[0]);
                Node    localDoc  = db.GetDocInfo(remoteDoc.ID);

                if (localDoc == null)
                {
                    if (Convert.ToInt64(localDoc.currentVersion) < revision)
                    {
                        if (!docList.ContainsKey(remoteDoc.ID))
                        {
                            docList.Add(remoteDoc.ID, "");
                        }
                    }
                }
                else
                {
                    if (!docList.ContainsKey(remoteDoc.ID))
                    {
                        docList.Add(remoteDoc.ID, "");
                    }
                }
            }

            return(JsonMapper.ToJson(docList.Keys));
        }
Пример #8
0
 public ScriptTag(string tagName, IAttributes attributes, string innerText, DocInfo docInfo)
 {
     Attributes     = attributes;
     this.InnerText = innerText;
     TagName        = tagName;
     DocInfo        = docInfo;
 }
Пример #9
0
        /// <summary>
        /// 获取所有文档信息
        /// </summary>
        /// <returns>文档信息列表的json字符串形式</returns>
        public string GetAll(int page, int rows)
        {
            int            start = (page - 1) * rows;
            int            end   = page * rows;
            List <DocInfo> files = new List <DocInfo>();
            string         sql   = "SELECT * FROM `web`.`文档库`";

            string where = "limit " + start + "," + end;
            Dictionary <string, object> d = new Dictionary <string, object>();
            //获取数据总数(注意是总数,不是一页中数据的条数)
            DataTable dTable = data.GetTable(sql);

            d.Add("total", data.GetTable(sql).Rows.Count);
            //获取page页的数据
            dTable = dTable.AsEnumerable().Skip((page - 1) * rows).Take(rows).CopyToDataTable();
            for (int i = 0; i < dTable.Rows.Count; i++)
            {
                DocInfo file = new DocInfo();
                file.Id         = int.Parse(dTable.Rows[i]["文档编号"].ToString());
                file.JZId       = dTable.Rows[i]["机组编号"].ToString();
                file.UploadTime = dTable.Rows[i]["上传时间"].ToString();
                file.Note       = dTable.Rows[i]["备注"].ToString();
                file.Name       = dTable.Rows[i]["文档名"].ToString();
                file.Type       = dTable.Rows[i]["类型"].ToString();
                files.Add(file);
            }
            d.Add("rows", files);
            return(JsonConvert.SerializeObject(d));
        }
Пример #10
0
        //Возвращает документ абитуриента, удостоверяющий личность")]
        private DocInfo GetIDDocumentData(int ncode)
        {
            using (DataLayer.AbitDataContext ctx = new DataLayer.AbitDataContext(conn))
            {
                try
                {
                    DocInfo res = ctx.Doc_studs.Where(p => (p.nCode == ncode) && (p.document.IsIdentity)).Select(x => new DocInfo()
                    {
                        ID = (int)x.Ik_doc,
                        DocTypeKey = x.Ik_vid_doc,
                        DocTypeName = x.document.cvid_doc,
                        Given = x.Dd_vidan,
                        GivenBy = x.Cd_kem_vidan,
                        Serie = x.Cd_seria,
                        Number = x.Np_number
                    }).First();

                    return res;
                }
                catch
                {
                    return null;
                }
            }
        }
        public int RegisterAndLockDocument(uint grfRDTLockType, string pszMkDocument, IVsHierarchy pHier, uint itemid, IntPtr punkDocData, out uint pdwCookie)
        {
            uint cookie = 0;
            int  res    = _vs.Invoke(() => {
                cookie         = _ids[pszMkDocument] = ++_curCookie;
                _table[cookie] = new DocInfo(
                    (_VSRDTFLAGS)grfRDTLockType,
                    pszMkDocument,
                    pHier,
                    itemid,
                    punkDocData,
                    cookie
                    );

                if (punkDocData != IntPtr.Zero)
                {
                    Marshal.AddRef(punkDocData);
                }
                var persist = (IVsPersistDocData)Marshal.GetObjectForIUnknown(punkDocData);
                return(persist.OnRegisterDocData(cookie, pHier, itemid));
            });

            pdwCookie = cookie;
            return(res);
        }
Пример #12
0
        public ActionResult ListGrid()
        {
            XmlDocument xml = new XmlDocument();
            xml.Load(Server.MapPath("~/_Code/SysDoc/Doc.xml"));
            XmlNodeList xmlE = xml.GetElementsByTagName("file");
            List<DocInfo> l = new List<DocInfo>();
            foreach (XmlElement f in xmlE)
            {
                String f_name = f.GetElementsByTagName("name").Item(0).FirstChild.Value;
                String f_sort = f.GetElementsByTagName("sort").Item(0).FirstChild.Value;
                String f_memo = f.GetElementsByTagName("memo").Item(0).FirstChild.Value;

                if (System.IO.File.Exists(Server.MapPath("~/_Code/SysDoc/" + f_name)))
                {
                    DocInfo d = new DocInfo()
                    {
                        Name = f_name,
                        Sort = int.Parse(f_sort),
                        Momo = f_memo,
                        Link = Url.Content("~/_Code/SysDoc/" + f_name)
                    };
                    l.Add(d);
                }
            }
            return View("ListData", l.ToArray().OrderBy(x => x.Sort));
        }
Пример #13
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="url"></param>
        public Scraper(string url)
        {
            try
            {
                if (IsValidUrl(url))
                {
                    SiteUri = new Uri(url);
                    var webGet = new HtmlWeb();
                    Document = webGet.Load(url);

                    DocInfo = new DocInfo
                    {
                        Url        = url,
                        IsValidUrl = true
                    };
                    Loaded = true;
                }
                else
                {
                    throw new Exception($"Invalid url! {url}");
                }
            }
            catch (Exception exc)
            {
                LogEntry = new LogEntry(exc);
                LogEntry.SaveLogEntryFile();
            }
        }
Пример #14
0
        public void InfoTypeTest()
        {
            doc = SetupForSavingTests();

            string imagepath = doc.SaveImage();

            Assert.IsTrue(Directory.Exists(doc.GetDestination()));
        }
Пример #15
0
        public void InfoSaveTest()
        {
            doc = SetupForSavingTests();

            string imagepath = doc.SaveImage();

            Assert.IsTrue(File.Exists(imagepath));
        }
Пример #16
0
        /// <summary>
        /// Displays prerecorded data on a previously run url
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult History(Guid id)
        {
            DocInfo item = Scraper.ReadHistoryItem(id);

            return(item != null
                ? View("~/Views/UrlScraper/Results.cshtml", item)
                : null);
        }
        int ICorDebugManagedCallback.LoadAssembly(CorDebugAppDomain pAppDomain, CorDebugAssembly pAssembly)
        {
            assemblies.Add(pAssembly);

            //CorMetadataImport mi = new CorMetadataImport(pAssembly);

            //Seems like this is always set on MicroFramework
            //pAssembly. JITCompilerFlags = CorDebugJITCompilerFlags.CORDEBUG_JIT_DISABLE_OPTIMIZATION;
            List <string> docPaths = new List <string>();

            if (pAssembly.DebugData != null)
            {
                var md     = pAssembly.MetaData;
                var reader = pAssembly.DebugData;
                if (!pAssembly.IsFrameworkAssembly)
                {
                    foreach (var module in md.Assembly.Modules)
                    {
                        foreach (var t in module.Types)
                        {
                            foreach (var m in t.Methods)
                            {
                                var methodSymbols = m.DebugInformation;
                                if (!methodSymbols.HasSequencePoints)
                                {
                                    continue;
                                }
                                DocInfo document;
                                if (!documents.TryGetValue(methodSymbols.SequencePoints[0].Document.Url, out document))
                                {
                                    document          = new DocInfo(methodSymbols.SequencePoints[0].Document.Url);
                                    document.Assembly = pAssembly;
                                    documents.Add(document.Url, document);
                                }
                                document.AddMethod(m, methodSymbols);
                                if (!docPaths.Contains(document.Url))
                                {
                                    docPaths.Add(document.Url);
                                }
                            }
                        }
                    }
                }
                pAssembly.SetJmcStatus(true);
            }
            else
            {
                // Flag modules without debug info as not JMC. In this way
                // the debugger won't try to step into them
                pAssembly.SetJmcStatus(false);
            }
            foreach (var docPath in docPaths)
            {
                BindSourceFileBreakpoints(docPath);
            }
            pAppDomain.Process.Continue();
            return(0);
        }
Пример #18
0
        public static void Init()
        {
            DocInfo doc;

            doc          = new DocInfo("_1", "dssp-specs-0.9.0.pdf", "Digital Signature Service Protocol Specifications version 0.9.0");
            docs[doc.Id] = doc;
            doc          = new DocInfo("_2", "dssp-specs-1.1.0.pdf", "Digital Signature Service Protocol Specifications version 1.1.0");
            docs[doc.Id] = doc;
        }
Пример #19
0
        /// <summary>
        /// 保存上传的文档信息到数据库
        /// 不包含上传文档的功能
        /// </summary>
        /// <param name="docInfo"></param>
        /// <returns></returns>
        public int SaveUploadDocInfo(DocInfo docInfo)
        {
            //将数据结构中的参数与存储过程中的参数一一对应
            string procName = "proc_UploadAndDownload";

            SqlParameter[] sp = new SqlParameter[] {
                new SqlParameter("@docId", SqlDbType.VarChar, 50),
                new SqlParameter("@docName", SqlDbType.VarChar, 255),
                new SqlParameter("@docPath", SqlDbType.VarChar, 255),
                new SqlParameter("@userId", SqlDbType.VarChar, 50),
                new SqlParameter("@docIsLast", SqlDbType.Int),
                new SqlParameter("@docUploadTime", SqlDbType.DateTime),
                new SqlParameter("@docState", SqlDbType.Int),
            };
            sp[0].Value = docInfo.DocId;
            sp[1].Value = docInfo.DocName;
            sp[2].Value = docInfo.DocPath;
            sp[3].Value = docInfo.UserId;
            sp[4].Value = docInfo.DocIsLast;
            sp[5].Value = docInfo.DocUploadTime;
            sp[6].Value = docInfo.DocState;

            //连接数据库存储数据
            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
            {
                try
                {
                    SqlConnection conn = new SqlConnection(source);
                    conn.Open();

                    //保存附件之前,将所有该用户的文档的docIsLast设置为0
                    string     cmdStr    = "update t_docinfo set docIsLast = 0 where userId = '" + docInfo.UserId + "'";
                    SqlCommand cmdUpdate = new SqlCommand(cmdStr, conn);
                    cmdUpdate.ExecuteNonQuery();

                    //保存该文档信息到数据库
                    SqlCommand cmd = new SqlCommand(procName, conn);
                    cmd.CommandType = CommandType.StoredProcedure;
                    if (sp != null)
                    {
                        if (sp.Length > 0)
                        {
                            cmd.Parameters.AddRange(sp);
                        }
                    }
                    scope.Complete();
                    return(cmd.ExecuteNonQuery());
                }
                catch (SqlException)
                {
                    throw;
                }
            }
        }
Пример #20
0
        public void LoadDocumentInfo(int DocID)
        {
            docLogic = new DocumentModel();

            List <DocumentModel> documentDetails = new List <DocumentModel>();

            documentDetails.Add(docLogic.GetDocumentById(DocID));

            DocInfo.DataSource = documentDetails;
            DocInfo.DataBind();
        }
Пример #21
0
        /// <summary>
        /// 保存文档的信息
        /// </summary>
        /// <param name="file"></param>
        public bool Add(DocInfo file)
        {
            string sql = "INSERT INTO `web`.`文档库`(`机组编号`, `文档名`, `上传时间`, `备注`, `类型`) VALUES ('" +
                         file.JZId + "', '" +
                         file.Name + "', '" +
                         file.UploadTime + "', '" +
                         file.Note + "', '" +
                         file.Type + "')";

            return(data.ExecSql(sql));
        }
Пример #22
0
        private DocInfo ReadDocInfo(XmlReader xmlReader)
        {
            var docInfo = new DocInfo();

            var index = 0;

            while (xmlReader.Read())
            {
                switch (xmlReader.NodeType)
                {
                case XmlNodeType.Element:
                    if (index == 0 && string.Compare(xmlReader.Name, NsPrefix + ":doc-info", StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        index++;
                        while (xmlReader.MoveToNextAttribute())
                        {
                            if (string.Compare(xmlReader.Name, "project-id", StringComparison.OrdinalIgnoreCase) == 0)
                            {
                                docInfo.ProjectId = xmlReader.Value;
                            }
                            else if (string.Compare(xmlReader.Name, "source", StringComparison.OrdinalIgnoreCase) == 0)
                            {
                                docInfo.Source = xmlReader.Value;
                            }
                            else if (string.Compare(xmlReader.Name, "source-language", StringComparison.OrdinalIgnoreCase) == 0)
                            {
                                docInfo.SourceLanguage = xmlReader.Value;
                            }
                            else if (string.Compare(xmlReader.Name, "target-language", StringComparison.OrdinalIgnoreCase) == 0)
                            {
                                docInfo.TargetLanguage = xmlReader.Value;
                            }
                            else if (string.Compare(xmlReader.Name, "created", StringComparison.OrdinalIgnoreCase) == 0)
                            {
                                var format  = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'";
                                var success = DateTime.TryParseExact(xmlReader.Value, format,
                                                                     CultureInfo.InvariantCulture, DateTimeStyles.None, out var dateValue);

                                docInfo.Created = success ? dateValue : DateTime.MinValue;
                            }
                        }
                    }
                    else if (string.Compare(xmlReader.Name, NsPrefix + ":cmt-defs", StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        var xmlReaderSub = xmlReader.ReadSubtree();
                        docInfo.Comments = ReadCommentDefinitions(xmlReaderSub);
                        xmlReaderSub.Close();
                    }
                    break;
                }
            }

            return(docInfo);
        }
Пример #23
0
        public void DeleteDirectory()
        {
            doc = SetupForSavingTests();

            string docpath = doc.SaveImage();

            DocInfo newdoc = new DocInfo(docpath);

            newdoc.DeleteSourceFile();

            Assert.IsFalse(File.Exists(docpath));
        }
Пример #24
0
        public void DocInfoFromXmlFileShouldHaveDeclaringTypeName()
        {
            Dictionary <string, List <DocInfo> > infos = DocInfo.FromXmlFile("./TestBuildProject.xml");

            infos.Keys.Each(s =>
            {
                OutLine(s, ConsoleColor.Cyan);

                infos[s].Each(info =>
                {
                    OutputInfo(info);
                });
            });
        }
Пример #25
0
        /// <summary>
        /// 根据Id获取文档信息
        /// </summary>
        /// <returns>文档信息</returns>
        public DocInfo GetDocInfoById(int id)
        {
            string    sql    = "SELECT * FROM `web`.`文档库` where `文档编号`=" + id;
            DataTable dTable = data.GetTable(sql);
            DocInfo   file   = new DocInfo();

            file.Id         = int.Parse(dTable.Rows[0]["文档编号"].ToString());
            file.JZId       = dTable.Rows[0]["机组编号"].ToString();
            file.UploadTime = dTable.Rows[0]["上传时间"].ToString();
            file.Note       = dTable.Rows[0]["备注"].ToString();
            file.Name       = dTable.Rows[0]["文档名"].ToString();
            file.Type       = dTable.Rows[0]["类型"].ToString();
            return(file);
        }
Пример #26
0
        /// <summary>
        /// 获得医生信息
        /// </summary>
        /// <returns></returns>
        public DocInfo GetDocInfo(string uidordocid, string pwd = "-1")
        {
            if (string.IsNullOrWhiteSpace(uidordocid))
            {
                return(null);
            }
            // DocInfo doc = TmoReomotingClient.InvokeServerMethodT<DocInfo>(funCode.CheckDocAuth, uidordocid, pwd);
            DocInfo doc = TCPClient.Instance.Login(uidordocid, pwd);

            if (doc == null)
            {
                return(null);
            }

            if (doc.err_Code == 0)
            {
                string childrenDpt = Instance.GetChildrenNodeFromTable("tmo_department", "dpt_id", "dpt_parent", doc.doc_department.ToString(), false);
                if (string.IsNullOrWhiteSpace(childrenDpt))
                {
                    doc.children_department = doc.doc_department.ToString();
                    childrenDpt            += "-1";
                }
                else
                {
                    doc.children_department = childrenDpt;
                    childrenDpt            += ",-1";
                }
                DataTable     dtDocId = Tmo_FakeEntityClient.Instance.GetData("tmo_docinfo", new[] { "doc_id" }, "doc_department in (" + childrenDpt + ")");
                List <string> list    = new List <string>();
                list.Add(doc.doc_id.ToString());
                if (TmoShare.DataTableIsNotEmpty(dtDocId))
                {
                    foreach (DataRow dr in dtDocId.Rows)
                    {
                        string val = dr.GetDataRowStringValue("doc_id");
                        if (string.IsNullOrWhiteSpace(val))
                        {
                            continue;
                        }
                        list.Add(val);
                    }
                }
                doc.children_docid = StringPlus.GetArrayStr(list, ",");
                //doc.children_department += "," + doc.doc_department;
                doc.doc_group_level = Instance.GetGroupLevel(doc.doc_group);
            }
            return(doc);
        }
Пример #27
0
        public void CreateDirectoryChainTest()
        {
            doc = SetupForSavingTests();

            string yearpath  = doc.YearPath();
            string monthpath = doc.MonthPath();
            string daypath   = doc.DayPath();


            string docpath = doc.CreatePath();


            Assert.IsTrue(Directory.Exists(yearpath));
            Assert.IsTrue(Directory.Exists(monthpath));
            Assert.IsTrue(Directory.Exists(daypath));
        }
Пример #28
0
 public bool Execute()
 {
     try
     {
         GetDocumentImages();
         GetDocumentTextData();
         DocInfo.SaveToHistory();
         return(true);
     }
     catch (Exception exc)
     {
         LogEntry = new LogEntry(exc);
         LogEntry.SaveLogEntryFile();
         return(false);
     }
 }
Пример #29
0
        private void InvokeDataReceived(int head, byte[] buffer, string strdata = null)
        {
            if (head == 200)    //用户登录
            {
                strdata = ParserString(buffer);

                _loginReurnDoc = TmoShare.GetValueFromJson <DocInfo>(strdata);
                _loginResetEvent.Set();
            }
            else
            {
                if (DataReceived != null)
                {
                    DataReceived(null, head, buffer, strdata);
                }
            }
        }
Пример #30
0
        public void GetMemberTypeTest()
        {
            string          name;
            ClassMemberType type = DocInfo.GetMemberType("M:This.Is.A.Method", out name);

            Expect.IsTrue(type == ClassMemberType.Method);
            Expect.AreEqual("This.Is.A.Method", name);
            type = DocInfo.GetMemberType("F:This.Is.A.Field", out name);
            Expect.IsTrue(type == ClassMemberType.Field);
            Expect.AreEqual("This.Is.A.Field", name);
            type = DocInfo.GetMemberType("T:This.Is.A.Type", out name);
            Expect.IsTrue(type == ClassMemberType.Type);
            Expect.AreEqual("This.Is.A.Type", name);
            type = DocInfo.GetMemberType("P:This.Is.A.Property", out name);
            Expect.IsTrue(type == ClassMemberType.Property);
            Expect.AreEqual("This.Is.A.Property", name);
        }
Пример #31
0
        protected override void OnAddClick(EventArgs e)
        {
            int[] selectedHandels = this.gridView1.GetSelectedRows();
            if (selectedHandels.Length < 1)
            {
                if (!MuitiChooseMode)
                {
                    DXMessageBox.ShowWarning("未选中任何健康师!");
                    return;
                }
            }
            else
            {
                docInfos = new DocInfo[selectedHandels.Length];
                for (int i = 0; i < selectedHandels.Length; i++)
                {
                    DataRowView rowv     = this.gridView1.GetRow(selectedHandels[i]) as DataRowView;
                    DataRow     row      = rowv.Row;
                    DocInfo     _docInfo = new DocInfo();
                    _docInfo.doc_id         = row.GetDataRowIntValue("doc_id");
                    _docInfo.doc_address    = row.GetDataRowStringValue("doc_address");
                    _docInfo.doc_department = row.GetDataRowIntValue("doc_department");
                    _docInfo.doc_email      = row.GetDataRowStringValue("doc_email");
                    _docInfo.doc_function   = row.GetDataRowStringValue("doc_function");
                    _docInfo.doc_gender     = row.GetDataRowIntValue("doc_gender");
                    _docInfo.doc_group      = row.GetDataRowIntValue("doc_group");
                    _docInfo.doc_loginid    = row.GetDataRowStringValue("doc_loginid");
                    _docInfo.doc_name       = row.GetDataRowStringValue("doc_name");
                    _docInfo.doc_phone      = row.GetDataRowStringValue("doc_phone");
                    _docInfo.doc_qq         = row.GetDataRowStringValue("doc_qq");
                    _docInfo.doc_state      = row.GetDataRowIntValue("doc_state");
                    _docInfo.input_time     = row.GetDataRowDateTimeValue("input_time");
                    if (i == 0)
                    {
                        docInfo = _docInfo;
                    }
                    docInfos[i] = _docInfo;
                }
            }

            if (this.ParentForm != null)
            {
                this.ParentForm.DialogResult = DialogResult.OK;
            }
        }
Пример #32
0
        /// <summary>
        /// Inserts DOC block into the list.
        /// </summary>
        public void AppendBlock(PHPDocBlock/*!*/phpDoc, int endPosition)
        {
            Debug.Assert(phpDoc != null);
            Debug.Assert(endPosition >= phpDoc.Span.End);
            Debug.Assert(_doclist == null || _doclist.Count == 0 || _doclist.Last().Extent.Start < phpDoc.Span.Start, "Blocks have to be appended in order.");

            var docinfo = new DocInfo()
            {
                PhpDoc = phpDoc,
                Extent = Span.FromBounds(phpDoc.Span.Start, endPosition)
            };

            var list = _doclist;
            if (list == null)
            {
                _doclist = list = new List<DocInfo>(4);
            }
            
            list.Add(docinfo);

            _span = Span.FromBounds(list[0].Extent.Start, list.Last().Extent.End);
        }
Пример #33
0
        public int RegisterAndLockDocument(uint grfRDTLockType, string pszMkDocument, IVsHierarchy pHier, uint itemid, IntPtr punkDocData, out uint pdwCookie) {
            uint cookie = 0;
            int res = _vs.Invoke(() => {
                cookie = _ids[pszMkDocument] = ++_curCookie;
                _table[cookie] = new DocInfo(
                    (_VSRDTFLAGS)grfRDTLockType,
                    pszMkDocument,
                    pHier,
                    itemid,
                    punkDocData,
                    cookie
                );

                if (punkDocData != IntPtr.Zero) {
                    Marshal.AddRef(punkDocData);
                }
                var persist = (IVsPersistDocData)Marshal.GetObjectForIUnknown(punkDocData);
                return persist.OnRegisterDocData(cookie, pHier, itemid);
            });

            pdwCookie = cookie;
            return res;
        }
Пример #34
0
        private void Open( string path )
        {
            _LOG.Trace( String.Format( "Open: opening {0}\n", path ));
             var tmpDI = new DocInfo( path );

             string sText;
             try { sText = File.ReadAllText( tmpDI.FullPath, Encoding.Default ); }
             catch (Exception xx) {
            ShowException( "Error opening file.", xx );
            return;
             }

             CipherStore CS = null;
             try { CS = EasyXml.Import<CipherStore>(sText); } catch {}

             if (null != CS) {
            var dlg = new EnterPasswordDlg();
            dlg.title = _AppName;
            DialogResult ret;
            while (DialogResult.OK == (ret = dlg.ShowDialog())) {
               try {
                  sText = CS.DecryptString(tmpDI.password = dlg.password);
                  break;
               }
               catch { MessageBox.Show( "Error decrypting document. (Bad password?)", _AppName, MessageBoxButtons.OK, MessageBoxIcon.Error ); }
            }
            if (DialogResult.Cancel == ret) {
               return;
            }
             }

             txtMain.Text = sText;
             _DI = tmpDI;
             UpdateFileState();
             AddToMruList(_DI.FullPath);
             AddToRecentDocs(_DI.FullPath);
        }
		int ICorDebugManagedCallback.LoadAssembly (CorDebugAppDomain pAppDomain, CorDebugAssembly pAssembly)
		{
			assemblies.Add (pAssembly);

			//CorMetadataImport mi = new CorMetadataImport(pAssembly);

			//Seems like this is always set on MicroFramework
			//pAssembly. JITCompilerFlags = CorDebugJITCompilerFlags.CORDEBUG_JIT_DISABLE_OPTIMIZATION;
			List<string> docPaths = new List<string> ();
			if (pAssembly.DebugData != null) {
				var md = pAssembly.MetaData;
				var reader = pAssembly.DebugData;
				if (!pAssembly.IsFrameworkAssembly) {
					foreach (var module in md.Assembly.Modules) {
						foreach (var t in module.Types) {
							foreach (var m in t.Methods) {
								var methodSymbols = new MethodSymbols (m.MetadataToken);
								//Ugly hack
								if(reader is Mono.Cecil.Mdb.MdbReader)
								{
									foreach(var variable in m.Body.Variables)
										methodSymbols.Variables.Add(variable);
								}
								reader.Read (methodSymbols);
								if (methodSymbols.Instructions.Count == 0)
									continue;
								DocInfo document;
								if (!documents.TryGetValue (methodSymbols.Instructions [0].SequencePoint.Document.Url, out document)) {
									document = new DocInfo (methodSymbols.Instructions [0].SequencePoint.Document.Url);
									document.Assembly = pAssembly;
									documents.Add (document.Url, document);
								}
								document.AddMethod (m, methodSymbols);
								if (!docPaths.Contains (document.Url))
									docPaths.Add (document.Url);
							}
						}
					}
				}
				pAssembly.SetJmcStatus (true);
			} else {
				// Flag modules without debug info as not JMC. In this way
				// the debugger won't try to step into them
				pAssembly.SetJmcStatus (false);
			}
			foreach (var docPath in docPaths)
				BindSourceFileBreakpoints (docPath);
			pAppDomain.Process.Continue ();
			return 0;
		}
Пример #36
0
        bool SaveAs()
        {
            string password;
             {  var dlg = new NewPasswordDlg();
            dlg.title = _AppName;
            if (dlg.ShowDialog() == DialogResult.OK) {
               password = dlg.password;
            }
            else return false;
             }

             DocInfo tmpDI;
             {  var dlg = saveFileDialog;
            dlg.Filter = (null == password) ? "Text files (*.txt)|*.txt|All files (*.*)|*.*"
                                            : "Safepad files (*.safepad)|*.safepad|All files (*.*)|*.*" ;
            var ret = dlg.ShowDialog();
            if (ret == DialogResult.OK) {
               tmpDI = new DocInfo( dlg.FileName );
            }
            else return false;
             }

             tmpDI.password = password;
             _DI = tmpDI;

             bool bRet = writeCurrDoc();

             UpdateFileState();
             AddToMruList(_DI.FullPath);
             AddToRecentDocs(_DI.FullPath);

             return bRet;
        }
Пример #37
0
        // --------------------------------------------------------------------------------
        //
        //  FFFFFF ii ll
        //  FF        ll
        //  FF        ll
        //  FF     ii ll  eeee
        //  FFFFF  ii ll ee  ee
        //  FF     ii ll eeeeee
        //  FF     ii ll ee
        //  FF     ii ll ee  ee
        //  FF     ii ll  eeee
        //
        // --------------------------------------------------------------------------------
        //
        // File Operations
        //
        // --------------------------------------------------------------------------------
        void New()
        {
            if (!SaveYourWork()) return;

             _DI = new DocInfo();
             txtMain.Clear();
             UpdateFileState();
        }
Пример #38
0
		void OnModuleLoad (object sender, CorModuleEventArgs e)
		{
			CorMetadataImport mi = new CorMetadataImport (e.Module);

			try {
				// Required to avoid the jit to get rid of variables too early
				e.Module.JITCompilerFlags = CorDebugJITCompilerFlags.CORDEBUG_JIT_DISABLE_OPTIMIZATION;
			}
			catch {
				// Some kind of modules don't allow JIT flags to be changed.
			}

			string file = e.Module.Assembly.Name;
			lock (documents) {
				ISymbolReader reader = null;
				if (file.IndexOfAny (System.IO.Path.InvalidPathChars) == -1 && System.IO.File.Exists (System.IO.Path.ChangeExtension (file, ".pdb"))) {
					try {
						reader = symbolBinder.GetReaderForFile (mi.RawCOMObject, file, ".");
						foreach (ISymbolDocument doc in reader.GetDocuments ()) {
							if (string.IsNullOrEmpty (doc.URL))
								continue;
							string docFile = System.IO.Path.GetFullPath (doc.URL);
							DocInfo di = new DocInfo ();
							di.Document = doc;
							di.Reader = reader;
							di.Module = e.Module;
							documents[docFile] = di;
							NotifySourceFileLoaded (docFile);
						}
					}
					catch (Exception ex) {
						OnDebuggerOutput (true, string.Format ("Debugger Error: {0}\n", ex.Message));
					}
					e.Module.SetJmcStatus (true, null);
				}
				else {
					// Flag modules without debug info as not JMC. In this way
					// the debugger won't try to step into them
					e.Module.SetJmcStatus (false, null);
				}

				ModuleInfo moi;

				if (modules.TryGetValue (e.Module.Name, out moi)) {
					moi.References++;
				}
				else {
					moi = new ModuleInfo ();
					moi.Module = e.Module;
					moi.Reader = reader;
					moi.Importer = mi;
					moi.References = 1;
					modules[e.Module.Name] = moi;
				}
			}
			e.Continue = true;
		}
 public unsafe static extern Int32 StartDoc(HDC hdc, ref DocInfo docInfo);