예제 #1
0
        protected void ProcessResults(Collection <PSObject> Results, string WorkingDirectory)
        {
            Dictionary <string, string> FileToType = new Dictionary <string, string>();

            foreach (PSObject Result in Results)
            {
                string type = Result.ToString().Substring(0, 1);
                string resultWithoutType = Result.ToString().Remove(0, 1).Trim();
                string fullPath          = WorkingDirectory + resultWithoutType;
                fullPath = fullPath.Replace('/', '\\');
                SplitString path = Spliter.Split(fullPath, ".");
                if (Artifact.TARGET_DIRECTORIES_BY_EXTENSION.ContainsKey(path.Right))
                {
                    FileToType.Add(resultWithoutType, type);
                }
                else
                {
                    Console.WriteLine("File not added for deployment: " + Result.ToString());
                }
            }

            Artifact ProposedArtifact = new Artifact(WorkingDirectory, FileToType);

            ProposedArtifact.Display();
        }
예제 #2
0
파일: SpliterTest.cs 프로젝트: BERef/BERef
        public void TestSpliter()
        {
            var htmlDoc = new HtmlDocument();
            // Read Test File
            htmlDoc.Load(@"TestData/SearchResultPage.data");

            var spliter = new Spliter();
            var result = spliter.Split(htmlDoc);
            int count = 0;
            foreach (var node in result)
                count++;

            Assert.AreEqual(10, count);
        }
예제 #3
0
        public void Display()
        {
            Dictionary <string, List <string> > DestructiveChanges = new Dictionary <string, List <string> >();

            foreach (string File in FileToChangeType.Keys)
            {
                string      fullPath = WorkingDirectory + File;
                SplitString path     = Spliter.Split(fullPath, ".");

                string      splitLocation = placeToSplit[path.Right];
                SplitString copyPath      = Spliter.Split(fullPath, splitLocation);

                string targetDirectoryForFile = WorkingDirectory +
                                                TARGET_DIRECTORIES_BY_EXTENSION[path.Right] + copyPath.Right;

                string metaFileSource             = fullPath + "-meta.xml";
                string metaFileName               = copyPath.Right + "-meta.xml";
                string targetDirectoryForMetaFile = WorkingDirectory +
                                                    TARGET_DIRECTORIES_BY_EXTENSION[path.Right] + metaFileName;

                string changeType = FileToChangeType[File];
                if (changeType.Equals("D"))
                {
                    SplitString extensionSplit = Spliter.Split(copyPath.Right, ".");
                    if (!DestructiveChanges.ContainsKey(extensionSplit.Right))
                    {
                        DestructiveChanges.Add(extensionSplit.Right, new List <string>());
                    }
                    DestructiveChanges[extensionSplit.Right].Add(extensionSplit.Left);
                }

                Console.WriteLine("Adding " + copyPath.Right + " to deployment");
                try
                {
                    System.IO.File.Copy(fullPath, targetDirectoryForFile);
                    System.IO.File.Copy(metaFileSource, targetDirectoryForMetaFile);
                }
                catch (FileNotFoundException ex)
                {
                    Console.WriteLine("Possible destructive change detected!");
                    Console.WriteLine(ex.FileName + " not added to artifact.");
                }
            }
            if (DestructiveChanges.Count != 0)
            {
                CreateDestructiveChangesXML(DestructiveChanges);
            }
            CopyPackageXML();
        }
예제 #4
0
        public void TestBuilder()
        {
            var htmlDoc = new HtmlDocument();
            htmlDoc.Load(@"TestData/SearchResultPage.data");
            var spliter = new Spliter();
            var iter = spliter.Split(htmlDoc).GetEnumerator();
            iter.MoveNext();
            var node = iter.Current;

            var builder = new BriefBuilder();
            var brief = builder.Build(node);

            Assert.AreEqual("Understanding big data: Analytics for enterprise class hadoop and streaming data", brief.Title);
            Assert.AreEqual("http://dl.acm.org/citation.cfm?id=2132803", brief.Source);
            Assert.AreEqual("Abstract Big Data represents a new era in data exploration and utilization, and IBM is uniquely positioned to help clients navigate this transformation. This book reveals how IBM is leveraging open source Big Data technology, infused with IBM technologies, to deliver a  ...", brief.Abstract);
            Assert.AreEqual("P Zikopoulos, C Eaton - 2011 - dl.acm.org", brief.Profile);
        }
예제 #5
0
파일: SpliterTest.cs 프로젝트: BERef/BERef
        public void TestSpliter()
        {
            var htmlDoc = new HtmlDocument();

            // Read Test File
            htmlDoc.Load(@"TestData/SearchResultPage.data");

            var spliter = new Spliter();
            var result  = spliter.Split(htmlDoc);
            int count   = 0;

            foreach (var node in result)
            {
                count++;
            }

            Assert.AreEqual(10, count);
        }
예제 #6
0
 /// <summary>
 /// 实例化接收串口,注册接收事件
 /// </summary>
 /// <param name="portName">串口名</param>
 /// <param name="baudRate">串口波特率</param>
 /// <param name="receivedDataAction">当串口接收到数据时bool 为True,object为byte[],当返回错误信息时,bool为false,object为string</param>
 /// <param name="receivedMessageData">当内容被识别为报文时,进行此方法</param>
 public Receiver(string portName, int baudRate, Action <bool, bool, object> receivedDataAction, Action <object> receivedMessageData)
 {
     Ports.InitialEnt(portName, baudRate, (isConnected, status, data) =>
     {
         if (isConnected && status)
         {
             receivedDataAction(true, true, (byte[])data);//接收实际数据回传
             Spliter.Split((byte[])data, StaticMessageTypeInRuntime.LegalMessageType.MessageTypesDictionaryWithHead, (msgData) =>
             {
                 receivedMessageData((MessageData)msgData);//接收数据中识别报文回传
             });
         }
         else
         {
             receivedDataAction(isConnected, status, (string)data);//返回状态信息
         }
     });
 }
예제 #7
0
        public void TestBuilder()
        {
            var htmlDoc = new HtmlDocument();

            htmlDoc.Load(@"TestData/SearchResultPage.data");
            var spliter = new Spliter();
            var iter    = spliter.Split(htmlDoc).GetEnumerator();

            iter.MoveNext();
            var node = iter.Current;

            var builder = new BriefBuilder();
            var brief   = builder.Build(node);

            Assert.AreEqual("Understanding big data: Analytics for enterprise class hadoop and streaming data", brief.Title);
            Assert.AreEqual("http://dl.acm.org/citation.cfm?id=2132803", brief.Source);
            Assert.AreEqual("Abstract Big Data represents a new era in data exploration and utilization, and IBM is uniquely positioned to help clients navigate this transformation. This book reveals how IBM is leveraging open source Big Data technology, infused with IBM technologies, to deliver a  ...", brief.Abstract);
            Assert.AreEqual("P Zikopoulos, C Eaton - 2011 - dl.acm.org", brief.Profile);
        }