GetParentGUID() private method

private GetParentGUID ( string itemGUID, int changeset ) : string
itemGUID string
changeset int
return string
 private void AddAssetItem(string guid, string pathName, bool isDir, ChangeFlags changeFlags, int changeset)
 {
     if (pathName == string.Empty)
     {
         return;
     }
     if (isDir)
     {
         string str   = ParentViewFolder.MakeNiceName(pathName);
         int    index = ParentViewState.IndexOf(this.folders, str);
         if (index == -1)
         {
             ArrayUtility.Add <ParentViewFolder>(ref this.folders, new ParentViewFolder(str, guid, changeFlags));
         }
         else
         {
             this.folders[index].changeFlags = changeFlags;
             this.folders[index].guid        = guid;
         }
     }
     else
     {
         string           str1   = ParentViewFolder.MakeNiceName(FileUtil.DeleteLastPathNameComponent(pathName));
         string           str2   = pathName.Substring(pathName.LastIndexOf("/") + 1);
         int              index1 = ParentViewState.IndexOf(this.folders, str1);
         ParentViewFolder parentViewFolder;
         if (index1 == -1)
         {
             parentViewFolder = new ParentViewFolder(str1, AssetServer.GetParentGUID(guid, changeset));
             ArrayUtility.Add <ParentViewFolder>(ref this.folders, parentViewFolder);
         }
         else
         {
             parentViewFolder = this.folders[index1];
         }
         int index2 = ParentViewState.IndexOf(parentViewFolder.files, str2);
         if (index2 != -1)
         {
             if ((parentViewFolder.files[index2].changeFlags & ChangeFlags.Deleted) != ChangeFlags.None)
             {
                 return;
             }
             parentViewFolder.files[index2].guid        = guid;
             parentViewFolder.files[index2].changeFlags = changeFlags;
         }
         else
         {
             ArrayUtility.Add <ParentViewFile>(ref parentViewFolder.files, new ParentViewFile(str2, guid, changeFlags));
         }
     }
 }
Example #2
0
		private void AddAssetItem(string guid, string pathName, bool isDir, ChangeFlags changeFlags, int changeset)
		{
			if (!(pathName == string.Empty))
			{
				if (isDir)
				{
					string text = ParentViewFolder.MakeNiceName(pathName);
					int num = ParentViewState.IndexOf(this.folders, text);
					if (num == -1)
					{
						ParentViewFolder item = new ParentViewFolder(text, guid, changeFlags);
						ArrayUtility.Add<ParentViewFolder>(ref this.folders, item);
					}
					else
					{
						this.folders[num].changeFlags = changeFlags;
						this.folders[num].guid = guid;
					}
				}
				else
				{
					string text2 = ParentViewFolder.MakeNiceName(FileUtil.DeleteLastPathNameComponent(pathName));
					string text3 = pathName.Substring(pathName.LastIndexOf("/") + 1);
					int num2 = ParentViewState.IndexOf(this.folders, text2);
					ParentViewFolder parentViewFolder;
					if (num2 == -1)
					{
						parentViewFolder = new ParentViewFolder(text2, AssetServer.GetParentGUID(guid, changeset));
						ArrayUtility.Add<ParentViewFolder>(ref this.folders, parentViewFolder);
					}
					else
					{
						parentViewFolder = this.folders[num2];
					}
					num2 = ParentViewState.IndexOf(parentViewFolder.files, text3);
					if (num2 != -1)
					{
						if ((parentViewFolder.files[num2].changeFlags & ChangeFlags.Deleted) == ChangeFlags.None)
						{
							parentViewFolder.files[num2].guid = guid;
							parentViewFolder.files[num2].changeFlags = changeFlags;
						}
					}
					else
					{
						ArrayUtility.Add<ParentViewFile>(ref parentViewFolder.files, new ParentViewFile(text3, guid, changeFlags));
					}
				}
			}
		}
 private void AddAssetItem(string guid, string pathName, bool isDir, ChangeFlags changeFlags, int changeset)
 {
     if (pathName != string.Empty)
     {
         if (isDir)
         {
             string lfname = ParentViewFolder.MakeNiceName(pathName);
             int    index  = IndexOf(this.folders, lfname);
             if (index == -1)
             {
                 ParentViewFolder item = new ParentViewFolder(lfname, guid, changeFlags);
                 ArrayUtility.Add <ParentViewFolder>(ref this.folders, item);
             }
             else
             {
                 this.folders[index].changeFlags = changeFlags;
                 this.folders[index].guid        = guid;
             }
         }
         else
         {
             ParentViewFolder folder2;
             string           str2 = ParentViewFolder.MakeNiceName(FileUtil.DeleteLastPathNameComponent(pathName));
             string           str3 = pathName.Substring(pathName.LastIndexOf("/") + 1);
             int num2 = IndexOf(this.folders, str2);
             if (num2 == -1)
             {
                 folder2 = new ParentViewFolder(str2, AssetServer.GetParentGUID(guid, changeset));
                 ArrayUtility.Add <ParentViewFolder>(ref this.folders, folder2);
             }
             else
             {
                 folder2 = this.folders[num2];
             }
             num2 = IndexOf(folder2.files, str3);
             if (num2 != -1)
             {
                 if ((folder2.files[num2].changeFlags & ChangeFlags.Deleted) == ChangeFlags.None)
                 {
                     folder2.files[num2].guid        = guid;
                     folder2.files[num2].changeFlags = changeFlags;
                 }
             }
             else
             {
                 ArrayUtility.Add <ParentViewFile>(ref folder2.files, new ParentViewFile(str3, guid, changeFlags));
             }
         }
     }
 }