Ejemplo n.º 1
0
        public xInfoElement()
        {
            g_Singleton = this;
            InitializeComponent();

            eCArchiveFile E = new eCArchiveFile(FileManager.GetFile("compiled_infos.bin"));
            E.Position = 14;
            eCDocArchive D = new eCDocArchive(E);

            foreach (bCAccessorPropertyObject o in D)
            {
                InfoWrapper w = new InfoWrapper(o.Class as gCInfo);
                m_pData.Add(w.Name.pString, w);
            }

            System.IO.DirectoryInfo m = new System.IO.DirectoryInfo(FileManager.g_pGamepath + "data\\raw\\infos");
            if (m.Exists)
            {
                foreach (System.IO.FileInfo fi in m.GetFiles("*.xinf"))
                {
                    InfoWrapper w = InfoWrapper.FromXml(System.Xml.Linq.XElement.Load(fi.FullName));
                    m_pData.Add(w.Name.pString, w);
                }
            }

            listView1.ItemsSource = m_pData.Values;
            setElement(m_pData["PANKRATZX2_00647"], 1, 0);
        }
Ejemplo n.º 2
0
 public gCInfoCommandAddInfoSystemEndScript_Wrapper(InfoWrapper P)
     : base(P)
 {
     Native = new bCAccessorPropertyObject(new gCInfoCommandAddInfoSystemEndScript(), "gCInfoCommandAddInfoSystemEndScript");
     Native.Properties.addProperty("Script", "eCScriptProxyScript", new eCScriptProxyScript());
     Native.Properties.addProperty("Self", "bCString", new bCString());
     Native.Properties.addProperty("Other", "bCString", new bCString());
     Native.Properties.addProperty("Param", "int", new Int32());
 }
Ejemplo n.º 3
0
        public static InfoCommandWrapper getWrapper(bCAccessorPropertyObject a, InfoWrapper P)
        {
            string NAME = a.ClassName;
            Type T = Assembly.GetCallingAssembly().GetType(typeof(PropertySetWrapper).Namespace + "." + NAME + "_Wrapper");
            if (T == null)
            {
                if (!done.Contains(NAME))
                {
                    done.Add(NAME);
                    const string n = "gInfoWrapper.cs";
                    string b = BuildClassFromAccessor(a.ClassName, "InfoCommandWrapper", a);
                    string c = File.Exists(n) ? File.ReadAllText(n) : "";
                    File.WriteAllText(n, c + b);

                    string n2 = "gInfo.cs", nl = Environment.NewLine;
                    string b2 = "public class " + NAME + " : classData" + nl + "{" + nl + "short Version;" + nl + nl + "public override void deSerialize(IFile a_File)" + nl +
                        "{" + nl + "Version = a_File.Read<short>();" + nl + "}" + nl + nl + "public override void Serialize(IFile a_File)" + nl + "{" + nl + "a_File.Write<short>(Version);"
                        + nl + "}" + nl + nl + "public override int Size" + nl + "{" + nl + "get" + nl + "{" + nl + "return 2;" + nl + "}" + nl + "}" + nl + "}";
                    string c2 = File.Exists(n2) ? File.ReadAllText(n2) : "";
                    File.WriteAllText(n2, c2 + b2);
                }
                return null;
            }
            else
            {
                object o2 = Activator.CreateInstance(T, a, P);
                return o2 as InfoCommandWrapper;
            }
        }
Ejemplo n.º 4
0
 void setElement(InfoWrapper W, int parent, int children)
 {
     BidirectionalGraph<object, IEdge<object>> L = new BidirectionalGraph<object, IEdge<object>>();
     L.AddVertex(W);
     if (parent != 0)
     {
         InfoWrapper c = W;
         while (c.Parent.pString != "")
         {
             InfoWrapper p = m_pData[W.Parent.pString];
             if (!L.ContainsVertex(p))
                 L.AddVertex(p);
             L.AddEdge(new Edge<object>(p, c));
             if (parent == 1 || p.Name.pString == c.Name.pString)
                 break;
             c = p;
         }
     }
     if (children != 0)
     {
         Action<InfoWrapper> T = null;
         T = (p) =>
         {
             foreach (InfoWrapper a in m_pData.Values)
                 if (a.Parent.pString == p.Name.pString)
                 {
                     if (!L.AddVertex(a))
                         L.AddVertex(a);
                     L.AddEdge(new Edge<object>(p, a));
                     if (children != 1)
                         T(a);
                 }
         };
         T(W);
     }
     graphLayout1.Graph = L;
     foreach (var v in graphLayout1.Children)
     {
         if (v is VertexControl)
             (v as VertexControl).PreviewMouseDoubleClick += graphLayout1_MouseDown;
     }
     (windowsFormsHost2.Child as System.Windows.Forms.PropertyGrid).SelectedObject = W;
     addWrapper(W);
 }
