コード例 #1
0
 public override void CopyTo(FileOperation target)
 {
     ((LuaInsertOperation)target).LuaInsertTarget = LuaInsertTarget;
 }
コード例 #2
0
 public override void CopyTo(FileOperation target)
 {
     ((MessageOperation)target).Flag    = Flag;
     ((MessageOperation)target).Content = Content;
 }
コード例 #3
0
ファイル: LuaEventOperation.cs プロジェクト: NoitaOmmel/Ommel
 public override void CopyTo(FileOperation target)
 {
     ((LuaEventOperation)target).Event = Event;
 }
コード例 #4
0
 private void ExecuteOperation(Mod mod, FileOperation op)
 {
     op.Execute(this, mod);
 }
コード例 #5
0
        public override void FillInChild(XmlNode node)
        {
            if (!(node is XmlElement))
            {
                return;
            }

            var child = (XmlElement)node;

            if (child.Name == "SourceFiles")
            {
                SourceFiles = new List <string>();

                for (var i = 0; i < child.ChildNodes.Count; i++)
                {
                    var innerchild = child.ChildNodes[i] as XmlElement;
                    if (innerchild == null)
                    {
                        continue;
                    }

                    if (innerchild.Name != "SourceFile")
                    {
                        throw new Exception("Children of SourceFiles must be SourceFile elements");
                    }

                    if (innerchild.ChildNodes.Count < 1 || !(innerchild.ChildNodes[0] is XmlText))
                    {
                        throw new Exception("SourceFile elements must have a text child");
                    }

                    SourceFiles.Add(((XmlText)innerchild.ChildNodes[0]).Value);
                }
            }
            else if (child.Name == "SourcePattern")
            {
                if (child.ChildNodes.Count < 1 || !(child.ChildNodes[0] is XmlText))
                {
                    throw new Exception("SourcePattern elements must have a text child");
                }

                SourcePattern = ((XmlText)child.ChildNodes[0]).Value.Trim();
            }
            else if (child.Name == "TargetFiles")
            {
                TargetFiles = new List <string>();

                for (var i = 0; i < child.ChildNodes.Count; i++)
                {
                    var innerchild = child.ChildNodes[i] as XmlElement;
                    if (innerchild == null)
                    {
                        continue;
                    }

                    if (innerchild.Name != "TargetFile")
                    {
                        throw new Exception("Children of TargetFiles must be TargetFile elements");
                    }

                    if (innerchild.ChildNodes.Count < 1 || !(innerchild.ChildNodes[0] is XmlText))
                    {
                        throw new Exception("TargetFile elements must have a text child");
                    }

                    TargetFiles.Add(((XmlText)innerchild.ChildNodes[0]).Value);
                }
            }
            else if (child.Name == "TargetExceptionRules")
            {
                TargetExceptionRules = new List <Regex>();

                for (var i = 0; i < child.ChildNodes.Count; i++)
                {
                    var innerchild = child.ChildNodes[i] as XmlElement;
                    if (innerchild == null)
                    {
                        continue;
                    }

                    if (innerchild.Name != "TargetExceptionRule")
                    {
                        throw new Exception("Children of TargetExceptionRules must be TargetExceptionRule elements");
                    }

                    if (innerchild.ChildNodes.Count < 1 || !(innerchild.ChildNodes[0] is XmlText))
                    {
                        throw new Exception("TargetExceptionRule elements must have a text child");
                    }

                    TargetExceptionRules.Add(new Regex(((XmlText)innerchild.ChildNodes[0]).Value));
                }
            }
            else if (child.Name == "TargetPattern")
            {
                if (child.ChildNodes.Count < 1 || !(child.ChildNodes[0] is XmlText))
                {
                    throw new Exception("TargetPattern elements must have a text child");
                }

                TargetPattern = ((XmlText)child.ChildNodes[0]).Value.Trim();
            }
            else if (child.Name == "Operations")
            {
                for (var i = 0; i < child.ChildNodes.Count; i++)
                {
                    var innerchild = child.ChildNodes[i] as XmlElement;
                    if (innerchild == null)
                    {
                        continue;
                    }

                    Type op_type;
                    if (!FileOperation.FileOperationsByKey.TryGetValue(innerchild.Name, out op_type))
                    {
                        throw new Exception($"Unknown file operation: {innerchild.Name}");
                    }

                    var op = FileOperation.CreateFileOperation <FileOperation>(innerchild.Name, op_type);
                    op.FillIn(innerchild as XmlElement);

                    Operations.Add(op);
                }
            }
            else if (child.Name == "Mode")
            {
                if (child.ChildNodes.Count < 1 || !(child.ChildNodes[0] is XmlText))
                {
                    throw new Exception("Mode elements must have a text child");
                }

                Mode = (BulkMode)Enum.Parse(typeof(BulkMode), ((XmlText)child.ChildNodes[0]).Value.Trim(), true);
            }
        }
コード例 #6
0
 public override void CopyTo(FileOperation target)
 {
     ((TextInsertOperation)target).Line   = Line;
     ((TextInsertOperation)target).Offset = Offset;
 }