コード例 #1
0
ファイル: Program.cs プロジェクト: SapiPapik/ImageTestProject
        static void Main(string[] args)
        {
            var repository = new FileRepository();
            var path       = "C:/Users/Sapik/Desktop/New folder";

            var test = new ImageModifierService(repository);

            var r1 = new Row();
            var c1 = new Column();
            var r2 = new Row();
            var c2 = new Column();
            var r3 = new Row();

            r1.Add(repository.LoadFile(path + "/" + "1.jpg"))
            .Add(c1)
            .Add(repository.LoadFile(path + "/" + "2.jpg"));

            c1.Add(r2)
            .Add(repository.LoadFile(path + "/" + "3.jpg"));

            r2.Add(repository.LoadFile(path + "/" + "4.jpg"))
            .Add(c2);

            c2.Add(r3)
            .Add(repository.LoadFile(path + "/" + "5.jpg"));

            r3.Add(repository.LoadFile(path + "/" + "6.jpg")).Add(repository.LoadFile(path + "/" + "7.jpg"));

            test.Test <Row, Column>(r1, 1000);

            //c1.Add(repository.LoadFile(path + "/" + "1.jpg")).Add(repository.LoadFile(path + "/" + "2.jpg"))
            //    .Add(repository.LoadFile(path + "/" + "3.jpg")).Add(repository.LoadFile(path + "/" + "4.jpg"));
            //test.Test<Column, Row>(c1, 10);
        }
コード例 #2
0
        private Row Generate()
        {
            var row0 = new Row();
            var col1 = new Column();
            var row1 = new Row();
            var col2 = new Column();
            var row2 = new Row();
            var col3 = new Column();
            var row3 = new Row();

            AddImages(row0, 1);
            AddImages(col1, 2);
            AddImages(row1, 1);
            AddImages(col2, 3);
            AddImages(row2, 2);
            AddImages(col3, 2);
            AddImages(row3, 2);

            row0.Add(col1);
            col1.Add(row1);
            row1.Add(col2);
            col2.Add(row2);

            AddImages(row0, 1);

            return(row0);
        }
コード例 #3
0
        public static void Test()
        {
            Page      page = new Page();
            Character c1   = new Character(1, 1);
            Image     img1 = new Image(2, 2);
            Column    col  = new Column();
            Character c2   = new Character(1, 3);
            Image     img2 = new Image(2, 3);

            col.Add(c2);
            col.Add(img2);
            page.Add(c1);
            page.Add(img1);
            page.Add(col);
            page.Draw();
        }
コード例 #4
0
        private void okButton_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(NewTableName) || string.IsNullOrWhiteSpace(NewColumnName) || projectionDims.SelectedItems.Count == 0)
            {
                return;
            }

            CsSchema schema = SourceTable.Top;

            // Initialize a list of selected dimensions (from the whole list of all greater dimensions
            List <CsColumn> projDims = new List <CsColumn>();

            foreach (var item in projectionDims.SelectedItems)
            {
                projDims.Add((CsColumn)item);
            }

            // Remove all existing greater dims (clean the target table before defining new structure)
            foreach (CsColumn dim in TargetTable.GreaterDims.ToList())
            {
                if (dim.IsSuper)
                {
                    continue;
                }
                dim.Remove();
            }

            // 1. Create a mapping object from the selected projection dimensions
            // 2. Create identity dimensions for the extracted set and their mapping to the projection dimensions
            Mapping mapping = new Mapping(SourceTable, TargetTable);

            foreach (CsColumn projDim in projDims)
            {
                CsTable  idSet = projDim.GreaterSet;
                CsColumn idDim = schema.CreateColumn(projDim.Name, TargetTable, idSet, true);
                idDim.Add();

                mapping.AddMatch(new PathMatch(new DimPath(projDim), new DimPath(idDim)));
            }
            Column.Definition.DefinitionType = ColumnDefinitionType.LINK;
            Column.Definition.Mapping        = mapping;
            Column.Definition.IsGenerating   = true;
            Column.Name = NewColumnName;

            TargetTable.Definition.DefinitionType = TableDefinitionType.PROJECTION;

            TargetTable.Name = NewTableName;

            // If new then add objects to the schema (or do it outside?)
            if (IsNew)
            {
                schema.AddTable(TargetTable, SourceTable.SuperSet, null);
                Column.Add();
            }

            this.DialogResult = true;
        }
コード例 #5
0
ファイル: CardDisplay.cs プロジェクト: Lithry/Solitary
 private void MoveToColumn(Column column)
 {
     RemoveFromContainer();
     column.Add(this, transform.childCount);
     if (transform.childCount > 0)
     {
         transform.GetChild(0).gameObject.GetComponent <CardDisplay>().MoveToColumn(column);
     }
 }
