Пример #1
0
        public bool Load(XmlNode input)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            NameCompressor nc    = NameCompressor.Instance;
            bool           allOk = true;

            ReferenceTable.Clear();

            // TODO: load everyting

            XmlNode xReferenceTable = input.SelectSingleNode("/" + nc[SST.ReferenceTable]);

            if (xReferenceTable != null)
            {
                allOk &= ReferenceTable.Load(xReferenceTable);
            }
            else
            {
                allOk = false;
                Log.Write(Log.Level.Warning, "No ReferenceTable found!");
            }

            return(allOk);
        }
        public static ReferenceTable Create()
        {
            ReferenceTable t = new ReferenceTable();

            t.ReferenceTableValues = new List <ReferenceTableValue>();
            list.Add(":1234567890=≠≤![");
            list.Add(" /STUVWXYZ],(→≡~");
            list.Add("-JKLMNOPQR%$*↑↓>");
            list.Add("+ABCDEFGHI<.)≥?;");

            for (int row = 0; row <= 3; row++)
            {
                for (int col = 0; col <= 15; col++)
                {
                    char cc = list[row].Substring(col, 1).ToCharArray()[0];
                    ReferenceTableValue rf = new ReferenceTableValue(
                        String.Format("{0:X}", row),
                        String.Format("{0:X}", col),
                        cc);

                    t.ReferenceTableValues.Add(rf);
                }
            }
            return(t);
        }
Пример #3
0
 public void ClearILP()
 {
     PatchActionList.Clear();
     TargetFinderList.Clear();
     PatchEntryList.Clear();
     ReferenceTable.Clear();
 }
Пример #4
0
        public void ReferenceTableCanCreate()
        {
            var table = new ReferenceTable();

            Assert.Equal(0, table.Count);
            Assert.Null(table.ExpressionForKey("unknown"));
        }
Пример #5
0
    public PROJECT_ERROR_TYPE ModifyRefTableAfterRemoveSprite(string[] spritePathTable)
    {
        PROJECT_ERROR_TYPE errorType = PROJECT_ERROR_TYPE.PROJECT_ERROR_NONE;

        if (null == spritePathTable)
        {
            return(PROJECT_ERROR_TYPE.PROJECT_ERROR_SPRITEIMAGE_PATH);
        }

        foreach (var spriteItem in spritePathTable)
        {     //遍历全部移动Sprite
            foreach (var refAssetItem in ReferenceTable)
            { //遍历全部反依赖项目,并删除移动Sprite
                refAssetItem.ReferencingSprite.Remove(System.IO.Path.GetFileNameWithoutExtension(spriteItem));
            }
        }


        //删除无用反依赖记录
        for (int i = ReferenceTable.Count - 1; i >= 0; i--)
        {
            if (0 == ReferenceTable[i].ReferencingSprite.Count)
            {
                ReferenceTable.RemoveAt(i);
            }
        }


        return(errorType);
    }
Пример #6
0
        private void BuildRefTable(ReferenceTable reference, string table, SqlConnection source, SqlConnection destination)
        {
            DeleteTable(reference.Table);
            CreateRefTempTable(source, table, reference.ReferenceAttribute);
            string sqlCommand = $" SELECT A.* FROM {reference.Table} A INNER JOIN #REFID B ON A.{reference.KeyAttribute} = B.{reference.ReferenceAttribute}";

            using (SqlCommand cmd = new SqlCommand(sqlCommand, source))
            {
                try
                {
                    cmd.CommandTimeout = 3600;
                    SqlDataReader reader   = cmd.ExecuteReader();
                    SqlBulkCopy   bulkData = new SqlBulkCopy(destination);
                    bulkData.DestinationTableName = reference.Table;
                    bulkData.BulkCopyTimeout      = 1000;
                    bulkData.WriteToServer(reader);
                    string info = $"Creating table {reference.Table}";
                    _queueService.InsertMessage(infoQueue, info);
                    _logger.LogInformation(info);
                }
                catch (SqlException ex)
                {
                    Exception error = new Exception($"Sorry! Error copying table: {table}; {ex}");
                    throw error;
                }
            }
        }
Пример #7
0
        private string CheckHeaderForeignKeys(string json, ReferenceTable reference)
        {
            try
            {
                JObject dataObject = JObject.Parse(json);
                string  field      = dataObject[reference.ReferenceAttribute].ToString();
                field = Common.FixAposInStrings(field);
                string    select = $"Select * from {reference.Table} ";
                string    query  = $" where {reference.KeyAttribute} = '{field}'";
                DataTable dt     = _dbConn.GetDataTable(select, query);
                if (dt.Rows.Count == 0)
                {
                    if (reference.Insert)
                    {
                        string strInsert = $"insert into {reference.Table} ";
                        string strValue  = $" ({reference.KeyAttribute}, {reference.ValueAttribute}) values ('{field}', '{field}')";
                        string strQuery  = "";
                        _dbConn.DBInsert(strInsert, strValue, strQuery);
                    }
                    else
                    {
                        dataObject[reference.ReferenceAttribute] = "UNKNOWN";
                    }
                }
            }
            catch (Exception)
            {
                throw new System.Exception("Error handling reference data");
            }

            string newJson = json;

            return(newJson);
        }