Ejemplo n.º 5
0
 private void button2_Click(object sender, RoutedEventArgs e)
 {
     NewInfoForm F = new NewInfoForm();
     if (F.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         InfoWrapper w = new InfoWrapper(F.InfoName, F.InfoOwner, F.InfoType, F.InfoCndType);
         m_pData.Add(w.Name, w);
         saveWrapper(w);
     }
 }
Ejemplo n.º 6
0
 public void setCmd(InfoCommandWrapper a, InfoWrapper W)
 {
     addWrapper(W);
     (windowsFormsHost1.Child as System.Windows.Forms.PropertyGrid).SelectedObject = a;
     (windowsFormsHost2.Child as System.Windows.Forms.PropertyGrid).SelectedObject = W;
 }
Ejemplo n.º 7
0
 public gCInfoCommandRemoveNPC_Wrapper(bCAccessorPropertyObject O, InfoWrapper P)
     : base(O, P)
 {
 }
Ejemplo n.º 8
0
 public gCInfoCommandPickPocket_Wrapper(InfoWrapper P)
     : base(P)
 {
     Native = new bCAccessorPropertyObject(new gCInfoCommandPickPocket(), "gCInfoCommandPickPocket");
     Native.Properties.addProperty("Difficulty", "long", new Int32());
     Native.Properties.addProperty("Speaker", "bCString", new bCString());
     Native.Properties.addProperty("Listener", "bCString", new bCString());
     Native.Properties.addProperty("Text", "gCInfoLocString", new gCInfoLocString());
     Native.Properties.addProperty("SVMID", "bCString", new bCString());
     Native.Properties.addProperty("SVMText", "gCInfoLocString", new gCInfoLocString());
     Native.Properties.addProperty("Gesture", "bTPropertyContainer<enum gEInfoGesture>", new gEInfoGesture());
 }
Ejemplo n.º 9
0
 public gCInfoCommandInfoWait_Wrapper(InfoWrapper P)
     : base(P)
 {
     Native = new bCAccessorPropertyObject(new gCInfoCommandInfoWait(), "gCInfoCommandInfoWait");
     Native.Properties.addProperty("Time", "long", new Int32());
 }
Ejemplo n.º 10
0
 public static XElement ToXml(InfoWrapper i)
 {
     Action<bCAccessorPropertyObject, XElement> A = (x,n) =>
     {
         n.SetAttributeValue("ClassName", x.ClassName);
         foreach (bCProperty p in x.Properties)
         {
             switch (p.PropertyType)
             {
                 case "eCTemplateEntityProxy":
                     eCTemplateEntityProxy t = (eCTemplateEntityProxy)p.Object;
                     XElement n2 = new XElement(p.PropertyName);
                     n2.SetAttributeValue("Name", t.ObjectName);
                     n2.SetAttributeValue("ID", t.Guid.Value.ToString());
                     n2.SetAttributeValue("ClassName", "eCTemplateEntityProxy");
                     break;
                 case "gCQuestActor":
                     gCQuestActor q = p.Object as gCQuestActor;
                     n2 = new XElement(p.PropertyName);
                     n2.SetAttributeValue("Actor", q.Actor.Object);
                     n2.SetAttributeValue("ActorType", q.ActorType.ToString());
                     n2.SetAttributeValue("ClassName", "gCQuestActor");
                     break;
                 case "gCSkillValue":
                     gCSkillValue s = (gCSkillValue)p.Object;
                     n2 = new XElement(p.PropertyName);
                     n2.SetAttributeValue("Amount", s.Amount.ToString());
                     n2.SetAttributeValue("Skill", s.Skill.ToString());
                     n2.SetAttributeValue("ClassName", "gCSkillValue");
                     break;
                 default:
                     n.SetAttributeValue(p.PropertyName, ToString(p, p.Object));
                     break;
             }
         }
     };
     Action<List<InfoCommandWrapper>, string, XElement> B = (a, b, p) =>
     {
         foreach (InfoCommandWrapper i2 in a)
         {
             XElement c = new XElement(b);
             A(i2.Object, c);
             p.Add(c);
         }
     };
     XElement d = new XElement("Document");
     A(i.nat.Container as bCAccessorPropertyObject, d);
     B(i.m_pCommands, "Command", d);
     B(i.m_pConditions, "Condition", d);
     return d;
 }
