当前位置: 首页>>代码示例>>C#>>正文


C# PBXDictionary.ContainsKey方法代码示例

本文整理汇总了C#中PBXDictionary.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# PBXDictionary.ContainsKey方法的具体用法?C# PBXDictionary.ContainsKey怎么用?C# PBXDictionary.ContainsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PBXDictionary的用法示例。


在下文中一共展示了PBXDictionary.ContainsKey方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: XCProject

        public XCProject( string filePath )
            : this()
        {
            if( !System.IO.Directory.Exists( filePath ) ) {
                Debug.LogWarning( "Path does not exists." );
                return;
            }

            if( filePath.EndsWith( ".xcodeproj" ) ) {
                Debug.Log( "Opening project " + filePath );
                this.projectRootPath = Path.GetDirectoryName( filePath );
                this.filePath = filePath;
            } else {
                Debug.Log( "Looking for xcodeproj files in " + filePath );
                string[] projects = System.IO.Directory.GetDirectories( filePath, "*.xcodeproj" );
                if( projects.Length == 0 ) {
                    Debug.LogWarning( "Error: missing xcodeproj file" );
                    return;
                }

                this.projectRootPath = filePath;
                this.filePath = projects[ 0 ];
            }

            // Convert to absolute
            this.projectRootPath = Path.GetFullPath(this.projectRootPath);

            projectFileInfo = new FileInfo( Path.Combine( this.filePath, "project.pbxproj" ) );
            StreamReader sr = projectFileInfo.OpenText();
            string contents = sr.ReadToEnd();
            sr.Close();

            PBXParser parser = new PBXParser();
            _datastore = parser.Decode( contents );
            if( _datastore == null ) {
                throw new System.Exception( "Project file not found at file path " + filePath );
            }

            if( !_datastore.ContainsKey( "objects" ) ) {
                Debug.Log( "Errore " + _datastore.Count );
                return;
            }

            _objects = (PBXDictionary)_datastore["objects"];
            modified = false;

            _rootObjectKey = (string)_datastore["rootObject"];
            if( !string.IsNullOrEmpty( _rootObjectKey ) ) {
            //				_rootObject = (PBXDictionary)_objects[ _rootObjectKey ];
                _project = new PBXProject( _rootObjectKey, (PBXDictionary)_objects[ _rootObjectKey ] );
            //				_rootGroup = (PBXDictionary)_objects[ (string)_rootObject[ "mainGroup" ] ];
                _rootGroup = new PBXGroup( _rootObjectKey, (PBXDictionary)_objects[ _project.mainGroupID ] );
            }
            else {
                Debug.LogWarning( "error: project has no root object" );
                _project = null;
                _rootGroup = null;
            }
        }
开发者ID:iwandi,项目名称:XCodeEditor-for-Unity,代码行数:59,代码来源:XCProject.cs

示例2: PBXObject

		public PBXObject( string guid, PBXDictionary dictionary ) : this( guid )
		{
			if( !dictionary.ContainsKey( ISA_KEY ) || ((string)dictionary[ ISA_KEY ]).CompareTo( this.GetType().Name ) != 0 )
				Debug.LogError( "PBXDictionary is not a valid ISA object" );
			
			foreach( KeyValuePair<string, object> item in dictionary ) {
				_data[ item.Key ] = item.Value;
			}
		}
开发者ID:ashishsfb,项目名称:Save-The-Kitty,代码行数:9,代码来源:PBXObject.cs

示例3: XCProject

        public XCProject( string filePath )
            : this()
        {
            if( !System.IO.Directory.Exists( filePath ) ) {
                Debug.LogWarning( "XCode project path does not exist: " + filePath );
                return;
            }

            if( filePath.EndsWith( ".xcodeproj" ) ) {
                Debug.Log( "Opening project " + filePath );
                this.projectRootPath = Path.GetDirectoryName( filePath );
                this.filePath = filePath;
            } else {
                Debug.Log( "Looking for xcodeproj files in " + filePath );
                string[] projects = System.IO.Directory.GetDirectories( filePath, "*.xcodeproj" );
                if( projects.Length == 0 ) {
                    Debug.LogWarning( "Error: missing xcodeproj file" );
                    return;
                }

                this.projectRootPath = filePath;
                //if the path is relative to the project, we need to make it absolute
                if (!System.IO.Path.IsPathRooted(projectRootPath))
                    projectRootPath = Application.dataPath.Replace("Assets", "") + projectRootPath;
                //Debug.Log ("projectRootPath adjusted to " + projectRootPath);
                this.filePath = projects[ 0 ];
            }

            projectFileInfo = new FileInfo( Path.Combine( this.filePath, "project.pbxproj" ) );
            string contents = projectFileInfo.OpenText().ReadToEnd();

            PBXParser parser = new PBXParser();
            _datastore = parser.Decode( contents );
            if( _datastore == null ) {
                throw new System.Exception( "Project file not found at file path " + filePath );
            }

            if( !_datastore.ContainsKey( "objects" ) ) {
                Debug.Log( "Errore " + _datastore.Count );
                return;
            }

            _objects = (PBXDictionary)_datastore["objects"];
            modified = false;

            _rootObjectKey = (string)_datastore["rootObject"];
            if( !string.IsNullOrEmpty( _rootObjectKey ) ) {
                _project = new PBXProject( _rootObjectKey, (PBXDictionary)_objects[ _rootObjectKey ] );
                _rootGroup = new PBXGroup( _rootObjectKey, (PBXDictionary)_objects[ _project.mainGroupID ] );
            }
            else {
                Debug.LogWarning( "error: project has no root object" );
                _project = null;
                _rootGroup = null;
            }
        }
开发者ID:kelleygunner,项目名称:arfighting,代码行数:56,代码来源:VKXCProject.cs


注:本文中的PBXDictionary.ContainsKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。