Пример #8
0
 internal bool isReferenceRecord(string className)
 {
     if (ReferenceTable.Equals(className) && !String.IsNullOrWhiteSpace(ReferenceField))
     {
         return(true);
     }
     return(false);
 }
Пример #9
0
        public ParserState()
        {
            InternalReferenceMap = new ReferenceTable(); // used for storing our refs

            // starting position
            Line   = 1;
            Column = 1;
        }
Пример #10
0
        public virtual void AppendMissingReference(IndexModel index, ReferenceTable table)
        {
            var d = new DifferenceModel()
            {
                Source    = index,
                Kind      = TypeDifferenceEnum.Orphean,
                Reference = "Table " + table.ToString(),
            };

            this._lst.Add(d);
        }
Пример #11
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public virtual bool IsEqual(ForeignKeyInfo foreignKey)
        {
            if (foreignKey == null)
            {
                return(false);
            }

            return(Table.IsEqual(foreignKey.Table) &&
                   Column.IsEqual(foreignKey.Column) &&
                   ReferenceTable.IsEqual(foreignKey.ReferenceTable) &&
                   ReferenceColumn.IsEqual(foreignKey.ReferenceColumn));
        }
Пример #12
0
        public void ReferenceTableCanSetKey()
        {
            var table = new ReferenceTable();
            var val   = Expression.CreateValue("asdf");

            table.SetExpressionForKey("key", val);

            var valFromTable = table.ExpressionForKey("key");

            Assert.NotNull(valFromTable);
            Assert.Equal("asdf", valFromTable.Value);
        }
Пример #13
0
		void LoadData() {
			var refs = new ReferenceTable();
			var lessees = (LesseeManager)FindResource("LesseeData");
			var properties = (PropertyManager)FindResource("PropertyData");
			var projects = (ProjectManager)FindResource("ProjectData");
			var projectinfo = (ProjectInfoCollection)FindResource("ProjectInfo");
			var serializer = (Serializer)FindResource("Serializer");
			Xml.Read(Settings.PropertyFilepath, properties, refs, serializer.IdTable);
			Xml.Read(Settings.LesseeFilepath, lessees, refs, serializer.IdTable);
			projectinfo.Scan(Settings.ProjectPath, serializer.IdTable);
			refs.Update(serializer.IdTable);
		}
Пример #14
0
    public PROJECT_ERROR_TYPE AddItemToAtlasReferenceTable(ReferenceInfo refItem)
    {
        PROJECT_ERROR_TYPE errorType = PROJECT_ERROR_TYPE.PROJECT_ERROR_NONE;

        if (string.IsNullOrEmpty(refItem.ReferenceFilePath))
        {
            return(PROJECT_ERROR_TYPE.PROJECT_ERROR_REFERENCEFILE_ERROR);
        }

        ReferenceTable.Add(refItem);

        return(errorType);
    }
Пример #15
0
 public INFO(bool HasTracks)
 {
     Signature = "INFO";
     StreamSoundInfoReference = new SectionInfo(0x4100);
     TrackInfoReference       = new SectionInfo((uint)(HasTracks ? 0x101 : 0));
     ChannelInfoReference     = new SectionInfo(0x101);
     StreamInfo = new StreamSoundInfo();
     if (HasTracks)
     {
         TrackInfoReferenceTable = new ReferenceTable();
     }
     ChannelInfoReferenceTable = new ReferenceTable();
 }
Пример #16
0
        void LoadData()
        {
            var refs        = new ReferenceTable();
            var lessees     = (LesseeManager)FindResource("LesseeData");
            var properties  = (PropertyManager)FindResource("PropertyData");
            var projects    = (ProjectManager)FindResource("ProjectData");
            var projectinfo = (ProjectInfoCollection)FindResource("ProjectInfo");
            var serializer  = (Serializer)FindResource("Serializer");

            Xml.Read(Settings.PropertyFilepath, properties, refs, serializer.IdTable);
            Xml.Read(Settings.LesseeFilepath, lessees, refs, serializer.IdTable);
            projectinfo.Scan(Settings.ProjectPath, serializer.IdTable);
            refs.Update(serializer.IdTable);
        }