Ejemplo n.º 11
0
 public gCInfoCommandClearGameEvent_Wrapper(InfoWrapper P)
     : base(P)
 {
     Native = new bCAccessorPropertyObject(new gCInfoCommandClearGameEvent(), "gCInfoCommandClearGameEvent");
     Native.Properties.addProperty("GameEvent", "bCString", new bCString());
 }
Ejemplo n.º 12
0
 public static InfoWrapper FromXml(XElement d)
 {
     Action<bCAccessorPropertyObject, XElement, bool> A = (a, b, c) =>
     {
         foreach (XAttribute a2 in b.Attributes())
             if (a2.Name.LocalName != "ClassName")
                 a.Properties[a2.Name.LocalName].Object = FromString(a.Properties[a2.Name.LocalName], a2.Value);
         if(c)
             foreach (XElement e in b.Elements())
             {
                 bCProperty p = a.Properties[e.Name.LocalName];
                 switch (p.PropertyType)
                 {
                     case "eCTemplateEntityProxy":
                         (p.Object as eCTemplateEntityProxy).Guid = new bCGuid(new Guid(e.Attribute("ID").Value));
                         break;
                     case "gCQuestActor":
                         (p.Object as gCQuestActor).ActorType = (gEQuestActor)Enum.Parse(typeof(gEQuestActor), e.Attribute("ActorType").Value);
                         (p.Object as gCQuestActor).Actor = new eCEntityStringProxy(e.Attribute("Actor").Value);
                         break;
                     case "gCSkillValue":
                         (p.Object as gCSkillValue).Amount = int.Parse(e.Attribute("Amount").Value);
                         (p.Object as gCSkillValue).Skill = (gESkill)Enum.Parse(typeof(gESkill), e.Attribute("Skill").Value);
                         break;
                     default:
                         throw new Exception();
                 }
             }
     };
     Action<string, XElement, InfoWrapper> B = (a, b, w) =>
     {
         foreach (XElement e in b.Elements())
             if (e.Name == a)
             {
                 string c = e.Attribute("ClassName").Value;
                 InfoCommandWrapper v = InfoCommandWrapper.getWrapper(c + "_Wrapper", w);
                 A(v.Object, e, true);
                 typeof(InfoWrapper).GetMethod("Add" + a).Invoke(w, new object[]{v});
             }
     };
     InfoWrapper i = new InfoWrapper("", "", gEInfoType.gEInfoType_Comment, gEInfoCondType.gEInfoCondType_Activator);
     if (d.Attribute("ClassName").Value != "gCInfo")
         throw new Exception();
     A(i.nat.Container as bCAccessorPropertyObject, d, false);
     B("Command", d, i);
     B("Condition", d, i);
     i.Build();
     return i;
 }
Ejemplo n.º 13
0
 public gCInfoCommandClearGameEvent_Wrapper(bCAccessorPropertyObject O, InfoWrapper P)
     : base(O, P)
 {
 }
Ejemplo n.º 14
0
 public static InfoCommandWrapper getWrapper(string N, InfoWrapper P)
 {
     return getWrapper(Type.GetType("RisenEditor.Code." + N), P);
 }
Ejemplo n.º 15
0
 public static InfoCommandWrapper getWrapper(Type T, InfoWrapper P)
 {
     InfoCommandWrapper v = Activator.CreateInstance(T, P) as InfoCommandWrapper;
     return v;
 }
Ejemplo n.º 16
0
 public gCInfoCommandGive_Wrapper(bCAccessorPropertyObject O, InfoWrapper P)
     : base(O, P)
 {
 }
