Exemplo n.º 1
0
        private static void Main(string[] args)
        {
            // ADD FACTORY
            var calcIO         = new ConsoleCalcIO();
            var inputParser    = new CalcInputParser(calcIO);
            var mathBuffer     = new MathBuffer(calcIO);
            var history        = new OperationsHistory();
            var expParser      = new ExpressionParser();
            var pathReader     = new PathReader();
            var storage        = new ProcessorStorageFilesWork(mathBuffer, calcIO, history, expParser, pathReader, inputParser);
            var firstOperation = new SaveNumberOperation();
            var operations     = new List <IOperation>
            {
                new AddOperation(),
                new SubstractOperation(),
                new DivideOperation(),
                new MultiplyOperation(),
                new JumpOperation(),
                new ExitOperation(),
                new LoadOperation(),
                new SaveOperation()
            };

            var processor = new OperationsProcessor(storage, operations, firstOperation);

            processor.OperationPreReadAction += () => history.Update(processor, storage);

            processor.Start();
        }
Exemplo n.º 2
0
    protected override async Task <IInputStream> GetContent(Uri uri)
    {
        var invalid = "Invalid Path";

        if (uri is null)
        {
            throw new Exception(invalid);
        }
        try
        {
            //Security!
            if (PathReader.IsMatch(uri.LocalPath))
            {
                var pathTail = PathReader.Replace(uri.LocalPath, "");
                pathTail = string.IsNullOrWhiteSpace(pathTail) ? "index.html" : pathTail;
                var f = await StorageFile.GetFileFromApplicationUriAsync(new Uri(Path.Combine(PathReaderLocal, pathTail)));

                return(await f.OpenAsync(FileAccessMode.Read));
            }
            if (uri.LocalPath.ToLowerInvariant() == PathEpub)
            {
                if (File is null)
                {
                    throw new Exception(invalid);
                }
                return(await File.OpenReadAsync());
            }
            throw new Exception(invalid);
        }
        catch (Exception) { throw; }
    }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //DatabaseConfig D = new DatabaseConfig();
        //D = Deserialize_Data();

        //Startup_Util.DB_Route = //"Data Source=" + Startup_Util.DcryptionPWD(D.Server) + ";Initial Catalog=" + Startup_Util.DcryptionPWD(D.D2) + ";User ID=" + Startup_Util.DcryptionPWD(D.UserID) + ";Password="******"Data Source=" + Startup_Util.DcryptionPWD(D.Server) + ";Initial Catalog=" + Startup_Util.DcryptionPWD(D.D3) + ";User ID=" + Startup_Util.DcryptionPWD(D.UserID) + ";Password="******"Data Source=" + D.DB + ";Persist Security Info=True;User ID=" + D.UserID + ";Password="******";Unicode=True;Pooling=false";



        //Session["FtpUserID"] = Startup_Util.DcryptionPWD(D.FTPUSERID);
        //Session["FTPPASSWORD"] = Startup_Util.DcryptionPWD(D.FTPPASSWORD);
        //Session["FWIP"] = Startup_Util.DcryptionPWD(D.FWIP);


        Session["FtpUserID"]   = "a";
        Session["FTPPASSWORD"] = "******";
        //Session["FWIP"] = Startup_Util.DcryptionPWD(D.FWIP);
    }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.btnCustomerCodeSearch.Attributes.Add("style", "visibility: hidden;");

        DataSet ds = new DataSet();

        if (!IsPostBack)
        {
            ds = LOV.SP_PRIFilePath();
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (Session["FTPUserID"] == "")
                {
                    PathReader     p1    = new PathReader();
                    DatabaseConfig dbObj = new DatabaseConfig();
                    dbObj = p1.Deserialize_Data();
                    DAL_EXP1.Utility.Startup_Util.DB_Route = "Data Source=" + dbObj.DB + ";Persist Security Info=True;User ID=" + dbObj.UserID + ";Password="******";Unicode=True;Pooling=false";
                    Session["FTPUserID"]   = dbObj.FTPUSERID.ToString();
                    Session["FTPPASSWORD"] = dbObj.FTPPASSWORD.ToString();
                    Session["FTPIP"]       = dbObj.FTPIP.ToString();
                }
                string   strpath = ds.Tables[0].Rows[0]["fileupload"].ToString();
                string   test    = FO.getFileList(strpath, Session["FTPUserID"].ToString(), Session["FTPPASSWORD"].ToString());
                string[] Array   = test.ToString().Split(',');
                foreach (String t in Array)
                {
                    TXT_Description.Items.Add(t);
                    TXT_Description.DataBind();
                }
            }
        }
    }
