public override void Trigger(object os_obj) { OS os = (OS)os_obj; if ((double)this.Delay <= 0.0) { Computer computer = Programs.getComputer(os, this.TargetComp); Folder folderAtPath = Programs.getFolderAtPath(this.TargetFolderpath, os, computer.files.root, true); if (folderAtPath == null) { return; } FileEntry fileEntry = folderAtPath.searchForFile(this.TargetFilename); fileEntry.data = fileEntry.data + "\n" + this.DataToAdd; } else { Computer computer = Programs.getComputer(os, this.DelayHost); if (computer == null) { throw new NullReferenceException("Computer " + (object)computer + " could not be found as DelayHost for Function"); } float delay = this.Delay; this.Delay = -1f; DelayableActionSystem.FindDelayableActionSystemOnComputer(computer).AddAction((SerializableAction)this, delay); } }
public override void Trigger(object os_obj) { OS os = (OS)os_obj; Computer computer = Programs.getComputer(os, this.TargetComp); if (computer == null) { throw new NullReferenceException("Computer " + this.TargetComp + " could not be found for AddAssetFunction, adding file: " + this.FileName); } Folder folderAtPath = Programs.getFolderAtPath(this.TargetFolderpath, os, computer.files.root, true); if (folderAtPath == null) { throw new NullReferenceException("Folder " + this.TargetFolderpath + " could not be found for AddAssetFunction, adding file: " + this.FileName); } FileEntry fileEntry = new FileEntry(ComputerLoader.filter(this.FileContents), this.FileName); folderAtPath.files.Add(fileEntry); }
public override void Trigger(object os_obj) { OS os = (OS)os_obj; Computer computer1 = Programs.getComputer(os, this.DestComp); Computer computer2 = Programs.getComputer(os, this.SourceComp); if (computer1 == null) { throw new NullReferenceException("Destination Computer " + (object)computer1 + " could not be found for SACopyAsset, copying file: " + this.SourceFileName); } if (computer2 == null) { throw new NullReferenceException("Source Computer " + (object)computer2 + " could not be found for SACopyAsset, copying file: " + this.SourceFileName); } Folder folderAtPath = Programs.getFolderAtPath(this.SourceFilePath, os, computer2.files.root, true); if (folderAtPath == null) { throw new NullReferenceException("Source Folder " + this.SourceFilePath + " could not be found for SACopyAsset, adding file: " + this.SourceFileName); } Folder folderFromPath = computer1.getFolderFromPath(this.DestFilePath, true); if (folderFromPath == null) { return; } FileEntry fileEntry1 = folderAtPath.searchForFile(this.SourceFileName); if (fileEntry1 == null) { return; } FileEntry fileEntry2 = new FileEntry(fileEntry1.data, this.DestFileName); folderFromPath.files.Add(fileEntry2); }