Пример #17
0
		public void TestDeserialise() {
			var id = new IdTable();
			var refs = new ReferenceTable();
			var props = new PropertyManager();
			var lessees = new LesseeManager();
			var projects = new ProjectManager();
			Xml.Read("D:\\Projects\\Olivia2\\Olivia2.Persistence.Test\\Properties.xml", props, refs, id);
			Xml.Read("D:\\Projects\\Olivia2\\Olivia2.Persistence.Test\\Lessees.xml", lessees, refs, id);
			Xml.Read("D:\\Projects\\Olivia2\\Olivia2.Persistence.Test\\Abrechnung 2011.xml", projects, refs, id);
			refs.Update(id);
			Equals(props[0].Name, "Haus1");
			Equals(props[0].Flats[0].Name, "Wohnung A");
			Equals(projects.Current.Assignments[0].Flat, props[0].Flats[0]);
		}
Пример #18
0
 /// <summary>
 /// </summary>
 /// <param name="suffix"></param>
 /// <returns></returns>
 public string GetConstraintName(string suffix)
 {
     if (suffix == "FK")
     {
         var refclassName = ReferenceTable.Replace(".", "_");
         if (null != ReferenceClass)
         {
             refclassName = ReferenceClass.Name;
         }
         return
             ((Table.FullSqlName.Replace(".", "_").Replace("\"", "") + "_" + Name + "_" + refclassName + "_" +
               ReferenceField + "_" + suffix).ToLowerInvariant());
     }
     return((Table.FullSqlName.Replace(".", "_").Replace("\"", "") + "_" + Name + "_" + suffix).ToLowerInvariant());
 }
Пример #19
0
        private static DataTable GetRecordByEntity(ReferenceTable referenceTable, int id)
        {
            DataTable dt = new DataTable();

            switch (referenceTable)
            {
            case ReferenceTable.GatewaySlot:
            {
                // dt = GatewaySlot.GetGatewaySlot(id);
                break;
            }
            }

            return(dt);
        }
Пример #20
0
        public void TestDeserialise()
        {
            var id       = new IdTable();
            var refs     = new ReferenceTable();
            var props    = new PropertyManager();
            var lessees  = new LesseeManager();
            var projects = new ProjectManager();

            Xml.Read("D:\\Projects\\Olivia2\\Olivia2.Persistence.Test\\Properties.xml", props, refs, id);
            Xml.Read("D:\\Projects\\Olivia2\\Olivia2.Persistence.Test\\Lessees.xml", lessees, refs, id);
            Xml.Read("D:\\Projects\\Olivia2\\Olivia2.Persistence.Test\\Abrechnung 2011.xml", projects, refs, id);
            refs.Update(id);
            Equals(props[0].Name, "Haus1");
            Equals(props[0].Flats[0].Name, "Wohnung A");
            Equals(projects.Current.Assignments[0].Flat, props[0].Flats[0]);
        }
Пример #21
0
		public static void Read(string filepath, PropertyManager properties, ReferenceTable references, IdTable ids) {
			var xml = new XPathDocument(filepath).CreateNavigator();
			var pi = xml.Select("/Properties/Property");
			while ( pi.MoveNext() ) {
				var pnode = pi.Current;
				var p = properties.Create();
				ids[p] = new Guid(pnode.GetAttribute("id", ""));
				AssignProperties(pnode, p, references);
				var fi = pnode.Select("Flats/Flat");
				while ( fi.MoveNext() ) {
					var fnode = fi.Current;
					var f = p.CreateFlat();
					ids[f] = new Guid(fnode.GetAttribute("id", ""));
					AssignProperties(fnode, f, references);
				}
			}
		}
Пример #22
0
        public virtual void AppendMissingReference(ConstraintModel constraint, ReferenceTable table)
        {
            var d = new DifferenceModel()
            {
                Source    = constraint,
                Kind      = TypeDifferenceEnum.Orphean,
                Reference = "Table " + table.ToString(),
            };

            this._lst.Add(d);

            //if (generateSource)
            //{
            //    string p = BuildPath(Path.Combine(this.folderForSource, constraint.TableReference.Owner), "Triggers", constraint.Name);
            //    WriteFile(p, CreateOrReplace + Utils.Unserialize(constraint.Code, true));
            //}
        }
Пример #23
0
        public virtual void AppendMissingReference(TriggerModel trigger, ReferenceTable table)
        {
            var d = new DifferenceModel()
            {
                Source    = trigger,
                Kind      = TypeDifferenceEnum.Orphean,
                Reference = "Table " + table.ToString(),
            };

            this._lst.Add(d);

            if (generateSource)
            {
                string p = BuildPath(Path.Combine(this.folderForSource, trigger.TableReference.Owner), "Triggers", trigger.Name);
                WriteFile(p, CreateOrReplace + Utils.Unserialize(trigger.Code, true));
            }
        }
