kOS.Volume.AppendToFile C# (CSharp) Method

AppendToFile() public method

public AppendToFile ( string name, string str ) : void
name string
str string
return void
        public virtual void AppendToFile(string name, string str)
        {
            File file = GetByName(name);

            if (file == null)
            {
                file = new File(name);
            }

            file.Add(str);

            SaveFile(file);
        }

Usage Example

Ejemplo n.º 1
0
        public override void Evaluate()
        {
            // Todo: let the user specify a volume "LOG something TO file ON volume"
            Volume targetVolume = SelectedVolume;

            // If the archive is out of reach, the signal is lost in space.
            if (!targetVolume.CheckRange())
            {
                State = ExecutionState.DONE;
                return;
            }

            String     targetFile = RegexMatch.Groups[2].Value.Trim();
            Expression e          = new Expression(RegexMatch.Groups[1].Value, ParentContext);

            if (e.IsNull())
            {
                State = ExecutionState.DONE;
            }
            else
            {
                targetVolume.AppendToFile(targetFile, e.ToString());
                State = ExecutionState.DONE;
            }
        }
All Usage Examples Of kOS.Volume::AppendToFile