public void WriteAssetList(AssetList assets, int total, int pagesize, int pagestart)
        {
            writer.WriteStartElement("Assets");

            if (total > -1)
            {
                writer.WriteAttributeString("total", total.ToString());
            }

            if (pagesize > -1)
            {
                writer.WriteAttributeString("pageSize", pagesize.ToString());
            }

            if (pagestart > -1)
            {
                writer.WriteAttributeString("pageStart", pagestart.ToString());
            }

            foreach (var asset in assets)
            {
                WriteAsset(asset);
            }

            writer.WriteEndElement();
        }
 private void DoOpen(AssetList assets, bool alreadyOpen)
 {
   if (alreadyOpen)
   {
     using (List<Asset>.Enumerator enumerator = assets.GetEnumerator())
     {
       while (enumerator.MoveNext())
       {
         Asset current = enumerator.Current;
         bool flag = false;
         int count = this.assetList.Count;
         for (int index = 0; index < count; ++index)
         {
           if (this.assetList[index].path == current.path)
           {
             flag = true;
             this.assetList[index] = current;
             break;
           }
         }
         if (!flag)
           this.assetList.Add(current);
       }
     }
   }
   else
     this.assetList.AddRange((IEnumerable<Asset>) assets);
   this.RefreshList();
 }
Ejemplo n.º 3
0
 public static void Open(AssetList assets)
 {
     Task task = Provider.Status(assets);
     task.Wait();
     AssetList revert = task.assetList.Filter(true, new Asset.States[] { Asset.States.CheckedOutLocal });
     GetWindow().DoOpen(revert);
 }
Ejemplo n.º 4
0
 private void DoOpen(AssetList resolve)
 {
     bool includeFolder = true;
     Asset.States[] states = new Asset.States[] { Asset.States.Conflicted };
     this.assetList = resolve.Filter(includeFolder, states);
     this.RefreshList();
 }
Ejemplo n.º 5
0
		public static void Open(AssetList assets)
		{
			Task task = Provider.Status(assets);
			task.Wait();
			WindowResolve window = WindowResolve.GetWindow();
			window.DoOpen(task.assetList);
		}
 private void DoOpen(AssetList assets, bool alreadyOpen)
 {
     if (alreadyOpen)
     {
         foreach (Asset asset in assets)
         {
             bool flag = false;
             int count = this.assetList.Count;
             for (int i = 0; i < count; i++)
             {
                 if (this.assetList[i].path == asset.path)
                 {
                     flag = true;
                     this.assetList[i] = asset;
                     break;
                 }
             }
             if (!flag)
             {
                 this.assetList.Add(asset);
             }
         }
     }
     else
     {
         this.assetList.AddRange(assets);
     }
     this.RefreshList();
 }
Ejemplo n.º 7
0
 public static void Open(AssetList assets)
 {
     Task task = Provider.Status(assets);
     task.Wait();
     Asset.States[] states = new Asset.States[] { Asset.States.CheckedOutLocal, Asset.States.DeletedLocal, Asset.States.AddedLocal, Asset.States.Missing };
     AssetList revert = task.assetList.Filter(true, states);
     GetWindow().DoOpen(revert);
 }