Пример #24
0
        public void ExpressionCanDerefFromExternalTable()
        {
            var refTable = new ReferenceTable();

            refTable.SetExpressionForKey("name", Expression.CreateValue("Bob"));

            var expr = Expression.CreateFromStringWithExternalReferenceTable(
                "@(playerName *[name])", ParseFlags.None,
                refTable
                );

            Assert.Equal(ExpressionType.Map, expr.ExpressionType);

            var val = expr.MapValueForKey("playerName");

            Assert.Equal(ExpressionType.Value, val.ExpressionType);
            Assert.Equal("Bob", val.Value);
        }
Пример #25
0
    public PROJECT_ERROR_TYPE ModifyRefTableAfterAddSprite(AtlasSpriteImage[] spriteImageTable)
    {
        PROJECT_ERROR_TYPE errorType  = PROJECT_ERROR_TYPE.PROJECT_ERROR_NONE;
        AtlasSpriteImage   tempSprite = null;
        ReferenceInfo      refInfo    = null;

        if (null == spriteImageTable)
        {
            return(PROJECT_ERROR_TYPE.PROJECT_ERROR_SPRITEIMAGE_PATH);
        }

        foreach (var spriteItem in spriteImageTable)
        {
            if (!FindSprite(spriteItem.Path, ref tempSprite))
            {
                continue;
            }

            //更新Sprite反依赖
            tempSprite.ReferenceTable = spriteItem.ReferenceTable;

            //更新Atlas反依赖
            foreach (var assetItem in spriteItem.ReferenceTable)
            {
                if (!FindRefAssetFile(assetItem, ref refInfo))
                {
                    ReferenceInfo newInfo = new ReferenceInfo();
                    newInfo.ReferenceFilePath = assetItem;
                    newInfo.ReferencingSprite.Add(System.IO.Path.GetFileNameWithoutExtension(spriteItem.Path));

                    ReferenceTable.Add(newInfo);
                }
                else
                {
                    if (!FindRefAssetSprite(assetItem, System.IO.Path.GetFileNameWithoutExtension(spriteItem.Path)))
                    {
                        refInfo.ReferencingSprite.Add(System.IO.Path.GetFileNameWithoutExtension(spriteItem.Path));
                    }
                }
            }
        }

        return(errorType);
    }
Пример #26
0
		public OpenProject() {
			InitializeComponent();

			SetValue(ProjectSelectedProperty, false);
			ProjectList.SelectionChanged += (o, e) => {
				SetValue(ProjectSelectedProperty, ProjectList.SelectedItems != null);
			};

			OpenButton.Click += (_, __) => {
				var refs = new ReferenceTable();
				var filepath = ((ProjectInfo)ProjectList.SelectedItem).Filepath;
				var projects = (ProjectManager)FindResource("ProjectData");
				var ids = ((Serializer)FindResource("Serializer")).IdTable;
				Xml.Read(filepath, projects, refs, ids);
				refs.Update(ids);
				projects.Current.Result.Calculate();
				MainWindow.ActiveTask = 7;
			};
		}
Пример #27
0
    public void Click_s()
    {
        int i, j;

        change.SetActive(true);
        gameObject.SetActive(false);
        blackAI.SetActive(false);
        whiteAI.SetActive(false);
        tip.SetActive(true);
        loadandsave.SetActive(true);

        loadorsave.text = "读档";
        changetext.text = "落子";
        Tips.text       = "黑方先行";
        StepNumber.text = "当前步数:" + ReferenceTable.turns;


        if (ReferenceTable.if_first == 0)
        {
            GameObject.Instantiate(blue, blue.transform.position, blue.transform.rotation);
            ReferenceTable.if_first        = 1;
            ReferenceTable.now_position[0] = 7;
            ReferenceTable.now_position[1] = 7;
        }
        else
        {
            //GameObject.FindWithTag("Blue").GetComponent<Blue>().Movenow(7, 7);
        }
        ReferenceTable.now_if_player = 0;
        ReferenceTable.turns         = 0;
        //ReferenceTable.now_position[0] = 7;
        ReferenceTable.if_start = 1;
        //ReferenceTable.now_position[1] = 7;
        ReferenceTable.Initialize();

        for (i = 0; i < 15; i++)
        {
            for (j = 0; j < 15; j++)
            {
                ReferenceTable.checkerboard[i, j] = 0;
            }
        }
    }
Пример #28
0
        public OpenProject()
        {
            InitializeComponent();

            SetValue(ProjectSelectedProperty, false);
            ProjectList.SelectionChanged += (o, e) => {
                SetValue(ProjectSelectedProperty, ProjectList.SelectedItems != null);
            };

            OpenButton.Click += (_, __) => {
                var refs     = new ReferenceTable();
                var filepath = ((ProjectInfo)ProjectList.SelectedItem).Filepath;
                var projects = (ProjectManager)FindResource("ProjectData");
                var ids      = ((Serializer)FindResource("Serializer")).IdTable;
                Xml.Read(filepath, projects, refs, ids);
                refs.Update(ids);
                projects.Current.Result.Calculate();
                MainWindow.ActiveTask = 7;
            };
        }