Ejemplo n.º 17
0
 public gCInfoCommandGive_Wrapper(InfoWrapper P)
     : base(P)
 {
     Native = new bCAccessorPropertyObject(new gCInfoCommandGive(), "gCInfoCommandGive");
     Native.Properties.addProperty("Entity1", "bCString", new bCString());
     Native.Properties.addProperty("Entity2", "bCString", new bCString());
     Native.Properties.addProperty("Item", "eCTemplateEntityProxy", new eCTemplateEntityProxy());
     Native.Properties.addProperty("Amount", "long", new Int32());
 }
Ejemplo n.º 18
0
 public gCInfoCommandCloseQuest_Wrapper(bCAccessorPropertyObject O, InfoWrapper P)
     : base(O, P)
 {
 }
Ejemplo n.º 19
0
 public gCInfoCommandPickPocket_Wrapper(bCAccessorPropertyObject O, InfoWrapper P)
     : base(O, P)
 {
 }
Ejemplo n.º 20
0
 public gCInfoCommandCloseQuest_Wrapper(InfoWrapper P)
     : base(P)
 {
     Native = new bCAccessorPropertyObject(new gCInfoCommandCloseQuest(), "gCInfoCommandCloseQuest");
     Native.Properties.addProperty("QuestName", "bCString", new bCString());
 }
Ejemplo n.º 21
0
 public gCInfoCommandRemoveNPCInfo_Wrapper(InfoWrapper P)
     : base(P)
 {
     Native = new bCAccessorPropertyObject(new gCInfoCommandRemoveNPCInfo(), "gCInfoCommandRemoveNPCInfo");
     Native.Properties.addProperty("NPC", "bCString", new bCString());
     Native.Properties.addProperty("Location", "bTPropertyContainer<enum gEInfoLocation>", new gEInfoLocation());
     Native.Properties.addProperty("Type", "bTPropertyContainer<enum gEInfoNPCType>", new gEInfoNPCType());
 }
Ejemplo n.º 22
0
 public gCInfoCommandDescription_Wrapper(bCAccessorPropertyObject O, InfoWrapper P)
     : base(O, P)
 {
 }
Ejemplo n.º 23
0
 public gCInfoCommandRemoveNPC_Wrapper(InfoWrapper P)
     : base(P)
 {
     Native = new bCAccessorPropertyObject(new gCInfoCommandRemoveNPC(), "gCInfoCommandRemoveNPC");
     Native.Properties.addProperty("NPC", "bCString", new bCString());
 }
Ejemplo n.º 24
0
 public gCInfoCommandDescription_Wrapper(InfoWrapper P)
     : base(P)
 {
     Native = new bCAccessorPropertyObject(new gCInfoCommandDescription(), "gCInfoCommandDescription");
     Native.Properties.addProperty("Text", "gCInfoLocString", new gCInfoLocString());
 }
Ejemplo n.º 25
0
 void addWrapper(InfoWrapper arg1)
 {
     if (!m_pChanged.Contains(arg1))
         m_pChanged.Add(arg1);
 }
Ejemplo n.º 26
0
 public gCInfoCommandDestroyItem_Wrapper(bCAccessorPropertyObject O, InfoWrapper P)
     : base(O, P)
 {
 }
Ejemplo n.º 27
0
 void saveWrapper( InfoWrapper w)
 {
     string n = FileManager.CreateNewPhysicalFile(FileManager.NewFileType.Info, w.Name + ".xinf").Path;
     var a = InfoWrapper.ToXml(w);
     XmlWriterSettings settings = new XmlWriterSettings();
     settings.Indent = true;
     settings.NewLineOnAttributes = true;
     settings.OmitXmlDeclaration = true;
     settings.ConformanceLevel = ConformanceLevel.Document;
     using (XmlWriter writer = XmlWriter.Create(n, settings))
     {
         a.WriteTo(writer);
     }
 }
Ejemplo n.º 28
0
 public gCInfoCommandEnd_Wrapper(InfoWrapper P)
     : base(P)
 {
     Native = new bCAccessorPropertyObject(new gCInfoCommandEnd(), "gCInfoCommandEnd");
 }
Ejemplo n.º 29
0
 public gCInfoCommandGiveXP_Wrapper(InfoWrapper P)
     : base(P)
 {
     Native = new bCAccessorPropertyObject(new gCInfoCommandGiveXP(), "gCInfoCommandGiveXP");
     Native.Properties.addProperty("Amount", "long", new Int32());
 }
Ejemplo n.º 30
0
 protected InfoCommandWrapper(InfoWrapper a_Parent)
 {
     Parent = a_Parent;
 }