コード例 #6
0
ファイル: ColumnTests.cs プロジェクト: j-vallet/hbm-to-fnh
            public void Should_return_empty_given_MappedPropertyInfo_Type_is_Component()
            {
                MappedPropertyInfo mappedPropertyInfo = new MappedPropertyInfo(new HbmComponent(), null);

                _column.Add(mappedPropertyInfo);
                string result = _builder.ToString();

                result.ShouldBeEqualTo("");
            }
コード例 #7
0
        public Column CreateColumn()
        {
            var brickFactory = ContainerProvider.Resolve <IBrickFactory>();

            var newColumn = new Column();

            var settings = ContainerProvider.Resolve <ISettingsProvider>().GetSettingsInstance();

            for (var i = 0; i < settings.ColumnLength; i++)
            {
                newColumn.Add(brickFactory.CreateBrick());
            }

            return(newColumn);
        }
コード例 #8
0
        public void TestHoldNoteHeadVisibility()
        {
            DrawableHoldNote note = null;

            AddStep("Add hold note", () =>
            {
                var h = new HoldNote
                {
                    StartTime = 0,
                    Duration  = 1000
                };
                h.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
                column.Add(note = new DrawableHoldNote(h));
            });
            AddStep("Hold key", () =>
            {
                clock.CurrentTime = 0;
                note.OnPressed(new KeyBindingPressEvent <ManiaAction>(GetContainingInputManager().CurrentState, ManiaAction.Key1));
            });
            AddStep("progress time", () => clock.CurrentTime = 500);
            AddAssert("head is visible", () => note.Head.Alpha == 1);
        }
コード例 #9
0
 protected override void AddHitObject(DrawableHitObject hitObject) => column.Add((DrawableManiaHitObject)hitObject);
コード例 #10
0
ファイル: ReadFile.cs プロジェクト: hungpro2341999/BrickDom
    public List <int[, ]> SplitColumnMatrix(int[,] matrixs, int[] column, ref List <int> point)
    {
        List <int> ListPointRow    = new List <int>();
        List <int> ListPointColumn = new List <int>();

        ListPointRow.Add(0);
        ListPointColumn.Add(0);


        List <int>         ListPoint  = new List <int>();
        List <List <int> > ListColumn = CutColumn(matrixs);

        List <int[, ]> ListMatrix = new List <int[, ]>();

        List <int> Flag = SetUpFlag(matrixs.GetLength(1), column);

        Debug.Log(CtrlGamePlay.RenderList(Flag));

        List <int[, ]> matrix = new List <int[, ]>();

        List <List <int> > Column = new List <List <int> >();

        ListPoint.Add(0);
        for (int i = 0; i < Flag.Count; i++)
        {
            if (Flag[i] == -1)
            {
                if (Column.Count != 0)
                {
                    ListMatrix.Add(ListColumToMatrix(Column));
                    Column = new List <List <int> >();
                }

                {
                    Column.Add(ListColumn[i]);

                    ListMatrix.Add(ListColumToMatrix(Column));

                    Column = new List <List <int> >();
                }



                if (!ListPoint.Contains(i))
                {
                    ListPoint.Add(i);
                    if (i + 1 < Flag.Count)
                    {
                        if (!ListPoint.Contains(i + 1))
                        {
                            ListPoint.Add(i + 1);
                        }
                    }
                }
                else
                {
                    if (!ListPoint.Contains(i + 1))
                    {
                        if (i + 1 < Flag.Count)
                        {
                            ListPoint.Add(i + 1);
                        }
                    }
                }

                if (Column.Count != 0)
                {
                    ListMatrix.Add(ListColumToMatrix(Column));
                    Column = new List <List <int> >();
                }
            }
            else
            {
                Column.Add(ListColumn[i]);
            }
        }

        if (Column.Count != 0)
        {
            ListMatrix.Add(ListColumToMatrix(Column));
        }
        Debug.Log(ListMatrix.Count);
        for (int i = 0; i < ListMatrix.Count; i++)
        {
            Debug.Log(CtrlGamePlay.Render(ListMatrix[i]));
        }
        point = ListPoint;

        return(ListMatrix);
    }