Пример #29
0
        /// <summary>
        /// String representation of the PDF document
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(Header);

            IEnumerator enu = _indirectObjects.GetEnumerator();

            while (enu.MoveNext())
            {
                IndirectObject iobj = (IndirectObject)enu.Current;
                iobj.Offset = sb.Length;
                ReferenceTable.Add(new CrossRef(iobj.Offset, 0));
                sb.Append(iobj.ToString());
            }
            Trailer.CrossRefStartOffset = sb.Length;

            sb.Append(ReferenceTable);
            Trailer.Size = this._indirectObjects.Count + 1;
            sb.Append(Trailer.ToString());
            return(sb.ToString());
        }
Пример #30
0
        public bool Save(XmlNode output)
        {
            if (output == null)
            {
                throw new ArgumentNullException(nameof(output));
            }

            int  idNum = 0;
            bool allOk = true;

            XmlNode xILPTableNode = output.InsertCompressedElement(SST.ILPTable);

            XmlNode xPatchActionTable = xILPTableNode.InsertCompressedElement(SST.PatchActionTable);

            foreach (PatchAction pa in PatchActionList)
            {
                allOk &= Save(xPatchActionTable, pa, (idNum++).ToBaseAlph());
            }

            XmlNode xTargetFinderTable = xILPTableNode.InsertCompressedElement(SST.TargetFinderTable);

            foreach (TargetFinder tf in TargetFinderList)
            {
                allOk &= Save(xTargetFinderTable, tf, (idNum++).ToBaseAlph());
            }

            XmlNode xPatchEntryTable = xILPTableNode.InsertCompressedElement(SST.PatchEntryTable);

            foreach (PatchEntry pe in PatchEntryList)
            {
                allOk &= Save(xPatchEntryTable, pe);
            }

            XmlNode xReferenceTable = xILPTableNode.InsertCompressedElement(SST.ReferenceTable);

            allOk &= ReferenceTable.Save(xReferenceTable);

            return(allOk);
        }
Пример #31
0
        //Insert the item to the dropdown box based on the reference table
        /// <summary>
        /// Insert the item in the dropdown box
        /// </summary>
        /// <param name="referenceTable">Refernece Table to get record</param>
        /// <param name="id">id of record</param>
        /// <param name="position">position in the dropdown list to put the new item</param>
        public static bool InsertItemTopDDL(DropDownList ctrl, ReferenceTable referenceTable, int id)
        {
            int position = 0;
            //Get the entity items record..
            DataTable dt = GetRecordByEntity(referenceTable, id);

            //No row as returned to insert
            if (dt.Rows.Count == 0)
            {
                return(false);
            }

            if (ctrl.Items[0].Text.IsNullOrWhiteSpace())
            {
                position = 1;
            }

            ctrl.Items.Insert(position, new ListItem(dt.Rows[0][1].ToString(), id.ToString()));

            ctrl.SelectedIndex = position;

            return(true);
        }
