public Project ImportProject(string name, string src, string dest) { Project p = new Project(name, null); string outfile = string.Format("{0}{1}{2}.fitproj", dest, Path.DirectorySeparatorChar, name); p.ProjectFile = outfile; Directory.CreateDirectory(dest + "/Script/AnimCmd"); var files = Directory.EnumerateFiles(src + "/Script/AnimCmd/Body"); foreach (string s in files) File.Copy(s, dest + "/Script/AnimCmd/" + Path.GetFileName(s)); Directory.CreateDirectory(dest + "/Anim"); File.Copy(src + "/Motion/Body/Main.pac", dest + "/Anim/main.pac"); Directory.CreateDirectory(dest + "/Param"); OpenFileDialog dlg = new OpenFileDialog(); dlg.Title = "Select Parameter file."; if (dlg.ShowDialog() == DialogResult.OK) { File.Copy(dlg.FileName, dest + "/Param/" + dlg.SafeFileName); p.ParamPath = dest + "/Param/" + dlg.SafeFileName; } p.ACMDPath = dest + "/Script/AnimCmd"; p.ScriptRoot = dest + "/Script"; p.AnimationDirectory = dest + "/Anim"; p.AnimationFile = dest + "/Anim/main.pac"; p.ExtractedAnimations = false; p.ProjectType = ProjType.Fighter; p.WriteFITPROJ(outfile); return p; }
public void ReadWRKSPC(string path) { _projects = new List<Project>(); _workspaceRoot = Path.GetDirectoryName(path); using (StreamReader stream = new StreamReader(path)) { while (!stream.EndOfStream) { string raw = stream.ReadLine(); if (raw.StartsWith("Project")) { string _projName = raw.Substring(8, raw.IndexOf(',') - 8); string _fitProj = raw.Substring(raw.IndexOf(',') + 1).TrimEnd(new char[] { ':', ')' }); Project _proj = new Project(_projName, _fitProj.Trim()); Dictionary<string, string> props = new Dictionary<string, string>(); while ((raw = stream.ReadLine()) != "endproj;") props.Add(raw.Substring(0, raw.IndexOf('=')), raw.Substring(raw.IndexOf('=') + 1).TrimEnd(new char[] { ';', '\"' })); if (props.ContainsKey("type")) switch (props["type"]) { case "weapon": _proj.ProjectType = ProjType.Weapon; break; case "fighter": _proj.ProjectType = ProjType.Fighter; break; } _projects.Add(_proj); } } } }