コード例 #11
0
ファイル: ImportService.cs プロジェクト: dezol/QuickStarters
        /// <summary>
        /// Imports a level file. You can read the Level file format description on this file header
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns></returns>
        /// <exception cref="System.Exception">Exception Loading level file:  + path</exception>
        public LevelModel ImportLevel(string path)
        {
            string line = string.Empty;
            BlockTypeEnum blockType = BlockTypeEnum.EMPTY;

            LevelModel model = new LevelModel();

            try
            {
                // Read the level file
                using (Stream fs = WaveServices.Storage.OpenContentFile(path))
                //using (FileStream fs = File.Open(path, FileMode.Open, FileAccess.Read))
                using (BufferedStream bs = new BufferedStream(fs, 8388608)) // 8Mb buffer it's a good buffer for files.
                using (StreamReader sr = new StreamReader(bs))
                {
                    float blockScaleX = 1.0f;
                    float blockScaleY = 1.0f;
                    float blockScaleZ = 1.0f;

                    // FIRST LINE of the file: Block X scale
                    if (!sr.EndOfStream)
                    {
                        line = sr.ReadLine();
                        float.TryParse(line, NumberStyles.Number, CultureInfo.InvariantCulture, out blockScaleX);
                        ModelFactoryService.Instance.Scale.X= blockScaleX;
                    }

                    // SECOND LINE of the file: Block Y Scale
                    if (!sr.EndOfStream)
                    {
                        line = sr.ReadLine();
                        float.TryParse(line, NumberStyles.Number, CultureInfo.InvariantCulture, out blockScaleY);
                        ModelFactoryService.Instance.Scale.Y = blockScaleY;
                    }

                    // THIRD LINE of the file: Block Z Scale
                    if (!sr.EndOfStream)
                    {
                        line = sr.ReadLine();
                        float.TryParse(line, NumberStyles.Number, CultureInfo.InvariantCulture, out blockScaleZ);
                        ModelFactoryService.Instance.Scale.Z = blockScaleZ;
                    }

                    // The rest of the file is the level
                    while (!sr.EndOfStream)
                    {
                        line = sr.ReadLine();

                        if(!string.IsNullOrWhiteSpace(line)) // line must be filled with data
                        {
                            string[] splitted = line.Split(SEPARATOR); // split the line
                            if(splitted.Count() > 0)
                            {
                                Column column = new Column(); // creates the column
                                foreach(string value in splitted)
                                {
                                    blockType = BlockTypeEnum.EMPTY; // default value if reading error or out of block type error
                                    Enum.TryParse<BlockTypeEnum>(value, out blockType);
                                    column.Add(blockType);
                                }
                                model.ColumnCollection.Enqueue(column);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Exception Loading level file: " + path, ex);
            }

            return model;
        }
コード例 #12
0
    /// <summary>
    /// Creates rows, columns, and boxes in data to be used later.
    /// </summary>
    private void applySetRelationships()
    {
        #region Load Rows
        for (int index = 1; index <= 9; index++)
        {
            Row currentRow = new Row(index);
            currentRow.UnsolvedValues.AddRange(new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 });
            for (int node = 1; node <= 9; node++)
            {
                //
                //
                SNode sNode = Sudoku[node - 1, index - 1];
                currentRow.Add(sNode);
                sNode.Row = currentRow;

                if (sNode.Value != 0)
                {
                    currentRow.ValueSolved(sNode.Value);
                }
                //
                //
            }

            Rows.Add(currentRow);
        }
        #endregion

        #region Load Columns
        for (int index = 1; index <= 9; index++)
        {
            Column currentColumn = new Column(index);
            currentColumn.UnsolvedValues.AddRange(new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 });
            for (int node = 1; node <= 9; node++)
            {
                //
                //
                SNode sNode = Sudoku[index - 1, node - 1];
                currentColumn.Add(sNode);
                sNode.Column = currentColumn;

                if (sNode.Value != 0)
                {
                    currentColumn.ValueSolved(sNode.Value);
                }
                //
                //
            }

            Columns.Add(currentColumn);
        }
        #endregion

        #region Load Boxes
        int startRow    = 0;
        int startColumn = 0;

        for (int index = 1; index <= 9; index++)
        {
            Box currentBox = new Box(index);
            currentBox.UnsolvedValues.AddRange(new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 });
            for (int down = 0; down < 3; down++)
            {
                for (int right = 0; right < 3; right++)
                {
                    //
                    //
                    SNode sNode = Sudoku[startColumn + right, startRow + down];
                    currentBox.Add(sNode);
                    sNode.Box = currentBox;

                    if (sNode.Value != 0)
                    {
                        currentBox.ValueSolved(sNode.Value);
                    }
                    //
                    //
                }
            }

            Boxes.Add(currentBox);

            currentBox.AddColumn(currentBox[0].Column);
            currentBox.AddRow(currentBox[0].Row);
            currentBox.AddColumn(currentBox[4].Column);
            currentBox.AddRow(currentBox[4].Row);
            currentBox.AddColumn(currentBox[8].Column);
            currentBox.AddRow(currentBox[8].Row);

            // Sets up the starter indices for each box
            if (startColumn == 6)
            {
                startColumn = 0;
                startRow   += 3;
            }
            else
            {
                startColumn += 3;
            }
        }
        #endregion
    }
コード例 #13
0
        private void OkCommand_Executed(object state)
        {
            Mapping mapping;

            if (IsNew)
            {
                mapping = new Mapping(Column.Input, Column.Output);
            }
            else
            {
                mapping = Column.Definition.Mapping;
            }

            // For each entry decide what to do with the corresponding 1. match in the mapping 2. target column, depending on the comparision with the existing 1. match, target column
            foreach (var entry in SourceColumnEntries)
            {
                DcColumn sourceColumn = entry.Source;

                PathMatch match = mapping.GetMatchForSource(new DimPath(sourceColumn));

                DcColumn targetColumn;

                if (entry.IsMatched && match == null) // Newly added. Creation
                {
                    DcTable targetType       = entry.TargetType;
                    string  targetColumnName = sourceColumn.Name;
                    targetColumn = TargetSchema.CreateColumn(targetColumnName, Column.Output, targetType, entry.IsKey);
                    targetColumn.Add();

                    mapping.AddMatch(new PathMatch(new DimPath(sourceColumn), new DimPath(targetColumn)));
                }
                else if (!entry.IsMatched && match != null) // Newly removed. Deletion.
                {
                    targetColumn = match.TargetPath.FirstSegment;
                    targetColumn.Remove();

                    mapping.RemoveMatch(match.SourcePath, match.TargetPath);
                }
                else if (entry.IsMatched) // Remains included. Update properties (name, key, type etc.)
                {
                    targetColumn = match.TargetPath.FirstSegment;
                    if (targetColumn.Output != entry.TargetType) // Type has been changed
                    {
                        targetColumn.Remove();
                        targetColumn.Output = entry.TargetType;
                        targetColumn.Add();
                    }
                }
                else // Remains excluded
                {
                }
            }

            Column.Name        = NewColumnName;
            Column.Output.Name = NewTableName;

            if (IsNew)
            {
                Column.Definition.DefinitionType = DcColumnDefinitionType.LINK;
                Column.Definition.Mapping        = mapping;
                Column.Definition.IsAppendData   = true;
                Column.Add();

                Column.Output.Definition.DefinitionType = DcTableDefinitionType.PROJECTION;
                TargetSchema.AddTable(Column.Output, null, null);
            }

            this.DialogResult = true;
        }
コード例 #14
0
        /// <summary>
        /// Imports a level file. You can read the Level file format description on this file header
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns></returns>
        /// <exception cref="System.Exception">Exception Loading level file:  + path</exception>
        public LevelModel ImportLevel(string path)
        {
            string        line      = string.Empty;
            BlockTypeEnum blockType = BlockTypeEnum.EMPTY;

            LevelModel model = new LevelModel();

            try
            {
                // Read the level file
                using (Stream fs = WaveServices.Storage.OpenContentFile(path))
                    //using (FileStream fs = File.Open(path, FileMode.Open, FileAccess.Read))
                    using (BufferedStream bs = new BufferedStream(fs, 8388608)) // 8Mb buffer it's a good buffer for files.
                        using (StreamReader sr = new StreamReader(bs))
                        {
                            float blockScaleX = 1.0f;
                            float blockScaleY = 1.0f;
                            float blockScaleZ = 1.0f;

                            // FIRST LINE of the file: Block X scale
                            if (!sr.EndOfStream)
                            {
                                line = sr.ReadLine();
                                float.TryParse(line, NumberStyles.Number, CultureInfo.InvariantCulture, out blockScaleX);
                                ModelFactoryService.Instance.Scale.X = blockScaleX;
                            }

                            // SECOND LINE of the file: Block Y Scale
                            if (!sr.EndOfStream)
                            {
                                line = sr.ReadLine();
                                float.TryParse(line, NumberStyles.Number, CultureInfo.InvariantCulture, out blockScaleY);
                                ModelFactoryService.Instance.Scale.Y = blockScaleY;
                            }

                            // THIRD LINE of the file: Block Z Scale
                            if (!sr.EndOfStream)
                            {
                                line = sr.ReadLine();
                                float.TryParse(line, NumberStyles.Number, CultureInfo.InvariantCulture, out blockScaleZ);
                                ModelFactoryService.Instance.Scale.Z = blockScaleZ;
                            }

                            // The rest of the file is the level
                            while (!sr.EndOfStream)
                            {
                                line = sr.ReadLine();

                                if (!string.IsNullOrWhiteSpace(line))          // line must be filled with data
                                {
                                    string[] splitted = line.Split(SEPARATOR); // split the line
                                    if (splitted.Count() > 0)
                                    {
                                        Column column = new Column(); // creates the column
                                        foreach (string value in splitted)
                                        {
                                            blockType = BlockTypeEnum.EMPTY; // default value if reading error or out of block type error
                                            Enum.TryParse <BlockTypeEnum>(value, out blockType);
                                            column.Add(blockType);
                                        }
                                        model.ColumnCollection.Enqueue(column);
                                    }
                                }
                            }
                        }
            }
            catch (Exception ex)
            {
                throw new Exception("Exception Loading level file: " + path, ex);
            }

            return(model);
        }