Пример #32
0
    public void Click()
    {
        if (ReferenceTable.if_start == 1)
        {
            if (ReferenceTable.turns == 0)
            {
                Loadorsave.text = "存档";
            }
            play.Play();
            //Debug.Log("first?");
            blue     = GameObject.FindWithTag("Blue");
            location = blue.transform.position;
            if (Bordercheck() == 0)
            {
                if (ReferenceTable.checkerboard[ReferenceTable.now_position[0], ReferenceTable.now_position[1]] == 0)
                {
                    gameObject.SetActive(false);
                    if (ReferenceTable.turns % 2 != 1)
                    {
                        //centerpoint.GetComponent<Camera>().Roteing(45);
                        GameObject.Instantiate(black, location, black.transform.rotation);
                        Tips.text = "轮到白方行棋";
                        ReferenceTable.checkerboard[
                            ReferenceTable.now_position[0], ReferenceTable.now_position[1]] = 1;
                        ReferenceTable.now_if_player = ReferenceTable.white_if_player;
                        if (Wincheck(1, ReferenceTable.now_position[0], ReferenceTable.now_position[1]) == 0)
                        {
                            Tips.text = "黑方获胜";
                            ReferenceTable.turns++;

                            //tip.SetActive(false);
                            centerpoint.GetComponent <Camera>().if_win = 1;
                            centerpoint.GetComponent <Camera>().Roteing(45);

                            ReferenceTable.if_start = 0;
                            StepNumber.text         = "当前步数:" + ReferenceTable.turns;
                            ButtonText.text         = "重新开始";
                            gameObject.SetActive(true);
                        }
                        else
                        {
                            ReferenceTable.Addturns();
                            StepNumber.text = "当前步数:" + ReferenceTable.turns;
                            //Debug.Log(SituationCheck.Samenumber[2]+ " "+SituationCheck.Samenumber[3]);
                        }
                    }
                    else
                    {
                        GameObject.Instantiate(white, location, white.transform.rotation);
                        Tips.text = "轮到黑方行棋";
                        ReferenceTable.checkerboard[
                            ReferenceTable.now_position[0], ReferenceTable.now_position[1]] = 2;
                        ReferenceTable.now_if_player = ReferenceTable.black_if_player;
                        if (Wincheck(2, ReferenceTable.now_position[0], ReferenceTable.now_position[1]) == 0)
                        {
                            Tips.text = "白方获胜";

                            ReferenceTable.Addturns();
                            StepNumber.text = "当前步数:" + ReferenceTable.turns;

                            //tip.SetActive(false);
                            centerpoint.GetComponent <Camera>().if_win = 1;
                            centerpoint.GetComponent <Camera>().Roteing(45);

                            ButtonText.text = "重新开始";
                            gameObject.SetActive(true);
                            ReferenceTable.if_start = 0;
                        }
                        else
                        {
                            ReferenceTable.Addturns();
                            //Debug.Log(ReferenceTable.now_if_player);
                            StepNumber.text = "当前步数:" + ReferenceTable.turns;
                            //Debug.Log(SituationCheck.Samenumber[2] + " " + SituationCheck.Samenumber[3]);
                        }
                    }
                    if (ReferenceTable.turns >= 225)
                    {
                        Tips.text = "和棋";
                    }
                }
                else
                {
                    Tips.text = "这个位置已经存在棋子";
                }
            }
            else
            {
                Tips.text = "超出边界";
            }
        }
        else
        {
            checkerboard.GetComponent <CheckerBoard>().direction = 0;

            centerpoint.GetComponent <Camera>().if_win = 0;
            centerpoint.GetComponent <Camera>().Roteing(60);
            //tip.SetActive(false);
            ReferenceTable.if_start = 0;
            blue.GetComponent <Blue>().Movenow(7, 7);
            gameObject.SetActive(false);
            startbutton.SetActive(true);
            blackAI.SetActive(true);
            whiteAI.SetActive(true);
        }
    }
Пример #33
0
		public static void AssignProperties(XPathNavigator node, object o, ReferenceTable references) {
			//var properties = o.GetType().GetProperties();
			foreach ( var property in o.GetType().GetProperties() ) {
				if ( !property.HasAttribute(typeof(SerializeAttribute)) ) continue;
				var pnode = node.SelectSingleNode(property.Name);
				if ( pnode == null ) continue;// use default value
				var val = pnode.Value;
				if ( property.PropertyType.IsEnum ) {
					property.SetValue(o, Enum.Parse(property.PropertyType, val), null);
				} else if ( property.PropertyType.IsValueType ) {
					var parse = property.PropertyType.GetMethod("Parse", new Type[] { typeof(string) });
					var value = parse.Invoke(null, new object[] { val });
					property.SetValue(o, value, null);
				} else if ( property.PropertyType.Name == "String" ) {
					property.SetValue(o, val, null);
				} else if ( val == "null" ) {
					property.SetValue(o, null, null);
				} else if ( property.CanWrite ) {
					references.Add(new Guid(val), property, o);
				}
			}
		}
Пример #34
0
		public static void Read(string filepath, ProjectManager projects, ReferenceTable references, IdTable ids) {
			var xml = new XPathDocument(filepath).CreateNavigator();
			var project = new Project();
			var pnode = xml.SelectSingleNode("/Project");
			ids[project] = new Guid(pnode.GetAttribute("id", ""));
			AssignProperties(pnode, project, references);
			references.Update(ids);// force Project.Property assignment
			var aci = pnode.Select("Assignments/FlatAssignmentCollection");
			while ( aci.MoveNext() ) {
				var acnode = aci.Current;
				var flatid = acnode.SelectSingleNode("Flat").Value;
				var collection = project.Assignments.First(ac => ids[ac.Flat].ToString() == flatid);
				ids[collection] = new Guid(acnode.GetAttribute("id", ""));
				AssignProperties(acnode, collection, references);
				var ai = acnode.Select("FlatAssignment");
				while ( ai.MoveNext() ) {
					var anode = ai.Current;
					var a = new FlatAssignment(project);
					ids[a] = new Guid(anode.GetAttribute("id", ""));
					AssignProperties(anode, a, references);
					collection.Add(a);
				}
			}
			references.Update(ids);// force Assignments for CostOptions generation
			var ci = pnode.Select("Costs/Cost");
			while ( ci.MoveNext() ) {
				var cnode = ci.Current;
				var c = project.CreateCost();
				ids[c] = new Guid(cnode.GetAttribute("id", ""));
				AssignProperties(cnode, c, references);
				var oi = cnode.Select("Options/CostOptions");
				while ( oi.MoveNext() ) {
					var onode = oi.Current;
					var lesseeid = onode.SelectSingleNode("Lessee").Value;
					var option = c.Options.First(o => ids[o.Lessee].ToString() == lesseeid);
					ids[option] = new Guid(onode.GetAttribute("id", ""));
					AssignProperties(onode, option, references);
				}
			}
			projects.Add(project);
		}
