public static ScriptList Reload(bool fromFile = true) { Console.WriteLine("ScriptList Instance Creator Loaded"); if (!File.Exists("ScriptList.bdf") && fromFile) { ScriptList sl = new ScriptList(); sl.Validate(); return(sl); } try { if (_inst != null && !fromFile) { if (_inst.SingletonInitialized) { return(Instance); } } } catch (Exception e) { } Console.WriteLine("=====> Begin read"); ScriptList tmpObj = JsonConvert.DeserializeObject <ScriptList>(File.ReadAllText("ScriptList.bdf")); Console.WriteLine("=====> End Read"); Console.WriteLine("ScriptList Entries from BDF: " + tmpObj.Scripts.Count.ToString()); return(tmpObj); }
public void refresh_git_branch_build(UUID client, int level, string[] additionalArgs, Destinations source, UUID agentKey, string agentName) { MHE(source, client, "* Initializing Refresh"); HttpWebRequest hwr = null; HttpWebResponse hwresp = null; string baseURL = "https://raw.githubusercontent.com/" + additionalArgs[0] + "/OpenCollar/" + additionalArgs[1] + "/"; try { hwr = (HttpWebRequest)HttpWebRequest.Create(baseURL + ".zi/ScriptList.bdf"); hwr.Method = "GET"; hwresp = (HttpWebResponse)hwr.GetResponse(); }catch (Exception e) { } if (hwresp.StatusCode == HttpStatusCode.NotFound) { MHE(source, client, "The BDF File [ScriptList.bdf] was not found!"); return; } else if (hwresp.StatusCode == HttpStatusCode.OK) { MHE(source, client, "BDF Located\n \n[Adding to compile Queue. Scripts will be sent after verification]"); StreamReader sr = new StreamReader(hwresp.GetResponseStream()); StreamWriter sw = new StreamWriter("ScriptList.bdf"); sw.Write(sr.ReadToEnd()); sr.Close(); sw.Close(); ScriptList downloaded = ScriptList.Reload(true); ScriptImporter.ScriptManager.AddQueue(downloaded, client, additionalArgs[0], additionalArgs[1]); } }
public void rem_scriptlist(UUID client, int level, string[] additionalArgs, Destinations source, UUID agentKey, string agentName) { ScriptList sl = ScriptList.Instance; sl.Scripts.Remove(additionalArgs[0]); sl.Save(); }
public void new_scriptlist(UUID client, int level, string[] additionalArgs, Destinations source, UUID agentKey, string agentName) { if (File.Exists("ScriptList.bdf")) { File.Delete("ScriptList.bdf"); } ScriptList.ResetSingleton(); // Grab a new singleton and save the file ScriptList.Instance.Save(); }
public void dump_scriptlist(UUID client, int level, string[] additionalArgs, Destinations source, UUID agentKey, string agentName) { MHE(source, client, "Starting dump.."); ScriptList sl = null; try { sl = ScriptList.Instance; } catch (Exception e) { MHE(source, client, "ScriptList - failure to assign singleton! (This is fatal, stopping operation)"); return; } foreach (KeyValuePair <string, ScriptList.ScriptListFlags> kvp in sl.Scripts) { MHE(source, client, "_\nScript: " + kvp.Key + "\nData: " + kvp.Value.Dump()); } MHE(source, client, "Dump successful"); }
public void add_scriptlist(UUID client, int level, string[] additionalArgs, Destinations source, UUID agentKey, string agentName) { ScriptList sl = ScriptList.Instance; string ScriptName = additionalArgs[0]; string ScriptPath = additionalArgs[1]; string AssetType = additionalArgs[2]; ScriptList.ScriptListFlags slf = new ScriptList.ScriptListFlags(); slf.ScriptName = ScriptName; slf.Container = ScriptPath; slf.FileExt = additionalArgs[3]; slf.Type = AssetType; sl.Scripts.Add(ScriptName, slf); sl.Save(); }
public static void ResetSingleton() { _inst = null; }