Exemplo n.º 5
0
        public static void ConnectClient(Socket clientSocket)
        {
            var clientCalcIO = new TCPCalcIO(clientSocket, _consoleCalcIO);

            _clientCalcIO.Add(clientCalcIO);

            var expParser      = new ExpressionParser();
            var pathReader     = new PathReader();
            var firstOperation = new SaveNumberOperation();
            var operations     = new List <IOperation>
            {
                new AddOperation(),
                new SubstractOperation(),
                new DivideOperation(),
                new MultiplyOperation(),
                new JumpOperation(),
                new ExitOperation(),
                new LoadOperation(),
                new SaveOperation()
            };
            var inputParser = new CalcInputParser(clientCalcIO);
            var mathBuffer  = new MathBuffer(clientCalcIO);
            var history     = new OperationsHistory();
            var storage     = new ProcessorStorageFilesWork(mathBuffer, clientCalcIO, history, expParser, pathReader, inputParser);
            var processor   = new OperationsProcessor(storage, operations, firstOperation);

            processor.OperationPreReadAction += () => history.Update(processor, storage);

            var thread = new Thread(new ThreadStart(processor.Start));

            _clientThreads.Add(thread);

            thread.Start();
        }
    void Start()
    {
        anim = GetComponent <Animator>();

        // Creates the controller
        controller = new AnimatorController();
        controller.AddParameter("Go to A2", AnimatorControllerParameterType.Trigger);
        controller.AddParameter("Go to A1", AnimatorControllerParameterType.Trigger);
        controller.AddLayer("nakedLayer");

        // Add StateMachines
        var rootStateMachine = controller.layers[0].stateMachine;

        //var stateMachineA = rootStateMachine.AddStateMachine("smA");

        anim.runtimeAnimatorController = controller;

        dbcon = ScriptableObject.CreateInstance("dbConnector") as dbConnector;
        dbcon.LoadStuff();

        pathReader = ScriptableObject.CreateInstance("PathReader") as PathReader;
        pathReader.Initialize();

        mocapLoader = ScriptableObject.CreateInstance("MocapLoader") as MocapLoader;
        mocapLoader.Initialize(rootStateMachine);
    }