Пример #35
0
		public static void Read(string filepath, LesseeManager lessees, ReferenceTable references, IdTable ids) {
			var xml = new XPathDocument(filepath).CreateNavigator();
			var li = xml.Select("/Lessees/Lessee");
            var list = new List<Lessee>();
			while ( li.MoveNext() ) {
				var lnode = li.Current;
				var l = new Lessee();
				ids[l] = new Guid(lnode.GetAttribute("id", ""));
				AssignProperties(lnode, l, references);
				var pi = lnode.Select("Payments/AdvancePayment");
				while ( pi.MoveNext() ) {
					var pnode = pi.Current;
					var p = new AdvancePayment();
					ids[p] = new Guid(pnode.GetAttribute("id", ""));
					AssignProperties(pnode, p, references);
					l.Payments.Add(p);
				}
                list.Add(l);
			}
            foreach (var i in list.OrderBy(item => item.Name))
                lessees.Add(i);
		}
Пример #36
0
        internal void SetFinalCopyLocalState
        (
            AssemblyNameExtension assemblyName,
            string[] frameworkPaths,
            ProcessorArchitecture targetProcessorArchitecture,
            GetAssemblyRuntimeVersion getRuntimeVersion,
            Version targetedRuntimeVersion,
            FileExists fileExists,
            GetAssemblyPathInGac getAssemblyPathInGac,
            bool copyLocalDependenciesWhenParentReferenceInGac,
            bool doNotCopyLocalIfInGac,
            ReferenceTable referenceTable
        )
        {
            // If this item was unresolvable, then copy-local is false.
            if (IsUnresolvable)
            {
                CopyLocal = CopyLocalState.NoBecauseUnresolved;
                return;
            }

            if (EmbedInteropTypes)
            {
                CopyLocal = CopyLocalState.NoBecauseEmbedded;
                return;
            }

            // If this item was a conflict victim, then it should not be copy-local.
            if (IsConflictVictim)
            {
                CopyLocal = CopyLocalState.NoBecauseConflictVictim;
                return;
            }

            // If this is a primary reference then see if there's a Private metadata on the source item
            if (IsPrimary)
            {
                bool found;
                bool result = MetadataConversionUtilities.TryConvertItemMetadataToBool
                              (
                    PrimarySourceItem,
                    ItemMetadataNames.privateMetadata,
                    out found
                              );

                if (found)
                {
                    CopyLocal = result
                        ? CopyLocalState.YesBecauseReferenceItemHadMetadata
                        : CopyLocalState.NoBecauseReferenceItemHadMetadata;
                    return;
                }
            }
            else
            {
                // This is a dependency. If any primary reference that lead to this dependency
                // has Private=false, then this dependency should false too.
                bool privateTrueFound  = false;
                bool privateFalseFound = false;
                foreach (ITaskItem item in _sourceItems.Values)
                {
                    bool found;
                    bool result = MetadataConversionUtilities.TryConvertItemMetadataToBool
                                  (
                        item,
                        ItemMetadataNames.privateMetadata,
                        out found
                                  );

                    if (found)
                    {
                        if (result)
                        {
                            privateTrueFound = true;

                            // Once we hit this once we know there will be no modification to CopyLocal state.
                            // so we can immediately...
                            break;
                        }
                        else
                        {
                            privateFalseFound = true;
                        }
                    }
                }

                if (privateFalseFound && !privateTrueFound)
                {
                    CopyLocal = CopyLocalState.NoBecauseReferenceItemHadMetadata;
                    return;
                }
            }

            // If the item was determined to be an prereq assembly.
            if (IsPrerequisite && !UserRequestedSpecificFile)
            {
                CopyLocal = CopyLocalState.NoBecausePrerequisite;
                return;
            }

            // Items in the frameworks directory shouldn't be copy-local
            if (IsFrameworkFile(_fullPath, frameworkPaths))
            {
                CopyLocal = CopyLocalState.NoBecauseFrameworkFile;
                return;
            }

            // We are a dependency, check to see if all of our parent references have come from the GAC
            if (!IsPrimary && !copyLocalDependenciesWhenParentReferenceInGac)
            {
                // Did we discover a parent reference which was not found in the GAC
                bool foundSourceItemNotInGac = false;

                // Go through all of the parent source items and check to see if they were found in the GAC
                foreach (string key in _sourceItems.Keys)
                {
                    AssemblyNameExtension primaryAssemblyName = referenceTable.GetReferenceFromItemSpec(key);
                    Reference             primaryReference    = referenceTable.GetReference(primaryAssemblyName);

                    if (doNotCopyLocalIfInGac)
                    {
                        // Legacy behavior, don't copy local if the assembly is in the GAC at all
                        if (!primaryReference.FoundInGac.HasValue)
                        {
                            primaryReference.FoundInGac = !string.IsNullOrEmpty(getAssemblyPathInGac(primaryAssemblyName, targetProcessorArchitecture, getRuntimeVersion, targetedRuntimeVersion, fileExists, true, false));
                        }

                        if (!primaryReference.FoundInGac.Value)
                        {
                            foundSourceItemNotInGac = true;
                            break;
                        }
                    }
                    else
                    {
                        if (!primaryReference.ResolvedFromGac)
                        {
                            foundSourceItemNotInGac = true;
                            break;
                        }
                    }
                }

                // All parent source items were found in the GAC.
                if (!foundSourceItemNotInGac)
                {
                    CopyLocal = CopyLocalState.NoBecauseParentReferencesFoundInGAC;
                    return;
                }
            }

            if (doNotCopyLocalIfInGac)
            {
                // Legacy behavior, don't copy local if the assembly is in the GAC at all
                if (!FoundInGac.HasValue)
                {
                    FoundInGac = !string.IsNullOrEmpty(getAssemblyPathInGac(assemblyName, targetProcessorArchitecture, getRuntimeVersion, targetedRuntimeVersion, fileExists, true, false));
                }

                if (FoundInGac.Value)
                {
                    CopyLocal = CopyLocalState.NoBecauseReferenceFoundInGAC;
                    return;
                }
            }

            if (ResolvedFromGac)
            {
                CopyLocal = CopyLocalState.NoBecauseReferenceResolvedFromGAC;
                return;
            }

            // It was resolved locally, so copy it.
            CopyLocal = CopyLocalState.YesBecauseOfHeuristic;
        }