Ejemplo n.º 8
0
 private static void UpdateFilesInVCIfNeeded()
 {
     if (Provider.enabled)
     {
         string[] strArray = Directory.GetFiles("Temp/ScriptUpdater/", "*.*", SearchOption.AllDirectories);
         AssetList assets = new AssetList();
         foreach (string str in strArray)
         {
             assets.Add(Provider.GetAssetByPath(str.Replace("Temp/ScriptUpdater/", string.Empty)));
         }
         Task task = Provider.Checkout(assets, CheckoutMode.Exact);
         task.Wait();
         if (<>f__am$cache0 == null)
         {
Ejemplo n.º 9
0
        public override void Export(AssetList asset, string path)
        {
            var materials = (asset as MaterialList);
            var mat = new MAT();

            foreach (Material material in materials.Entries)
            {
                mat.Materials.Add(
                    new MATMaterial(
                        material.Name,
                        material.Texture.Name
                    )
                );
            }

            mat.Save(path);
        }
Ejemplo n.º 10
0
 private void DoOpen(ChangeSet change, AssetList assets)
 {
     this.taskSubmit = null;
     this.submitResultCode = 0x100;
     this.submitErrorMessage = null;
     this.changeSet = change;
     this.description = (change != null) ? this.SanitizeDescription(change.description) : "";
     this.assetList = null;
     if (change == null)
     {
         this.taskStatus = Provider.Status(assets);
     }
     else
     {
         this.taskDesc = Provider.ChangeSetDescription(change);
         this.taskStat = Provider.ChangeSetStatus(change);
     }
 }
Ejemplo n.º 11
0
		private void DoOpen(ChangeSet change, AssetList assets)
		{
			this.taskSubmit = null;
			this.submitResultCode = 256;
			this.submitErrorMessage = null;
			this.changeSet = change;
			this.description = string.Empty;
			this.assetList = null;
			if (change == null)
			{
				this.taskStatus = Provider.Status(assets);
			}
			else
			{
				this.taskDesc = Provider.ChangeSetDescription(change);
				this.taskStat = Provider.ChangeSetStatus(change);
			}
		}
Ejemplo n.º 12
0
 public void LoadAssetsAsync(AssetList list, FloatRef progress)
 {
     List<Asset> assets = new List<Asset>();
     foreach (string path in datapaths)
     {
         try
         {
             if (!Directory.Exists(path))
             {
                 continue;
             }
             foreach (string s in Directory.GetFiles(path, "*.*", SearchOption.AllDirectories))
             {
                 try
                 {
                     FileInfo f = new FileInfo(s);
                     if (f.Name.Equals("thumbs.db", StringComparison.InvariantCultureIgnoreCase))
                     {
                         continue;
                     }
                     Asset a = new Asset();
                     a.data = File.ReadAllBytes(s);
                     a.dataLength = a.data.Length;
                     a.name = f.Name.ToLowerInvariant();
                     a.md5 = Md5(a.data);
                     assets.Add(a);
                 }
                 catch
                 {
                 }
             }
         }
         catch
         {
         }
     }
     progress.value = 1;
     list.count = assets.Count;
     list.items = new Asset[2048];
     for (int i = 0; i < assets.Count; i++)
     {
         list.items[i] = assets[i];
     }
 }
Ejemplo n.º 13
0
		private static void UpdateFilesInVCIfNeeded()
		{
			if (!Provider.enabled)
			{
				return;
			}
			string[] files = Directory.GetFiles("Temp/ScriptUpdater/", "*.*", SearchOption.AllDirectories);
			AssetList assetList = new AssetList();
			string[] array = files;
			for (int i = 0; i < array.Length; i++)
			{
				string text = array[i];
				assetList.Add(Provider.GetAssetByPath(text.Replace("Temp/ScriptUpdater/", string.Empty)));
			}
			Task task = Provider.Checkout(assetList, CheckoutMode.Both);
			task.Wait();
			IEnumerable<Asset> source = 
				from a in task.assetList
				where (a.state & Asset.States.ReadOnly) == Asset.States.ReadOnly
				select a;
			if (!task.success || source.Any<Asset>())
			{
				string arg_103_0 = "[API Updater] Files cannot be updated (failed to checkout): {0}";
				object[] expr_BA = new object[1];
				expr_BA[0] = (
					from a in source
					select string.Concat(new object[]
					{
						a.fullName,
						" (",
						a.state,
						")"
					})).Aggregate((string acc, string curr) => acc + Environment.NewLine + "\t" + curr);
				Debug.LogErrorFormat(arg_103_0, expr_BA);
				ScriptUpdatingManager.ReportExpectedUpdateFailure();
				return;
			}
			FileUtil.CopyDirectoryRecursive("Temp/ScriptUpdater/", ".", true);
			FileUtil.DeleteFileOrDirectory("Temp/ScriptUpdater/");
		}
 private static void UpdateFilesInVCIfNeeded()
 {
   if (!Provider.enabled)
     return;
   string[] files = Directory.GetFiles("Temp/ScriptUpdater/", "*.*", SearchOption.AllDirectories);
   AssetList assets = new AssetList();
   foreach (string str in files)
     assets.Add(Provider.GetAssetByPath(str.Replace("Temp/ScriptUpdater/", string.Empty)));
   Task task = Provider.Checkout(assets, CheckoutMode.Exact);
   task.Wait();
   IEnumerable<Asset> source = task.assetList.Where<Asset>((Func<Asset, bool>) (a => (a.state & Asset.States.ReadOnly) == Asset.States.ReadOnly));
   if (!task.success || source.Any<Asset>())
   {
     Debug.LogErrorFormat("[API Updater] Files cannot be updated (failed to check out): {0}", (object) source.Select<Asset, string>((Func<Asset, string>) (a => a.fullName + " (" + (object) a.state + ")")).Aggregate<string>((Func<string, string, string>) ((acc, curr) => acc + Environment.NewLine + "\t" + curr)));
     ScriptUpdatingManager.ReportExpectedUpdateFailure();
   }
   else
   {
     FileUtil.CopyDirectoryRecursive("Temp/ScriptUpdater/", ".", true);
     FileUtil.DeleteFileOrDirectory("Temp/ScriptUpdater/");
   }
 }
 public static void OpenIfCheckoutFailed(AssetList assets)
 {
   Object[] objectsOfTypeAll = Resources.FindObjectsOfTypeAll(typeof (WindowCheckoutFailure));
   bool alreadyOpen = (objectsOfTypeAll.Length <= 0 ? (Object) null : (Object) (objectsOfTypeAll[0] as WindowCheckoutFailure)) != (Object) null;
   bool flag = alreadyOpen;
   if (!flag)
   {
     using (List<Asset>.Enumerator enumerator = assets.GetEnumerator())
     {
       while (enumerator.MoveNext())
       {
         if (!enumerator.Current.IsState(Asset.States.CheckedOutLocal))
         {
           flag = true;
           break;
         }
       }
     }
   }
   if (!flag)
     return;
   WindowCheckoutFailure.GetWindow().DoOpen(assets, alreadyOpen);
 }
Ejemplo n.º 16
0
 public static void Open(AssetList assets)
 {
   Task task = Provider.Status(assets);
   task.Wait();
   WindowRevert.GetWindow().DoOpen(task.assetList.Filter(1 != 0, Asset.States.CheckedOutLocal, Asset.States.DeletedLocal, Asset.States.AddedLocal, Asset.States.Missing));
 }
Ejemplo n.º 17
0
        void OnGUI()
        {
            if (styles == null)
            {
                styles            = new Styles();
                styles.toggleSize = styles.toggle.CalcSize(new GUIContent("X"));
            }

            if (!UnityConnect.instance.canBuildWithUPID)
            {
                ShowAlert();
            }
            GUILayout.Space(5);
            GUILayout.BeginHorizontal();
            GUILayout.Space(10);
            GUILayout.BeginVertical();

            string message             = "";
            var    buildSettingsLocked = !AssetDatabase.IsOpenForEdit(kEditorBuildSettingsPath, out message, StatusQueryOptions.UseCachedIfPossible);

            using (new EditorGUI.DisabledScope(buildSettingsLocked))
            {
                ActiveScenesGUI();
                // Clear all and Add Current Scene
                GUILayout.BeginHorizontal();
                if (buildSettingsLocked)
                {
                    GUI.enabled = true;

                    if (Provider.enabled && GUILayout.Button(styles.checkOut))
                    {
                        Asset asset     = Provider.GetAssetByPath(kEditorBuildSettingsPath);
                        var   assetList = new AssetList();
                        assetList.Add(asset);
                        Provider.Checkout(assetList, CheckoutMode.Asset);
                    }
                    GUILayout.Label(message);
                    GUI.enabled = false;
                }
                GUILayout.FlexibleSpace();
                if (GUILayout.Button(styles.addOpenSource))
                {
                    AddOpenScenes();
                }
                GUILayout.EndHorizontal();
            }

            GUILayout.Space(10);

            GUILayout.BeginHorizontal(GUILayout.Height(351));
            ActiveBuildTargetsGUI();
            GUILayout.Space(10);
            GUILayout.BeginVertical();
            ShowBuildTargetSettings();
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();

            GUILayout.Space(10);
            GUILayout.EndVertical();
            GUILayout.Space(10);
            GUILayout.EndHorizontal();
        }
Ejemplo n.º 18
0
        static void Editor_finishedDefaultHeaderGUI(UnityEditor.Editor inspector)
        {
            if (!sIsEnabled)
            {
                return;
            }

            WorkspaceInfo wkInfo = FindWorkspace.InfoForApplicationPath(
                Application.dataPath,
                PlasticApp.PlasticAPI);

            if (wkInfo == null)
            {
                Disable();
                return;
            }

            sAssetSelection.SetActiveInspector(inspector);

            AssetList assetList = ((AssetOperations.IAssetSelection)
                                   sAssetSelection).GetSelectedAssets();

            if (assetList.Count == 0 ||
                string.IsNullOrEmpty(assetList[0].path))
            {
                return;
            }

            string selectionFullPath = Path.GetFullPath(assetList[0].path);

            AssetsOverlays.AssetStatus assetStatus = (assetList.Count > 1) ?
                                                     AssetsOverlays.AssetStatus.None :
                                                     PlasticPlugin.AssetStatusCache.GetStatusForPath(selectionFullPath);

            LockStatusData lockStatusData = PlasticPlugin.AssetStatusCache.GetLockStatusDataForPath(
                selectionFullPath);

            SelectedAssetGroupInfo selectedGroupInfo = SelectedAssetGroupInfo.
                                                       BuildFromAssetList(assetList, PlasticPlugin.AssetStatusCache);

            AssetMenuOperations assetOperations =
                AssetMenuUpdater.GetAvailableMenuOperations(selectedGroupInfo);

            bool guiEnabledBck = GUI.enabled;

            GUI.enabled = true;
            try
            {
                DrawBackRectangle(guiEnabledBck);

                GUILayout.BeginHorizontal();

                DrawStatusLabel(assetStatus, lockStatusData);

                GUILayout.FlexibleSpace();

                DrawButtons(assetList, assetOperations);

                GUILayout.EndHorizontal();
            }
            finally
            {
                GUI.enabled = guiEnabledBck;
            }
        }
Ejemplo n.º 19
0
 private void BeginUnzip(byte[] bytes, int size, string dest, List <string> requestIDs, AssetList assetList)
 {
     if (!this.mMutexAcquired)
     {
         this.mMutex.WaitOne();
         this.mMutexAcquired = true;
     }
     AssetDownloader.UnzipJob unzipJob = new AssetDownloader.UnzipJob();
     unzipJob.Bytes = bytes;
     unzipJob.Size  = size;
     unzipJob.Dest  = dest;
     unzipJob.nodes = new List <AssetDownloader.UnzipJob.Node>();
     using (List <string> .Enumerator enumerator = requestIDs.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             string         current  = enumerator.Current;
             AssetList.Item itemById = assetList.FindItemByID(current);
             unzipJob.nodes.Add(new AssetDownloader.UnzipJob.Node()
             {
                 ID   = current,
                 hash = itemById.Hash
             });
         }
     }
     this.mUnzipJobs.Add(unzipJob);
     if (size <= 0)
     {
         unzipJob.State = AssetDownloader.UnzipJobState.Error;
     }
     this.mMutex.ReleaseMutex();
     this.mMutexAcquired = false;
     this.mUnzipSignal.Set();
 }
Ejemplo n.º 20
0
        private static bool RevertTest(MenuCommand cmd)
        {
            AssetList assetListFromSelection = Provider.GetAssetListFromSelection();

            return(Provider.enabled && Provider.RevertIsValid(assetListFromSelection, RevertMode.Normal));
        }
Ejemplo n.º 21
0
        public void InsertComputer(string assetName, string groupName, string ipAddress, string macAddress)
        {
            LocationsDAO lwDataAccess = new LocationsDAO();
            SettingsDAO  lSettingsDao = new SettingsDAO();

            // We need to get the root item as all of the domains need to be parented to this
            System.Data.DataTable table     = lwDataAccess.GetGroups(new AssetGroup(AssetGroup.GROUPTYPE.domain));
            AssetGroup            rootGroup = new AssetGroup(table.Rows[0], AssetGroup.GROUPTYPE.domain);

            // Get the child domains - as domains are single level we do not need to recurse
            rootGroup.Populate(false, false, true);

            // We'll loop through the domains first and add then to the database recovering their ids so that
            // we only have to do this once.
            // Does this domain already exist?

            AssetGroup childGroup;

            lock (this)
            {
                childGroup = rootGroup.IsChildGroup(groupName);

                // No - add it as a new group both to the database and to the parent
                if (childGroup == null)
                {
                    childGroup          = new AssetGroup(AssetGroup.GROUPTYPE.domain);
                    childGroup.Name     = groupName;
                    childGroup.ParentID = rootGroup.GroupID;
                    childGroup.GroupID  = lwDataAccess.GroupAdd(childGroup);
                    rootGroup.Groups.Add(childGroup);
                }
            }
            string vendor = String.Empty;

            try
            {
                if (macAddress != String.Empty)
                {
//
// CMD IMPORTANT UNCOMMENT THESE LINES
//                    using (System.IO.StreamReader sr = new System.IO.StreamReader(System.IO.Path.Combine(Application.StartupPath, "oui.txt")))
//                    {
//                        string line;
//                        while ((line = sr.ReadLine()) != null)
//                        {
//                            if (line.StartsWith(macAddress.Substring(0, 8)))
//                            {
//                                if (line.Substring(18).ToUpper().StartsWith("APPLE"))
//                                {
//                                   vendor = line.Substring(18);
//                                    break;
//                                }
//                           }
//                        }
//                    }
                }
            }
            catch (FormatException)
            {
            }

            // Now that we have the ID of the group (even if we just added the group) we can now
            // add the asset to the database also.
            Asset newAsset = new Asset();

            newAsset.Name       = assetName;
            newAsset.MACAddress = macAddress.Replace('-', ':');
            newAsset.Make       = vendor;

            if (vendor.ToUpper().StartsWith("APPLE"))
            {
                // add as an Apple Device
                assetTypes.Populate();
                AssetType parentAssetType = assetTypes.FindByName("Apple Devices");
                if (parentAssetType == null)
                {
                    // Now create a child of this asset type
                    parentAssetType           = new AssetType();
                    parentAssetType.Name      = "Apple Devices";
                    parentAssetType.Auditable = false;
                    parentAssetType.Icon      = "apple.png";
                    parentAssetType.ParentID  = 0;
                    parentAssetType.Add();

                    // Update the internal list
                    assetTypes.Add(parentAssetType);
                }

                assetTypes.Populate();
                parentAssetType = assetTypes.FindByName("Apple Devices");

                AssetType childAssetType = assetTypes.FindByName("Apple Device");
                if (childAssetType == null)
                {
                    // Now create a child of this asset type
                    childAssetType           = new AssetType();
                    childAssetType.Name      = "Apple Device";
                    childAssetType.Auditable = false;
                    childAssetType.Icon      = parentAssetType.Icon;
                    childAssetType.ParentID  = parentAssetType.AssetTypeID;
                    childAssetType.Add();

                    // Update the internal list
                    assetTypes.Add(childAssetType);
                }

                assetTypes.Populate();
                childAssetType       = assetTypes.FindByName("Apple Device");
                newAsset.AssetTypeID = childAssetType.AssetTypeID;
            }

            AssetList assetList             = new AssetList(new AssetDAO().GetAssets(0, AssetGroup.GROUPTYPE.userlocation, false), true);
            bool      bUpdateAsset          = true;
            bool      bSNMPAsset            = false;
            bool      bExistingAuditedAsset = false;

            foreach (Asset existingAsset in assetList)
            {
                if ((existingAsset.AgentVersion == "SNMP") && (existingAsset.IPAddress == ipAddress))
                {
                    bSNMPAsset = true;
                    break;
                }

                if ((assetName == existingAsset.Name) && (groupName == existingAsset.Domain))
                {
                    // this asset already exists - only need to check if domain or IP have changed
                    // if they have, send it away to be updated
                    if (existingAsset.IPAddress != ipAddress || existingAsset.DomainID != childGroup.GroupID)
                    {
                        newAsset           = existingAsset;
                        newAsset.IPAddress = newAsset.IPAddress != ipAddress ? ipAddress : newAsset.IPAddress;
                        newAsset.DomainID  = newAsset.DomainID != childGroup.GroupID ? childGroup.GroupID : newAsset.DomainID;
                    }
                    else
                    {
                        // asset exists, nothing has changed so don't process
                        bUpdateAsset = false;
                    }
                    break;
                }
                if (!bSNMPAsset && existingAsset.IPAddress == ipAddress && existingAsset.Domain != newAsset.Domain)
                {
                    bExistingAuditedAsset = true;
                    //check for any asset name change if so update asset with audittrail entry
                    if (existingAsset.Name != assetName)
                    {
                        string strOldValue = existingAsset.Name;
                        newAsset      = existingAsset;
                        newAsset.Name = assetName;
                        newAsset.Update();
                        AuditTrailDAO objAuditTrailDAO = new AuditTrailDAO();
                        // Build a blank AuditTrailEntry
                        AuditTrailEntry ate = CreateAteForAssetNameChange(newAsset);
                        ate.Key      = ate.Key + "|" + "Computer Name";
                        ate.OldValue = strOldValue;
                        ate.NewValue = assetName;
                        objAuditTrailDAO.AuditTrailAdd(ate);
                    }
                }
            }

            if (bUpdateAsset && !bSNMPAsset && !bExistingAuditedAsset)
            {
                newAsset.Domain    = childGroup.Name;
                newAsset.DomainID  = childGroup.GroupID;
                newAsset.IPAddress = ipAddress;

                // Add the asset
                newAsset.Add();

                if (lSettingsDao.GetSettingAsBoolean("AutoScanNetwork", false) && lSettingsDao.GetSettingAsBoolean("AutoScanDeployAgent", false))
                {
                    string scannerPath = System.IO.Path.Combine(Application.StartupPath, "scanners") + "\\auditagent\\default.xml";
                    System.IO.File.Copy(scannerPath, "AuditAgent\\AuditAgent.xml", true);
                    Operation newOperation = new Operation(newAsset.AssetID, Operation.OPERATION.deployagent);
                    newOperation.Add();
                }
            }

            if (!bSNMPAsset)
            {
                Interlocked.Increment(ref _foundCounter);
                FireNetworkDiscoveryUpdate(new DiscoveryUpdateEventArgs(_foundCounter.ToString(), "Computer", _maximumCount, 0));
            }
        }
Ejemplo n.º 22
0
        /// Called from native class VCSAssetMenuHandler as "Assets/Version Control/Check Out (Other)/Only asset file" menu handler
        static void CheckOutAsset(MenuCommand cmd)
        {
            AssetList list = Provider.GetAssetListFromSelection();

            Provider.Checkout(list, CheckoutMode.Asset);
        }
        private void SuiteRunSave(object pubobj) {
            var run = (SuiteRun)pubobj;
            Logger.Log(LogMessage.SeverityType.Debug, run.ToString());

            if(string.IsNullOrEmpty(run.SuiteRef)) {
                Logger.Log(LogMessage.SeverityType.Debug, "Suite Reference is null or empty. Skipping...");
                return;
            }

            var q = new Query(TestSuiteType);
            var term = new FilterTerm(TestSuiteType.GetAttributeDefinition("Reference"));
            term.Equal(run.SuiteRef);
            q.Filter = term;
            var r = Services.Retrieve(q);

            if(r.Assets.Count == 0) {
                Logger.Log(LogMessage.SeverityType.Debug, "No TestSuite found by reference: " + run.SuiteRef);
                return;
            }

            var save = new AssetList();

            foreach(var testsuite in r.Assets) {
                var testrun = Services.New(TestRunType, testsuite.Oid);

                testrun.SetAttributeValue(TestRunType.GetAttributeDefinition("Name"), run.Name);
                testrun.SetAttributeValue(TestRunType.GetAttributeDefinition("Description"), run.Description);
                testrun.SetAttributeValue(TestRunType.GetAttributeDefinition("Date"), run.Stamp);

                testrun.SetAttributeValue(TestRunType.GetAttributeDefinition("Passed"), run.Passed);
                testrun.SetAttributeValue(TestRunType.GetAttributeDefinition("Failed"), run.Failed);
                testrun.SetAttributeValue(TestRunType.GetAttributeDefinition("NotRun"), run.NotRun);

                testrun.SetAttributeValue(TestRunType.GetAttributeDefinition("Elapsed"), run.Elapsed);

                LogSuiteRun(testrun);

                save.Add(testrun);
            }

            Services.Save(save);
        }
 private void openFolder_Click(object sender, EventArgs e)
 {
     AssetList.OpenFolder(this.grid.SelectedItem.Value.ToString());
 }
Ejemplo n.º 25
0
        // Called from native class VCSAssetMenuHandler as "Assets/Version Control/Check Out" menu handler
        static void CheckOut(MenuCommand cmd)
        {
            AssetList selected = Provider.GetAssetListFromSelection();

            Provider.Checkout(selected, CheckoutMode.Both);
        }
Ejemplo n.º 26
0
        //[MenuItem ("CONTEXT/Pending/Unlock", false, 301)]
        static void Unlock(int userData)
        {
            AssetList list = ListControl.FromID(userData).SelectedAssets;

            Provider.Lock(list, false).SetCompletionAction(CompletionAction.UpdatePendingWindow);
        }
Ejemplo n.º 27
0
        /// <summary>
        ///     Upgrade the package, with the understanding that it is located in the Asset database.
        /// </summary>
        private static void UpgradeAssetDatabase()
        {
            // Get a temporary file
            // TODO: This will need to be changed for newer .NET (System.IO.GetTempFileName())
            string tempFile = Path.GetTempFileName();

            // Download the file
            EditorUtility.DisplayProgressBar("GDX", "Downloading Update ...", 0.25f);
            try
            {
#if UNITY_2020_2_OR_NEWER
                using WebClient webClient = new WebClient();
                webClient.DownloadFile(GitHubLatestUri + UpdatePackageDefinition.version + ".tar.gz",
                                       tempFile);
#else
                using (WebClient webClient = new WebClient())
                {
                    webClient.DownloadFile(GitHubLatestUri + UpdatePackageDefinition.version + ".tar.gz",
                                           tempFile);
                }
#endif
            }
            catch (Exception e)
            {
                // We will end up here if the formulated Uri is bad.
                Debug.LogWarning(e.Message);
                return;
            }
            finally
            {
                EditorUtility.ClearProgressBar();
            }

            string tempExtractFolder = Path.Combine(Path.GetTempPath(), PackageProvider.PackageName);

            // Remove previous upgrade folder (if it exists)
            if (Directory.Exists(tempExtractFolder))
            {
                Directory.Delete(tempExtractFolder, true);
            }

            Platform.EnsureFolderHierarchyExists(tempExtractFolder);

            // Extract downloaded tarball to the temp folder
            TarFile.ExtractToDirectory(tempFile, tempExtractFolder, true);

            // Get desired target placement
            string targetPath = Path.GetDirectoryName(LocalPackage.PackageManifestPath);

            // Handle VCS
            if (Provider.enabled && Provider.isActive)
            {
                AssetList checkoutAssets = VersionControl.GetAssetListFromFolder(targetPath);
                Task      checkoutTask   = Provider.Checkout(checkoutAssets, CheckoutMode.Both);
                checkoutTask.Wait();
            }

            // Remove all existing content
            if (targetPath != null)
            {
                try
                {
                    AssetDatabase.StartAssetEditing();
                    Directory.Delete(targetPath, true);

                    // Drop in new content
                    Directory.Move(
                        Path.Combine(tempExtractFolder, "GDX-" + UpdatePackageDefinition.version),
                        targetPath);

                    AssetDatabase.ImportAsset(LocalPackage.PackageAssetPath);
                }
                finally
                {
                    AssetDatabase.StopAssetEditing();
                }
            }
        }
    void UninstallPackage(string manifestPath)
    {
        PackageManifest manifest           = (PackageManifest)JsonUtility.FromJson(File.ReadAllText(manifestPath), typeof(PackageManifest));
        List <string>   directoriesToCheck = new List <string>();
        List <string>   filesToCheck       = manifest.filelistComplete; //Use the full filelist when we don't have any info as to what was installed

        if (manifest.filelistInstalled.Count > 0)
        {
            filesToCheck = new List <string>();
            foreach (PackageManifestEntry entry in manifest.filelistInstalled)
            {
                filesToCheck.Add(entry.filepath);
            }
        }

        foreach (string file in filesToCheck)
        {
            if (file.EndsWith(".meta", StringComparison.InvariantCultureIgnoreCase) == true)
            {
                string fileNoExt = file.Substring(0, file.Length - 5);
                if (Directory.Exists(fileNoExt))
                {
                    explodePath(fileNoExt, ref directoriesToCheck);
                }
            }
            else if (File.Exists(file))
            {
                //Only delete non-meta-files - the .meta files go along with their associated asset anyway
                AssetDatabase.DeleteAsset(file);
            }
        }

        //If we've left any directories, clear any empties
        AssetList     dirMetasToDelete = new AssetList();
        List <string> dirsToDelete     = new List <string>();

        directoriesToCheck.Sort();
        directoriesToCheck.Reverse();
        foreach (string dirToCheck in directoriesToCheck)
        {
            string[]      files = Directory.GetFiles(dirToCheck);
            List <string> dirs  = new List <string>();
            foreach (string dir in Directory.GetDirectories(dirToCheck))
            {
                dirs.Add(FormatPath(dir));
            }
            List <string> dirsLessDeleted = dirs.Except(dirsToDelete).ToList();
            List <string> legitFiles      = new List <string>();
            foreach (string file in files)
            {
                if (file.EndsWith(".meta", StringComparison.InvariantCultureIgnoreCase) == false &&
                    file.EndsWith(".DS_Store", StringComparison.InvariantCultureIgnoreCase) == false)
                {
                    legitFiles.Add(file);
                }
            }

            //Mark a directory for delete if it contains no directories not already marked for delete and no non-meta, non-temp files files
            if (legitFiles.Count == 0 && dirsLessDeleted.Count == 0)
            {
                dirMetasToDelete.Add(new Asset(dirToCheck + ".meta"));
                dirsToDelete.Add(dirToCheck);
            }
        }

        if (Provider.isActive)
        {
            Task statusTask = Provider.Status(dirMetasToDelete);
            statusTask.Wait();
            if (statusTask.success == false)
            {
                throw new Exception("Failed to get VCS status for one or more directory meta files - please see console for details");
            }
            Task deleteTask = Provider.Delete(statusTask.assetList);
            deleteTask.Wait();
            if (deleteTask.success == false)
            {
                throw new Exception("Failed to open for delete one or more directory meta files - please see console for details");
            }
        }
        else
        {
            foreach (Asset dirMeta in dirMetasToDelete)
            {
                File.Delete(dirMeta.fullName);
            }
        }
        foreach (string dir in dirsToDelete)
        {
            FileUtil.DeleteFileOrDirectory(dir);
        }

        //Delete the manifest
        if (Provider.isActive)
        {
            Asset manifestAsset = new Asset(manifestPath);
            Task  statusTask    = Provider.Status(manifestAsset);
            statusTask.Wait();
            if (statusTask.success == false)
            {
                throw new Exception(string.Format("Failed to get VCS status for {0} - please manually remove it from Version Control and your Project Directory", manifestPath));
            }
            Task deleteTask = Provider.Delete(statusTask.assetList);
            deleteTask.Wait();
            if (deleteTask.success == false)
            {
                throw new Exception(string.Format("Failed to open {0} for delete - please manually remove it from Version Control and your Project Directory", manifestPath));
            }
        }
        else
        {
            File.Delete(manifestPath);
        }
        EditorUtility.DisplayDialog("Uninstall Complete", string.Format("Uninstalled package {0}", manifest.title), "OK", string.Empty);
    }
Ejemplo n.º 29
0
        private static bool CheckOutTest(MenuCommand cmd)
        {
            AssetList assetListFromSelection = Provider.GetAssetListFromSelection();

            return(Provider.enabled && Provider.CheckoutIsValid(assetListFromSelection, CheckoutMode.Both));
        }
 public SavedEventArgs(AssetList assetList)
 {
     Assets.AddRange(assetList);
 }
Ejemplo n.º 31
0
        // Called from native class VCSAssetMenuHandler as "Assets/Version Control/Submit..." menu handler
        static void Submit(MenuCommand cmd)
        {
            AssetList selected = Provider.GetAssetListFromSelection();

            WindowChange.Open(selected, true);
        }
 public void WriteHistoricalAsset(AssetList assets, int total, int pagesize, int pagestart) {
     WriteHistoricalAssetList(assets, total, pagesize, pagestart);
 }
Ejemplo n.º 33
0
        // Called from native class VCSAssetMenuHandler as "Assets/Version Control/Check Out (Other)/Only .meta file" menu handler
        static bool CheckOutMetaTest(MenuCommand cmd)
        {
            AssetList selected = Provider.GetAssetListFromSelection();

            return(Provider.enabled && Provider.CheckoutIsValid(selected, CheckoutMode.Meta));
        }
Ejemplo n.º 34
0
 public abstract void LoadAssetsAsyc(AssetList list, FloatRef progress);
Ejemplo n.º 35
0
 public virtual void Export(AssetList asset, string path)
 {
 }
Ejemplo n.º 36
0
 public MainMenu()
 {
     one = 1;
     textures = new DictionaryStringInt1024();
     textTextures = new TextTexture[256];
     textTexturesCount = 0;
     screen = new ScreenMain();
     screen.menu = this;
     loginClient = new LoginClientCi();
     assets = new AssetList();
     assetsLoadProgress = new FloatRef();
 }
Ejemplo n.º 37
0
    private void CompareFileListHashThread(object args)
    {
        AssetDownloader.CompareFileListHashArg compareFileListHashArg = args as AssetDownloader.CompareFileListHashArg;
        if (compareFileListHashArg == null || string.IsNullOrEmpty(compareFileListHashArg.cacheDir) || compareFileListHashArg.nodes == null)
        {
            return;
        }
        string    cacheDir  = compareFileListHashArg.cacheDir;
        AssetList assetList = AssetManager.AssetList;

        if (compareFileListHashArg.dic.Count == 0)
        {
            AssetDownloader.mExistFile.Clear();
            for (int index = 0; index < compareFileListHashArg.nodes.Count; ++index)
            {
                this.mCompareHashMutex.WaitOne();
                this.mCompareHashProgressShared = (float)index / (float)compareFileListHashArg.nodes.Count;
                this.mCompareHashMutex.ReleaseMutex();
                AssetDownloader.CompareFileListHashArg.Node node = compareFileListHashArg.nodes[index];
                if (node != null && !string.IsNullOrEmpty(node.IDStr) && !string.IsNullOrEmpty(node.metaPath))
                {
                    string path     = cacheDir + node.IDStr;
                    string metaPath = node.metaPath;
                    bool   flag1    = File.Exists(path);
                    bool   flag2    = false;
                    if (File.Exists(metaPath))
                    {
                        if (flag1)
                        {
                            if (AssetDownloader.GetFileSize(path) != (long)node.Size)
                            {
                                flag2 = true;
                                goto label_17;
                            }
                        }
                        try
                        {
                            using (FileStream fileStream = new FileStream(metaPath, FileMode.Open))
                            {
                                uint num = new BinaryReader((Stream)fileStream).ReadUInt32();
                                if ((int)node.Hash != (int)num)
                                {
                                    flag2 = true;
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            flag2 = true;
                        }
label_17:
                        if (flag2)
                        {
                            File.Delete(metaPath);
                        }
                    }
                    else
                    {
                        flag2 = true;
                    }
                    if (flag1)
                    {
                        if (flag2)
                        {
                            File.Delete(path);
                        }
                        else
                        {
                            node.Item.Exist = true;
                            AssetDownloader.mExistFile.Add(new AssetDownloader.ExistAssetList(node.Item.ID, assetList.SearchItemIdx(node.Item.ID)));
                        }
                    }
                }
            }
        }
        else
        {
            AssetDownloader.ExistAssetList[] array = AssetDownloader.mExistFile.ToArray();
            for (int index = 0; index < array.Length; ++index)
            {
                this.mCompareHashMutex.WaitOne();
                this.mCompareHashProgressShared = (float)index / (float)array.Length;
                this.mCompareHashMutex.ReleaseMutex();
                bool           flag     = false;
                AssetList.Item itemById = AssetManager.AssetList.FastFindItemByID(array[index].FileID);
                AssetList.Item obj;
                if (itemById != null && compareFileListHashArg.dic.TryGetValue(array[index].FileID, out obj))
                {
                    if (flag | itemById.Size != obj.Size | (int)itemById.Hash != (int)obj.Hash)
                    {
                        AssetDownloader.mExistFile.Remove(array[index]);
                    }
                    else
                    {
                        itemById.Exist = true;
                    }
                }
            }
        }
    }
Ejemplo n.º 38
0
        private static bool LockTest(MenuCommand cmd)
        {
            AssetList assetListFromSelection = Provider.GetAssetListFromSelection();

            return(Provider.enabled && Provider.LockIsValid(assetListFromSelection));
        }
Ejemplo n.º 39
0
    public static void ClearCache()
    {
        string cachePath = AssetDownloader.CachePath;

        if (File.Exists(AssetDownloader.RevisionFilePath))
        {
            File.Delete(AssetDownloader.RevisionFilePath);
        }
        if (File.Exists(AssetDownloader.TxtRevisionFilePath))
        {
            File.Delete(AssetDownloader.TxtRevisionFilePath);
        }
        if (File.Exists(AssetDownloader.AssetListPath))
        {
            File.Delete(AssetDownloader.AssetListPath);
        }
        if (File.Exists(AssetDownloader.TxtAssetListPath))
        {
            File.Delete(AssetDownloader.TxtAssetListPath);
        }
        if (File.Exists(AssetDownloader.ExistFilePath))
        {
            File.Delete(AssetDownloader.ExistFilePath);
        }
        if (File.Exists(AssetDownloader.TxtExistFilePath))
        {
            File.Delete(AssetDownloader.TxtExistFilePath);
        }
        if (Directory.Exists(cachePath))
        {
            Directory.Delete(cachePath, true);
        }
        if (Directory.Exists(AssetDownloader.TextCachePath))
        {
            Directory.Delete(AssetDownloader.TextCachePath, true);
        }
        if (!AssetManager.HasInstance)
        {
            return;
        }
        AssetList assetList = AssetManager.AssetList;

        if (assetList != null)
        {
            AssetList.Item[] assetsOriginal = assetList.Assets_Original;
            for (int index = assetsOriginal.Length - 1; index >= 0; --index)
            {
                assetsOriginal[index].Exist = false;
            }
        }
        AssetList txtAssetList = AssetManager.TxtAssetList;

        if (txtAssetList == null)
        {
            return;
        }
        AssetList.Item[] assetsOriginal1 = txtAssetList.Assets_Original;
        for (int index = assetsOriginal1.Length - 1; index >= 0; --index)
        {
            assetsOriginal1[index].Exist = false;
        }
    }
Ejemplo n.º 40
0
 public static void Open(AssetList list, bool submit)
 {
     Open(null, list, submit);
 }
Ejemplo n.º 41
0
        // Called from native class VCSAssetMenuHandler as "Assets/Version Control/Mark Add" menu handler
        static void MarkAdd(MenuCommand cmd)
        {
            AssetList list = Provider.GetAssetListFromSelection();

            Provider.Add(list, true).SetCompletionAction(CompletionAction.UpdatePendingWindow);
        }
    void InstallPackage(string packageFilePath)
    {
        PackageManifest manifest = ExtractPackageManifest(packageFilePath);
        //File.WriteAllText("testoutput.json", JsonUtility.ToJson(manifest, /*prettyPrint=*/true));
        List <PackageManifest> installedPackages     = ReadInstalledPackageManifests();
        List <string>          overlappingPackages   = new List <string>();
        List <string>          overlappingLooseFiles = new List <string>();

        ListOverlappingPackagesAndFiles(installedPackages, manifest, ref overlappingPackages, ref overlappingLooseFiles);
        if (overlappingPackages.Any(x => x == manifest.title))
        {
            if (EditorUtility.DisplayDialog("Warning", String.Format("Package {0} is already present in your installed packages list - the manifest will be updated with any changes you make", manifest.title), "OK", "Cancel") == false)
            {
                return;
            }
            overlappingPackages.Remove(manifest.title);
        }
        if (overlappingPackages.Count > 0)
        {
            foreach (string overlappingPackage in overlappingPackages)
            {
                Debug.LogErrorFormat("Package {0} overlaps with the contents of package {1}", overlappingPackage, packageFilePath);
            }
            if (EditorUtility.DisplayDialog("Error", "The requested package overlaps one or more installed packages (see console for list) - you should uninstall these first!", "Install Anyway", "Cancel") == false)
            {
                return;
            }
        }
        if (overlappingLooseFiles.Count > 0)
        {
            foreach (string overlappingFile in overlappingLooseFiles)
            {
                Debug.LogWarningFormat("File {0} will be replaced during package installation", overlappingFile);
            }
            if (EditorUtility.DisplayDialog("Warning", "The requested package will replace files in the project (see console for list). Proceed?", "Install Anyway", "Cancel") == false)
            {
                return;
            }
        }

        //From this point we don't care if a file being overwritten by this package is from another package or untracked
        //We also can't tell, with the current state of the API, what files the user is going to elect to install from the package
        //So if they're tracked in VCS, they all need to be opened for edit before installation.
        //New files are automatically added by Unity - we may need to re-add them though if they've been marked for delete

        toReAdd = new AssetList();
        if (Provider.isActive)
        {
            AssetList All = new AssetList();
            foreach (string packageFile in manifest.filelistComplete)
            {
                All.Add(new Asset(packageFile));
            }
            Task statusTask = Provider.Status(All);
            statusTask.Wait();
            if (statusTask.success == false)
            {
                throw new Exception("Failed to query VCS status of files in the package");
            }
            AssetList toOpen  = new AssetList();
            bool      bailOut = false;
            foreach (Asset asset in statusTask.assetList)
            {
                //NO COMMIT - Test what happens if deleted local or remote
                if (asset.IsOneOfStates(new Asset.States[] { Asset.States.DeletedLocal, Asset.States.DeletedRemote }))
                {
                    toReAdd.Add(asset);
                }
                else if (asset.IsOneOfStates(new Asset.States[] { Asset.States.AddedLocal, Asset.States.CheckedOutLocal }) == false)
                {
                    toOpen.Add(asset);
                }
                if (asset.IsOneOfStates(new Asset.States[] { Asset.States.LockedRemote }))
                {
                    bailOut = true;
                    Debug.LogError(string.Format("File {0} cannot be opened because it is locked remotely", asset.fullName));
                }
            }
            if (bailOut)
            {
                //TODO: Message Box instead?
                throw new Exception("There was one or more fatal Version Control issues when installing your package - see console for details");
            }

            if (toOpen.Count > 0)
            {
                Task openTask = Provider.Checkout(toOpen, CheckoutMode.Exact);
                openTask.Wait();
                if (openTask.success == false)
                {
                    throw new Exception("Failed to open files for edit before installing package. Please see console for details from the VCS plugin.");
                }
            }
        }

        //Install the package after serialising out the information we need to finish the installation.
        //Inconveniently for this script, asset import can cause a domain reload, meaning that the state of this script is discarded and
        //we need to resume installation later with some information we only have right now.
        //If no domain reload is needed, we can finalise installation 'seamlessly' from these callbacks
        manifestToInstall = manifest;
        AddCallbacks();
        AssetDatabase.ImportPackage(packageFilePath, true);
    }
Ejemplo n.º 43
0
 public abstract void LoadAssetsAsyc(AssetList list, FloatRef progress);
Ejemplo n.º 44
0
        // Called from native class VCSAssetMenuHandler as "Assets/Version Control/Revert Unchanged" menu handler
        static bool RevertUnchangedTest(MenuCommand cmd)
        {
            AssetList selected = Provider.GetAssetListFromSelection();

            return(Provider.enabled && Provider.RevertIsValid(selected, RevertMode.Normal));
        }
 private void OnBeforeSave(AssetList assetList)
 {
     if (BeforeSave != null)
         BeforeSave(this, new SavedEventArgs(assetList));
 }
Ejemplo n.º 46
0
        // Called from native class VCSAssetMenuHandler as "Assets/Version Control/Diff Against Head..." menu handler
        static void Resolve(MenuCommand cmd)
        {
            AssetList selected = Provider.GetAssetListFromSelection();

            WindowResolve.Open(selected);
        }
 public void Save(AssetList assetList)
 {
     OnBeforeSave(assetList);
     _wrapped.Save(assetList);
 }
Ejemplo n.º 48
0
        // Called from native class VCSAssetMenuHandler as "Assets/Version Control/Unlock" menu handler
        static bool UnlockTest(MenuCommand cmd)
        {
            AssetList selected = Provider.GetAssetListFromSelection();

            return(Provider.enabled && Provider.UnlockIsValid(selected));
        }
        public void WriteHistoricalAttribute(AssetList assets, IAttributeDefinition attribdef, int total, int pagesize, int pagestart) {
            writer.WriteStartElement("History");

            if(total > -1) {
                writer.WriteAttributeString("total", total.ToString());
            }

            if(pagesize > -1) {
                writer.WriteAttributeString("pageSize", pagesize.ToString());
            }

            if(pagestart > -1) {
                writer.WriteAttributeString("pageStart", pagestart.ToString());
            }

            foreach(var asset in assets) {
                WriteAttribute(asset.GetAttribute(attribdef));
            }

            writer.WriteEndElement();
        }
Ejemplo n.º 50
0
        // Called from native class VCSAssetMenuHandler as "Assets/Version Control/Get Latest" menu handler
        static void GetLatest(MenuCommand cmd)
        {
            AssetList list = Provider.GetAssetListFromSelection();

            Provider.GetLatest(list).SetCompletionAction(CompletionAction.UpdatePendingWindow);
        }
		public void CreateWorkitem()
		{
			const string type = "Story";
			const string title = "Story Name";
			const string description = "Story description";
			const string projectToken = "Scope:0";
			const string externalFieldName = "FieldName";
			const string externalId = "externalId";
			const string externalSystemName = "External System Name";
			const string priorityId = "Priority:12";
			const string owners = "Onwer_1,Owners_2";

			var memberAssetType = new TestAssetType("Member");
			var projectAssetType = new TestAssetType("Project");
			var priorityAssetType = new TestAssetType("Priority");

			var storyAttributes = new Dictionary<string, IAttributeDefinition> {
                {"Owners", new TestAttributeDefinition(memberAssetType, true, false, false)},
            };
			var storyAssetType = new TestAssetType("Story", storyAttributes);

			var source = TestValueId.Create(externalSystemName, "Source", 333);
			var sources = new PropertyValues(new List<ValueId> { source });
			var assetStory = new Asset(storyAssetType);
			var ownersAssets = new AssetList {
                new Asset(new TestOid(new TestAssetType("Member"), 1, null)),
                new Asset(new TestOid(new TestAssetType("Member"), 2, null)),
            };
			var queryResult = new QueryResult(ownersAssets, 2, null);

			Expect.Call(_mockMetaModel.GetAssetType("Scope")).Return(projectAssetType);
			Expect.Call(_mockQueryBuilder.QueryPropertyValues(VersionOneProcessor.WorkitemSourceType)).Return(sources);
			Expect.Call(_mockMetaModel.GetAssetType("Story")).Return(storyAssetType);
			Expect.Call(_mockServices.New(storyAssetType, Oid.Null)).Return(assetStory);
			Expect.Call(_mockMetaModel.GetAssetType("Member")).Return(memberAssetType);
			Expect.Call(_mockServices.Retrieve(null)).IgnoreArguments().Return(queryResult);
			Expect.Call(_mockMetaModel.GetAssetType("Priority")).Return(priorityAssetType);
			Expect.Call(() => _mockServices.Save(assetStory));

			Expect.Call(_mockMetaModel.GetAssetType("Story")).Return(storyAssetType);
			Expect.Call(_mockQueryBuilder.Query("Story", new FilterTerm(null))).IgnoreArguments().Return(new AssetList { assetStory });
			Expect.Call(_mockQueryBuilder.ListPropertyValues).Return(null);
			Expect.Call(_mockQueryBuilder.TypeResolver).Return(null);

			_repository.ReplayAll();

			_processor.CreateWorkitem(type, title, description, projectToken,
				externalFieldName, externalId, externalSystemName,
				priorityId, owners);
			_repository.VerifyAll();
		}
Ejemplo n.º 52
0
        // Called from native class VCSAssetMenuHandler as "Assets/Version Control/Unlock" menu handler
        static void Unlock(MenuCommand cmd)
        {
            AssetList list = Provider.GetAssetListFromSelection();

            Provider.Lock(list, false).SetCompletionAction(CompletionAction.UpdatePendingWindow);
        }
Ejemplo n.º 53
0
 private void OnSubmitGUI()
 {
     if (this.submitResultCode != 0x100)
     {
         GUI.enabled = false;
     }
     Event current = Event.current;
     if (current.isKey && (current.keyCode == KeyCode.Escape))
     {
         base.Close();
     }
     GUILayout.Label("Description", EditorStyles.boldLabel, new GUILayoutOption[0]);
     if ((this.taskStatus != null) && (this.taskStatus.resultCode != 0))
     {
         this.assetList = this.taskStatus.assetList.Filter(true, new Asset.States[] { Asset.States.CheckedOutLocal });
         this.RefreshList();
         this.taskStatus = null;
     }
     else if ((this.taskDesc != null) && (this.taskDesc.resultCode != 0))
     {
         this.description = (this.taskDesc.text.Length <= 0) ? "" : this.taskDesc.text;
         if (this.description.Trim() == "<enter description here>")
         {
             this.description = string.Empty;
         }
         this.taskDesc = null;
     }
     else if ((this.taskStat != null) && (this.taskStat.resultCode != 0))
     {
         this.assetList = this.taskStat.assetList;
         this.RefreshList();
         this.taskStat = null;
     }
     Task task = ((this.taskStatus == null) || (this.taskStatus.resultCode != 0)) ? (((this.taskDesc == null) || (this.taskDesc.resultCode != 0)) ? (((this.taskStat == null) || (this.taskStat.resultCode != 0)) ? this.taskSubmit : this.taskStat) : this.taskDesc) : this.taskStatus;
     GUI.enabled = ((this.taskDesc == null) || (this.taskDesc.resultCode != 0)) && (this.submitResultCode == 0x100);
     GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Height(150f) };
     this.description = EditorGUILayout.TextArea(this.description, options).Trim();
     if (this.m_TextAreaControlID == 0)
     {
         this.m_TextAreaControlID = EditorGUIUtility.s_LastControlID;
     }
     if (this.m_TextAreaControlID != 0)
     {
         GUIUtility.keyboardControl = this.m_TextAreaControlID;
         EditorGUIUtility.editingTextField = true;
     }
     GUI.enabled = true;
     GUILayout.Label("Files", EditorStyles.boldLabel, new GUILayoutOption[0]);
     GUILayout.FlexibleSpace();
     Rect screenRect = new Rect(6f, 206f, base.position.width - 12f, base.position.height - 248f);
     GUILayout.BeginArea(screenRect);
     GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true) };
     GUILayout.Box("", optionArray2);
     GUILayout.EndArea();
     this.submitList.OnGUI(new Rect(screenRect.x + 2f, screenRect.y + 2f, screenRect.width - 4f, screenRect.height - 4f), true);
     GUILayout.FlexibleSpace();
     GUILayout.BeginHorizontal(new GUILayoutOption[0]);
     if (this.submitResultCode == 0x100)
     {
         if (task != null)
         {
             GUIContent content = GUIContent.Temp("Getting info");
             content.image = WindowPending.StatusWheel.image;
             GUILayout.Label(content, new GUILayoutOption[0]);
             content.image = null;
         }
         GUILayout.FlexibleSpace();
         if (GUILayout.Button("Cancel", new GUILayoutOption[0]))
         {
             this.ResetAndClose();
         }
         GUI.enabled = (task == null) && !string.IsNullOrEmpty(this.description);
         bool flag2 = (current.isKey && current.shift) && (current.keyCode == KeyCode.Return);
         bool flag3 = flag2 && !this.allowSubmit;
         if (Provider.hasChangelistSupport && (GUILayout.Button("Save", new GUILayoutOption[0]) || flag3))
         {
             this.Save(false);
         }
         if (this.allowSubmit)
         {
             bool enabled = GUI.enabled;
             GUI.enabled = ((this.assetList != null) && (this.assetList.Count > 0)) && !string.IsNullOrEmpty(this.description);
             if (GUILayout.Button("Submit", new GUILayoutOption[0]) || flag2)
             {
                 this.Save(true);
             }
             GUI.enabled = enabled;
         }
     }
     else
     {
         bool flag5 = (this.submitResultCode & 1) != 0;
         GUI.enabled = flag5;
         string text = "";
         if (flag5)
         {
             text = "Finished successfully";
         }
         else if (task != null)
         {
             GUILayout.Label(WindowPending.StatusWheel, new GUILayoutOption[0]);
             text = task.progressMessage;
             if (text.Length == 0)
             {
                 text = "Running...";
             }
         }
         GUILayout.Label(text, new GUILayoutOption[0]);
         GUILayout.FlexibleSpace();
         if (GUILayout.Button("Close", new GUILayoutOption[0]))
         {
             this.ResetAndClose();
         }
     }
     GUI.enabled = true;
     GUILayout.EndHorizontal();
     GUILayout.Space(12f);
     if (task != null)
     {
         base.Repaint();
     }
 }
Ejemplo n.º 54
0
        // Called from native class VCSAssetMenuHandler as "Assets/Version Control/Diff/Against Head..." menu handler
        static void DiffHead(MenuCommand cmd)
        {
            AssetList selected = Provider.GetAssetListFromSelection();

            Provider.DiffHead(selected, false);
        }
Ejemplo n.º 55
0
 private void OnUnaddedFilesGUI()
 {
     AssetList assets = new AssetList();
     string text = "";
     foreach (Asset asset in this.assetList)
     {
         if ((!asset.IsState(Asset.States.OutOfSync) && !asset.IsState(Asset.States.Synced)) && !asset.IsState(Asset.States.AddedLocal))
         {
             text = text + asset.prettyPath + "\n";
             assets.Add(asset);
         }
     }
     GUILayout.Label("Files to add", EditorStyles.boldLabel, new GUILayoutOption[0]);
     GUILayout.Label("Some additional files need to be added:", new GUILayoutOption[0]);
     GUI.enabled = false;
     GUILayout.TextArea(text, new GUILayoutOption[0]);
     GUI.enabled = true;
     GUILayout.BeginHorizontal(new GUILayoutOption[0]);
     GUILayout.FlexibleSpace();
     if (GUILayout.Button("Add files", new GUILayoutOption[0]))
     {
         this.taskAdd = Provider.Add(assets, false);
         this.taskAdd.SetCompletionAction(CompletionAction.OnAddedChangeWindow);
     }
     if (GUILayout.Button("Abort", new GUILayoutOption[0]))
     {
         this.ResetAndClose();
     }
     GUILayout.EndHorizontal();
 }
Ejemplo n.º 56
0
        // Called from native class VCSAssetMenuHandler as "Assets/Version Control/Diff/Against Head with .meta..." menu handler
        static bool DiffHeadWithMetaTest(MenuCommand cmd)
        {
            AssetList selected = Provider.GetAssetListFromSelection();

            return(Provider.enabled && Provider.DiffIsValid(selected));
        }
Ejemplo n.º 57
0
 public static void Open(ChangeSet change, AssetList assets, bool submit)
 {
     WindowChange window = EditorWindow.GetWindow<WindowChange>(true, "Version Control Changeset");
     window.allowSubmit = submit;
     window.DoOpen(change, assets);
 }
Ejemplo n.º 58
0
        // Called from native class VCSAssetMenuHandler as "Assets/Version Control/Diff/Against Head with .meta..." menu handler
        static void DiffHeadWithMeta(MenuCommand cmd)
        {
            AssetList selected = Provider.GetAssetListFromSelection();

            Provider.DiffHead(selected, true);
        }
Ejemplo n.º 59
0
 private void DoOpen(AssetList revert)
 {
   this.assetList = revert;
   this.RefreshList();
 }
Ejemplo n.º 60
0
        // Called from native class VCSAssetMenuHandler as "Assets/Version Control/Submit..." menu handler
        static bool SubmitTest(MenuCommand cmd)
        {
            AssetList selected = Provider.GetAssetListFromSelection();

            return(Provider.enabled && Provider.SubmitIsValid(null, selected));
        }