Exemplo n.º 7
0
 private bool IsMatchCore(PathReader pathReader, ReadOnlySpan <Segment> patternSegments)
 {
     for (var i = 0; i < patternSegments.Length; i++)
     {
         var patternSegment = patternSegments[i];
         if (patternSegment is RecursiveMatchAllSegment)
         {
             var remainingPatternSegments = patternSegments[(i + 1)..];
        public override bool IsMatch(ref PathReader pathReader)
        {
            if (pathReader.CurrentSegmentLength > 0)
            {
                pathReader.ConsumeInSegment(pathReader.CurrentSegmentLength);
            }

            return(true);
        }
    public DBUniversalUploadProcess()
    {
        PathReader     p1 = new PathReader();
        DatabaseConfig D  = new DatabaseConfig();

        D = p1.Deserialize_Data();
        DAL_EXP1.Utility.Startup_Util.DB_Route = "Data Source=" + D.DB +
                                                 ";Persist Security Info=True;User ID=" + D.UserID + ";Password="******";";
        ConnectionString = DAL_EXP1.Utility.Startup_Util.DB_Route;
    }
Exemplo n.º 10
0
        public override bool IsMatch(ref PathReader pathReader)
        {
            if (pathReader.IsPathSeparator())
            {
                return(false);
            }

            pathReader.ConsumeInSegment(1);
            return(true);
        }
        public override bool IsMatch(ref PathReader pathReader)
        {
            if (!pathReader.IsEndOfPath)
            {
                pathReader.ConsumeToEnd();
                return(true);
            }

            return(false);
        }
Exemplo n.º 12
0
    public DatabaseConnection_Util()
    {
        PathReader     p1 = new PathReader();
        DatabaseConfig D  = new DatabaseConfig();

        D = p1.Deserialize_Data();
        DAL_EXP1.Utility.Startup_Util.DB_Route = "Data Source=" + D.DB + ";Persist Security Info=True;User ID=" + D.UserID + ";Password="******";Unicode=True;Pooling=false";
        ConnectionString = DAL_EXP1.Utility.Startup_Util.DB_Route;
        ConnectionMaker();
    }
Exemplo n.º 13
0
        public override bool IsMatch(ref PathReader pathReader)
        {
            var result = !_range.IsInRange(pathReader.CurrentText[0]);

            if (result)
            {
                pathReader.ConsumeInSegment(1);
            }

            return(result);
        }
Exemplo n.º 14
0
        private bool MatchCore(ref PathReader pathReader)
        {
            foreach (var subsegment in _subSegments)
            {
                var copy = pathReader;
                if (subsegment.IsMatch(ref copy))
                {
                    pathReader = copy;
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 15
0
    private bool ParseJSONDemo()
    {
        PathReader pr;

        try
        {
            pr = new PathReader(Path.Combine(Application.dataPath, JSONFileName));
        }
        catch (Exception e) {
            Debug.Log(e.Message);
            return(false);
        }
        pr.setPathId(2);
        pr.printBookWithLocation(pr.getBookWithLocation(2));
        return(true);
    }
Exemplo n.º 16
0
        public override bool IsMatch(ref PathReader pathReader)
        {
            var index = pathReader.CurrentText.IndexOfAny(_characters);

            if (index == -1)
            {
                return(false);
            }

            if (index > 0)
            {
                pathReader.ConsumeInSegment(index);
            }

            return(true);
        }
Exemplo n.º 17
0
        public override bool IsMatch(ref PathReader pathReader)
        {
            var copy   = pathReader;
            var result = MatchCore(ref copy);

            if (_inverse)
            {
                result = !result;
                if (result)
                {
                    return(true);
                }
            }

            pathReader = copy;
            return(result);
        }
Exemplo n.º 18
0
    public OleDbConnection GetConnection1()
    {
        //PathReader p1 = new PathReader();
        //DatabaseConfig D = new DatabaseConfig();
        //D = p1.Deserialize_Data();
        //DAL_EXP1.Utility.Startup_Util.DB_Route = "Data Source=" + D.DB + ";Persist Security Info=True;User ID=" + D.UserID + ";Password="******";Unicode=True;Pooling=false";
        //strCon_Global1 = DAL_EXP1.Utility.Startup_Util.DB_Route;

        PathReader     p1 = new PathReader();
        DatabaseConfig D  = new DatabaseConfig();

        D = p1.Deserialize_Data();
        DAL_EXP1.Utility.Startup_Util.DB_Route = "Data Source=" + D.DB + ";Persist Security Info=True;User ID=" + D.UserID + ";Password="******";Unicode=True;Pooling=false";
        //      strCon_Global1 = DAL_EXP1.Utility.Startup_Util.DB_Route;
        // strCon_Global1 = "Provider=MSDAORA.1;Password=mcbcs ;User ID=mcbcs;Data Source=orcl";
        strCon_Global1 = "Provider=MSDAORA.1;Password="******";User ID=" + D.UserID + ";Data Source=" + D.DB;
        return(new OleDbConnection(strCon_Global1));
    }
        public override bool IsMatch(ref PathReader pathReader)
        {
            var c = pathReader.CurrentText[0];

            if (CharacterRangeSegment.IsAsciiUpper(c))
            {
                c = char.ToLowerInvariant(c);
            }

            var result = _range.IsInRange(c);

            if (result)
            {
                pathReader.ConsumeInSegment(1);
            }

            return(result);
        }
Exemplo n.º 20
0
    public MCBReportClass()
    {
        ////PathReader p1 = new PathReader();
        ////DatabaseConfig D = new DatabaseConfig();
        ////D = p1.Deserialize_Data();
        ////DAL_EXP1.Utility.Startup_Util.DB_Route = "Data Source=" + D.DB + ";Persist Security Info=True;User ID=" + D.UserID + ";Password="******";Unicode=True;Pooling=false";
        //////strCon_Global1 = DAL_EXP1.Utility.Startup_Util.DB_Route;
        //////strCon_Global1 = "Provider=MSDAORA.1;Password=mcbcs ;User ID=mcbcs_test;Data Source=nt";
        ////strCon_Global1 = ConfigurationManager.AppSettings["ConnectionString1"].ToString();
        PathReader     p1 = new PathReader();
        DatabaseConfig D  = new DatabaseConfig();

        D = p1.Deserialize_Data();
        DAL_EXP1.Utility.Startup_Util.DB_Route = "Data Source=" + D.DB + ";Persist Security Info=True;User ID=" + D.UserID + ";Password="******";Unicode=True;Pooling=false";
        /// strCon_Global1 = DAL_EXP1.Utility.Startup_Util.DB_Route;
        strCon_Global1   = "Provider=MSDAORA.1;Password="******";User ID=" + D.UserID + ";Data Source=" + D.DB;
        strCon_GlobalOra = "Password="******";User ID=" + D.UserID + ";Data Source=" + D.DB;
        //Data Source=orcl;Persist Security Info=True;User ID=mcbcs;Password=mcbcs;Unicode=True;Pooling=false
    }
Exemplo n.º 21
0
        static void GetDimensionsPath(XPathNavigator node, double x, double y, ref double xMin, ref double yMin, ref double xMax, ref double yMax)
        {
            var  reader = new PathReader(node.GetAttribute("d", string.Empty));
            bool lastCommandRelative = false;

            while (reader.ReadNext())
            {
                if (reader.Command != '\0')
                {
                    lastCommandRelative = char.IsLower(reader.Command);
                }
                else
                {
                    if (lastCommandRelative)
                    {
                        x += reader.X;
                        y += reader.Y;
                    }
                    else
                    {
                        x = reader.X;
                        y = reader.Y;
                    }

                    if (xMin > x)
                    {
                        xMin = x;
                    }
                    if (yMin > y)
                    {
                        yMin = y;
                    }
                    if (xMax < x)
                    {
                        xMax = x;
                    }
                    if (yMax < y)
                    {
                        yMax = y;
                    }
                }
            }
        }
Exemplo n.º 22
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            lbl_Message.Text = "";
            if ((Session["FTPUserID"].ToString() == "") || (Session["FTPPASSWORD"].ToString() == ""))
            {
                PathReader     p1    = new PathReader();
                DatabaseConfig dbObj = new DatabaseConfig();
                dbObj = p1.Deserialize_Data();
                DAL_EXP1.Utility.Startup_Util.DB_Route = "Data Source=" + dbObj.DB + ";Persist Security Info=True;User ID=" + dbObj.UserID + ";Password="******";Unicode=True;Pooling=false";
                Session["FTPUserID"]   = dbObj.FTPUSERID.ToString();
                Session["FTPPASSWORD"] = dbObj.FTPPASSWORD.ToString();
                Session["FTPIP"]       = dbObj.FTPIP.ToString();
            }

            ftpFileList();
        }
    }
Exemplo n.º 23
0
    // Use this for initialization
    void Start()
    {
        pr = new PathReader(Path.Combine(Application.streamingAssetsPath, "pick-paths.json"));
        pr.setPathId(pathId);
        book     = GameObject.Find("Book Info Display");
        shelf    = GameObject.Find("Shelf");
        bookText = GameObject.Find("Book Text");
        book.SetActive(isBookInfoActive);
        shelf.SetActive(isShelfViewActive);
        shelf.GetComponent <ChangeShelfBlock>().init();

        //create row
        row = new Dictionary <string, int>();
        row.Add("A", 0);
        row.Add("B", 1);
        row.Add("C", 2);
        row.Add("D", 3);
        row.Add("E", 4);
        row.Add("F", 5);
    }
Exemplo n.º 24
0
        List <Rect> SplitGeometryIntoRectangles(CanvasGeometry geometry, float rectangleHeight, CanvasControl sender)
        {
            List <Rect> result = new List <Rect>();

            var    geometryBounds = geometry.ComputeBounds();
            double left           = geometryBounds.X;
            double top            = geometryBounds.Y;
            double y = top;

            while (y < geometryBounds.Bottom)
            {
                var lineRegion         = new Rect(left, y, geometryBounds.Width, rectangleHeight);
                var lineRegionGeometry = CanvasGeometry.CreateRectangle(sender, lineRegion);
                var compareResult      = geometry.CompareWith(lineRegionGeometry);

                if (compareResult == CanvasGeometryRelation.Contains)
                {
                    // The whole line fits.
                    result.Add(lineRegion);
                }
                else if (compareResult == CanvasGeometryRelation.Disjoint)
                {
                    // The line doesn't fit, so skip it.
                }
                else if (compareResult == CanvasGeometryRelation.Overlap)
                {
                    var intersection = geometry.CombineWith(lineRegionGeometry, Matrix3x2.Identity, CanvasGeometryCombine.Intersect);

                    PathReader pathReader = new PathReader(lineRegion);
                    intersection.Simplify(CanvasGeometrySimplification.Lines).SendPathTo(pathReader);

                    var rectangles = pathReader.GetRectangles();
                    rectangles.Sort(new RectangleComparer(CurrentTextDirection == TextDirection.RightToLeft));
                    result.AddRange(rectangles);
                }

                y += rectangleHeight;
            }

            return(result);
        }
Exemplo n.º 25
0
        void TransformPathNode(XPathNavigator node, double dx, double dy)
        {
            var  reader = new PathReader(node.GetAttribute("d", string.Empty));
            bool lastCommandRelative = false;
            bool lastWasCommand      = true;
            var  sb = new StringBuilder();

            while (reader.ReadNext())
            {
                if (reader.Command != '\0')
                {
                    lastCommandRelative = char.IsLower(reader.Command);
                    sb.Append(reader.Command);
                    lastWasCommand = true;
                }
                else
                {
                    if (!lastWasCommand)
                    {
                        sb.Append(' ');
                    }

                    if (lastCommandRelative)
                    {
                        sb.Append(reader.X);
                        sb.Append(' ');
                        sb.Append(reader.Y);
                    }
                    else
                    {
                        sb.Append(reader.X + dx);
                        sb.Append(' ');
                        sb.Append(reader.Y + dy);
                    }
                    lastWasCommand = false;
                }
            }
            SetAttr(node, "d", sb.ToString());
        }
    // Use this for initialization
    void Start()
    {
        // data model init
        pr = new PathReader(Path.Combine(Application.streamingAssetsPath, "pick-paths.json"));
        pr.setPathId(selectedPathId);
        numOfPickedBook   = 0;
        userSelectionView = GameObject.Find("User Selection View");
        userSelectionView.SetActive(true);
        phaseSelectionView = GameObject.Find("Phase Selection View");
        phaseSelectionView.SetActive(false);
        pathIdSelectionView = GameObject.Find("PathId Selection View");
        pathIdSelectionView.SetActive(false);
        bookInfoView = GameObject.Find("Book Info View");
        bookInfoView.SetActive(false);
        shelfView = GameObject.Find("Shelf View");
        shelfView.GetComponent <ShelfView>().init();
        shelfView.SetActive(false);

        completionView = GameObject.Find("Completion View");
        completionView.SetActive(false);
        currentActiveView = userSelectionView;
    }
Exemplo n.º 27
0
 public void SetPath()
 {
     Path = PathReader.SelectPath();
 }
Exemplo n.º 28
0
        public bool IsMatch(ReadOnlySpan <char> path)
        {
            var pathEnumerator = new PathReader(path, ReadOnlySpan <char> .Empty);

            return(IsMatchCore(pathEnumerator, _segments));
        }
Exemplo n.º 29
0
        internal bool IsMatchCore(ReadOnlySpan <char> directory, ReadOnlySpan <char> filename)
        {
            var pathEnumerator = new PathReader(directory, filename);

            return(IsMatchCore(pathEnumerator, _segments));
        }
Exemplo n.º 30
0
        public string Render()
        {
            string htmlContent = PathReader.Read(Constants.SignInPath);

            return(htmlContent);
        }
        protected PathReader CreatePathReader(Type type, string propertyPath)
        {
            List<IPropertyWrapper> wrappers = new List<IPropertyWrapper>();
            IClassWrapper cw = ClassWrappers.GetForType(type);
            bool canReadPath = true;

            foreach (Match match in propertyRegex.Matches(propertyPath))
            {
                IPropertyWrapper pw = null;
                string property;
                object[] parameters;
                this.GetWrapperData(match, out property, out parameters);
                if (parameters == null)
                    pw = cw.GetProperty(property);
                else
                {
                    ISimplePropertyWrapper sw = (ISimplePropertyWrapper)cw.GetProperty(property);
                    if (sw == null || !sw.IsIndexed)
                        pw = null;
                    else
                        pw = new StaticIndexPropertyWrapper(sw, parameters);
                }

                if (pw == null || !pw.CanWorkWithType(cw.ClassType))
                {
                    canReadPath = false;
                    break;
                }

                wrappers.Add(pw);
                cw = ClassWrappers.GetForType(((ISimplePropertyWrapper)pw).PropertyType);
            }

            PathReader reader = new PathReader(type, wrappers, canReadPath);
            this.pathReaders.Add(reader);
            return reader;
        }