public static void CreateScript(string Name, string Code, params Arg[] Args) { var FinalCode = Code + @" namespace Script { public static class Args { "; foreach (Arg a in Args) { Rc.saveData(a.XML, "ScriptData/" + a.ArgName); FinalCode += @" public static " + a.type + " " + a.ArgName + @" { get { return LoadFromXMLString<" + a.type + ">(loadData(" + Rc.loadData("ScriptData/DoubleQuortation") + "ScriptData/" + a.ArgName + Rc.loadData("ScriptData/DoubleQuortation") + @")); } } "; } FinalCode += add + @" } }"; Console.WriteLine(@"Compile code : " + FinalCode); Rc.saveData(FinalCode, "Scripts/" + Name + ".cs"); Compile("Scripts/" + Name); }
private void saveSToolStripMenuItem_Click(object sender, EventArgs e) { if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Rc.saveData(this.textBox1.Text, saveFileDialog1.FileName); EditingPath = saveFileDialog1.FileName; } }
public static bool Save(Dictionary <string, ExtendedOAuthTokens> d, string path) { try { string save = ""; foreach (ExtendedOAuthTokens o in d.Values) { save += o.UserName + "," + o.AccessToken + "," + o.AccessTokenSecret + ";"; } Rc.saveData(save, path); return(true); } catch { return(false); } }
public static bool CreateScript(string Name, string Code, params Arg[] Args) { var FinalCode = Code + @" namespace Script { public static class Args { public static void Return<T>(T Arg) { SaveToXML(((object)Arg)," + Rc.loadData("ScriptData/DoubleQuortation") + "Scripts/" + Name + Rc.loadData("ScriptData/DoubleQuortation") + @"); } "; foreach (Arg a in Args) { Rc.saveData(a.XML, "ScriptData/" + a.ArgName); FinalCode += @" public static " + a.type + " " + a.ArgName + @" { get { return LoadFromXMLString<" + a.type + ">(loadData(" + Rc.loadData("ScriptData/DoubleQuortation") + "ScriptData/" + a.ArgName + Rc.loadData("ScriptData/DoubleQuortation") + @")); } } "; } FinalCode += add + @" } }"; if (Rc.loadData("Scripts/" + Name + ".cs") != FinalCode) { Rc.saveData(FinalCode, "Scripts/" + Name + ".cs"); return(Compile("Scripts/" + Name)); } else { return(true); } }