Пример #37
0
        public void InitializerReferenceTable()
        {
            try
            {
                if (!GetConnectionStatus())
                {
                    return;
                }

                string dpPath = UserSession.DB_PATH;
                var    db     = new SQLiteConnection(dpPath);

                // db.DropTable<ReferenceTable>();
                db.CreateTable <ReferenceTable>();

                var data = db.Table <ReferenceTable>(); //Call Reference Table


                // Get All References
                var references = _genericService.GetReferences();

                foreach (var reference in references)
                {
                    var entity = data.Where(x => x.Guid == reference.GUID).FirstOrDefault(); //Linq Query

                    if (entity == null)
                    {
                        // insert new item
                        ReferenceTable tbl = new ReferenceTable
                        {
                            Guid  = reference.GUID,
                            Value = reference.Value,
                            Type  = reference.Type
                        };

                        db.Insert(tbl);
                    }
                }

                // ADD NONE  - AGENT
                ReferenceTable tblAgentTemp = new ReferenceTable
                {
                    Guid  = Guid.Empty,
                    Value = "None",
                    Type  = (int)ReferenceTypeEnums.AGENT
                };

                var entity1 = data.Where(x => x.Value == tblAgentTemp.Value && x.Type == (int)ReferenceTypeEnums.AGENT).FirstOrDefault(); //Linq Query

                if (entity1 == null)
                {
                    // insert new item
                    db.Insert(tblAgentTemp);
                }

                // ADD ""  - OPEN LOT
                ReferenceTable tblLotTemp = new ReferenceTable
                {
                    Guid  = Guid.Empty,
                    Value = "",
                    Type  = (int)ReferenceTypeEnums.OPEN_LOT
                };

                entity1 = data.Where(x => x.Value == tblLotTemp.Value && x.Type == (int)ReferenceTypeEnums.OPEN_LOT).FirstOrDefault(); //Linq Query

                if (entity1 == null)
                {
                    // insert new item
                    db.Insert(tblLotTemp);
                }

                // ADD ""  - SHIPPED LOT
                ReferenceTable tblShipLotTemp = new ReferenceTable
                {
                    Guid  = Guid.Empty,
                    Value = "",
                    Type  = (int)ReferenceTypeEnums.SHIPPED_LOT
                };

                entity1 = data.Where(x => x.Value == tblShipLotTemp.Value && x.Type == (int)ReferenceTypeEnums.SHIPPED_LOT).FirstOrDefault(); //Linq Query

                if (entity1 == null)
                {
                    // insert new item
                    db.Insert(tblShipLotTemp);
                }
            }
            catch (Exception ex)
            {
                Toast.MakeText(this, "Error", ToastLength.Short).Show();
            }
        }