// Use this for initialization void Start() { if (Instance != null) { Instance = null; GameObject.Destroy (gameObject); } else { GameObject.DontDestroyOnLoad (gameObject); Instance = this; } }
// Use this for initialization void Start() { if (Instance != null) { Instance = null; GameObject.Destroy(gameObject); } else { GameObject.DontDestroyOnLoad(gameObject); Instance = this; } }
public static string GetHtml(string title, IList <DataRow> rows) { var sortedRows = rows.OrderByDescending(r => r.Favorite).ThenByDescending(r => r.LastVisit); var res = @$ " <html> <head> <meta charset=" "UTF-8" "> <link rel=" "stylesheet" " href=" "https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" " crossorigin=" "anonymous" "> <link rel=" "stylesheet" " href=" "https://unpkg.com/[email protected]/dist/bootstrap-table.min.css" "> <link rel=" "stylesheet" " href=" "https://unpkg.com/[email protected]/dist/extensions/filter-control/bootstrap-table-filter-control.css" "> </head> <body> <div class=" "page-header" "><h2 class=" "badge-Info pl-3" ">{title}<span class=" "badge badge-light m-3" ">{rows.Count}</span></h2></div>
public static string CreateHTML( List <string> stylesheetsSources, List <string> javascriptSources, Encoding encoding, string rootTitle, string errorMessage = null) { string stylesheetsHTML = GetStylesheetTableHTML(stylesheetsSources); string javaScriptsHTML = GetJavaScriptTableHTML(javascriptSources); return(@$ " <!doctype html> <html> <head> <meta charset=" "{encoding.WebName}" " /> <title>{rootTitle}</title>
internal void BuildShapeDom(out X3D root, out Shape shape) { head head = new head(); meta meta = new meta(); Scene scene = new Scene(); root = new X3D(); shape = new Shape(); meta.name = "generator"; meta.content = BuilderApplication.AppInfo; scene.Children.Add(shape); head.Children.Add(meta); root.Children.Add(scene); root.Children.Add(head); }
private void InvokeFactEvent(bool creation, string Id) { // update meta struct meta info = MetaInf[Id]; info.active = creation; MetaInf[Id] = info; if (invoke) if (creation) CommunicationEvents.AddFactEvent.Invoke(this[Id]); else CommunicationEvents.RemoveFactEvent.Invoke(this[Id]); if (creation) // undo freeLabel() _ = FactDict[Id].Label; else FactDict[Id].freeAutoLabel(); }
public static HttpResponse InternalServerError() { string content = "<!DOCTYPE html> < html lang = "en" xmlns = "http://www.w3.org/1999/xhtml" > < head > < meta charset = "utf-8" /> < title > Internal Server Error</ title > </ head > < body > < h1 > Ooops!</ h1 > </ body > </ html > "; var response = new HttpResponse(ResponseStatusCode.Internal_Server_Error); response.ContentAsUTF8 = content; return response; }
public static HttpResponse ResourseNotFound() { string content = "<!DOCTYPE html> < html lang = "en" xmlns = "http://www.w3.org/1999/xhtml" > < head > < meta charset = "utf-8" /> < title > Resourse Not Found!</ title > </ head > < body > < h1 > I'm sorry!</h1> </ body > </ html > "; var response = new HttpResponse(ResponseStatusCode.Page_Not_Found); response.ContentAsUTF8 = content; return response; }
public string Add(Fact value, out bool exists, bool samestep = false) // also checks for duplicates and active state // returns key of actual Fact { soft_resetted = false; string key; if (exists = FindEquivalent(value, out key, out bool exact)) { if (!exact) // no longer needed value.delete(); if (MetaInf[key].workflow_id >= marker) // check for zombie-status { // protect zombie from beeing pruned var zombie = Workflow[MetaInf[key].workflow_id]; zombie.creation = false; Workflow[MetaInf[key].workflow_id] = zombie; // set new init location MetaInf[key] = new meta(marker, true); } // zombies are undead! else if (MetaInf[key].active) // desired outcome already achieved return key; } else // brand new Fact { key = value.Id; FactDict.Add(key, value); MetaInf.Add(key, new meta(marker, true)); } WorkflowAdd(new stepnote(key, samestep, true, this)); return key; }
public void Draw(bool draw_all = false) // call this after assigning a stored instance in an empty world, that was not drawn { // TODO: see issue #58 // TODO: communication with MMT foreach (var key in FactDict.Keys) { // update active info if needed meta info = MetaInf[key]; if (info.active) { info.active = false; MetaInf[key] = info; } } marker = 0; var stop = draw_all ? worksteps : backlog; backlog = worksteps; while(backlog > stop) redo(); }
public void Write(List <HistoryItem> history) { using var fs = TargetFile.CreateText(); using var bodyWriter = new StringWriter(); foreach (var x in history.GroupBy(x => x.Category)) { var category = x.Key; WriteCategory(bodyWriter, category, x.AsEnumerable(), isOpen: category == Category.Misc); } var style = @" .item { display: grid; grid-template: ""title"" auto ""desc"" auto ""prs"" auto ""commits"" auto / auto ; border: 1px solid darkgrey; border-radius: 4px; margin: 1em 0 0.4em 0; padding: 0.4em; } .item-title { grid-area: title; margin: 0; line-height: 1.8em; } .item-desc { grid-area: desc; margin-bottom: 0.4em; line-height: 1.8em; } .item-prs { grid-area: prs; } .item-commits { grid-area: commits; } .item-commits > details { display: inline-block; } .item-prs, .item-commits { margin-bottom: 4px; font-size: 0.8em; line-height: 1.8em; } .item-prs > .pr-link, .item-commits > details > summary > * { background-color: lightgrey; border-radius: 4px; margin-right: 2px; padding: 2px 4px; } "; var html = @$ " <!DOCTYPE html><html> <head> <meta charset=" "utf-8" "> <style>{style}</style>
/// <summary> /// actuall function to resync the desired type of tagRefs in accordance with the new map /// </summary> void sync() { OpenFileDialog ofd = new OpenFileDialog(); MessageBox.Show("OPEN PARENT MAP", "GitGud"); ofd.Filter = "Halo 2 Vista Map (*.map)|*.map"; if (ofd.ShowDialog() == DialogResult.OK) { string parent_map = ofd.FileName; MessageBox.Show("OPEN TARGET MAP", "GitGud"); ofd.Filter = "Halo 2 Vista Map (*.map)|*.map"; if (ofd.ShowDialog() == DialogResult.OK) { string target_loc = ofd.FileName; string log = "LOG_BOX\n"; List <injectRefs> resync_list = Get_Resync_List(parent_map, target_loc); foreach (injectRefs temp_ref in compile_list) { if (File.Exists(directory + "\\" + temp_ref.file_name)) { //lets open the file FileStream fs = new FileStream(directory + "\\" + temp_ref.file_name, FileMode.Append); long size = fs.Position; fs.Close(); //lets load it into memory byte[] meta = new byte[size]; //Filestream imposed some probs StreamReader sr = new StreamReader(directory + "\\" + temp_ref.file_name); //lets read the data sr.BaseStream.Read(meta, 0, (int)size); sr.Dispose(); meta obj = new meta(meta, temp_ref.type, (int)size, temp_ref.file_name); log += obj.Update_datum_indexes(resync_list, type_ref_list); //write it to the file StreamWriter sw = new StreamWriter(directory + "\\" + temp_ref.file_name); sw.BaseStream.Seek(0, SeekOrigin.Begin); sw.BaseStream.Write(meta, 0, (int)size); sw.Dispose(); } else { log += "\nFile doesnt exists : " + temp_ref.file_name; } } StreamWriter sw_1 = new StreamWriter(directory + "\\Tagref_resync_log.txt"); sw_1.Write(log); LogBox lol = new LogBox(log); lol.Show(); } } }
private void DumpShadersToolStripMenuItem_Click(object sender, EventArgs e) { { if (map_loaded) { FolderBrowserDialog fbd = new FolderBrowserDialog(); fbd.ShowNewFolderButton = true; MessageBox.Show("Select a directory to export the shader dump. Preferably an empty folder."); if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string tags_directory = fbd.SelectedPath; StreamWriter log = new StreamWriter(tags_directory + '\\' + map_name.Substring(map_name.LastIndexOf('\\') + 1) + ".shader_log"); foreach (TreeNode element in treeView1.Nodes["shad"].Nodes) { int table_ref = Int32.Parse(element.Name); int datum = DATA_READ.ReadINT_LE(table_ref + 4, map_stream); int mem_off = DATA_READ.ReadINT_LE(table_ref + 8, map_stream); int size = DATA_READ.ReadINT_LE(table_ref + 0xc, map_stream); meta meta_obj = new meta(datum, SID_list[datum], map_stream); meta_obj.Rebase_meta(0x0); if (meta_obj.Get_Total_size() != 0) { byte[] meta_data = meta_obj.Generate_meta_file(); string text_path = tags_directory + '\\' + SID_list[datum] + ".txt"; //lets create our directory System.IO.Directory.CreateDirectory(DATA_READ.ReadDirectory_from_file_location(text_path)); StreamWriter sw = new StreamWriter(text_path); //supoosing each shad contains only one Post process block element int PPB_off = DATA_READ.ReadINT_LE(0x24, meta_data); int stem_datum = DATA_READ.ReadINT_LE(PPB_off, meta_data); int bitmap_count = DATA_READ.ReadINT_LE(PPB_off + 0x4, meta_data); int bitmapB_off = DATA_READ.ReadINT_LE(PPB_off + 0x8, meta_data); //write the stemp path string out_temp; if (stem_datum != 0 && stem_datum != -1) { if (SID_list.TryGetValue(stem_datum, out out_temp)) { sw.WriteLine(SID_list[stem_datum]); } else { sw.WriteLine("---"); } } for (int i = 0; i < bitmap_count; i++) { int bitm_datum = DATA_READ.ReadINT_LE(bitmapB_off + i * 0xC, meta_data); if (bitm_datum != 0 && bitm_datum != -1) { if (SID_list.TryGetValue(bitm_datum, out out_temp)) { if (SID_list[bitm_datum] == "") { sw.WriteLine(" "); } else { sw.WriteLine(SID_list[bitm_datum]); } } else { sw.WriteLine("---"); } } else { sw.WriteLine(" "); } } log.WriteLine(SID_list[datum] + ".txt"); sw.Close(); } else { log.WriteLine("---"); } } log.Close(); MessageBox.Show("Extraction Complete"); } } else { MessageBox.Show("Load a map first"); } } }
private void button1_Click(object sender, EventArgs e) { string log = "\nCOMPILATION : "; //the File where we are gonna compile our stuff StreamWriter sw = new StreamWriter(directory + "\\tags.meta"); //the Tables data StreamWriter sw_t = new StreamWriter(directory + "\\tables.meta"); //creating a table byte[] tables = new byte[0x10 * compile_list.Count]; //index of custom metas int custom_table_index = 0; int new_base = Int32.Parse(textBox1.Text.Substring(2), NumberStyles.HexNumber);//the offset from the map_mem_base 0x1511020(lockout) foreach (injectRefs temp_ref in compile_list) { if (File.Exists(directory + "\\" + temp_ref.file_name)) { //lets open the file FileStream fs = new FileStream(directory + "\\" + temp_ref.file_name, FileMode.Append); long size = fs.Position; fs.Close(); //lets load it into memory byte[] meta = new byte[size]; //Filestream imposed some probs StreamReader sr = new StreamReader(directory + "\\" + temp_ref.file_name); //lets read the data sr.BaseStream.Read(meta, 0, (int)size); sr.Dispose(); meta obj = new meta(meta, temp_ref.type, (int)size, temp_ref.file_name); log += obj.Update_datum_indexes(compile_list); obj.Rebase_meta(new_base); //write it to the file sw.BaseStream.Write(meta, 0, (int)size); DATA_READ.WriteTAG_TYPE_LE(temp_ref.type, custom_table_index * 0x10, tables); DATA_READ.WriteINT_LE(temp_ref.new_datum, custom_table_index * 0x10 + 4, tables); DATA_READ.WriteINT_LE(new_base, custom_table_index * 0x10 + 8, tables); DATA_READ.WriteINT_LE((int)size, custom_table_index * 0x10 + 0xC, tables); log += "\n Written tag " + temp_ref.file_name + " with new datum as " + temp_ref.new_datum.ToString("X"); //increase the tag_offset new_base += (int)size; } else { log += "\nFile doesnt exists : " + temp_ref.file_name; } custom_table_index++; } sw_t.BaseStream.Write(tables, 0, 0x10 * compile_list.Count()); sw.Dispose(); sw_t.Dispose(); //lets launch the log box LogBox lb = new LogBox(log); lb.Show(); this.Close(); }
internal static meta ExpectedMetadataProperties(ThemeData data) { meta newMeta = new meta() { path=null, type = MetadataType.Undefined, format= MetadataFormat.Undefined }; if (data == null) return newMeta; newMeta.type = MetadataType.FilePath; newMeta.format = MetadataFormat.Xml; //general file based metadata if (data.Path != null && File.Exists(data.Path + ".xml")) { newMeta.path = data.Path + ".xml"; return newMeta; } if (data.DataSource != null && File.Exists(data.DataSource + ".xml")) { newMeta.path = data.DataSource + ".xml"; return newMeta; } //grids & tins if (data.DataSource != null //&& data.WorkspacePath != null && System.IO.Directory.Exists(data.DataSource)) { string metapath = System.IO.Path.Combine(data.DataSource, "metadata.xml"); if (File.Exists(metapath)) { newMeta.path = metapath; return newMeta; } } //shapefile if (data.IsShapefile) { string metapath = data.DataSource + ".shp.xml"; if (File.Exists(metapath)) { newMeta.path = metapath; return newMeta; } } //coverages if (data.IsCoverage && data.WorkspacePath != null && data.Container != null) { string coverageDir = System.IO.Path.Combine(data.WorkspacePath, data.Container); if (System.IO.Directory.Exists(coverageDir)) { string metapath = System.IO.Path.Combine(coverageDir, "metadata.xml"); if (File.Exists(metapath)) { newMeta.path = metapath; return newMeta; } } } //CAD if (data.IsCad && data.WorkspacePath != null && data.Container != null) { string cadFile = System.IO.Path.Combine(data.WorkspacePath, data.Container); if (System.IO.File.Exists(cadFile)) { string metapath = cadFile + ".xml"; if (File.Exists(metapath)) { newMeta.path = metapath; return newMeta; } } } newMeta.type = MetadataType.EsriDataPath; if (data.IsInGeodatabase && !data.IsLayerFile) { newMeta.path = data.DataSource; return newMeta; } if (data.IsLayerFile && !data.IsGroupLayerFile) { newMeta.path = data.DataSource; return newMeta; } //FIXME - does not work for web services ??? newMeta.type = MetadataType.Undefined; newMeta.format = MetadataFormat.Undefined; return newMeta; }
private void _generate_cache() { string log = "\nCOMPILATION : "; int new_base = Int32.Parse(textBox1.Text.Substring(2), NumberStyles.HexNumber);//the offset from the map_mem_base 0x1511020(lockout) int meta_size = 0x0; int tag_index = 0x0; //maintain an array of meta Queue <byte[]> meta_list = new Queue <byte[]>(); Queue <long> size_list = new Queue <long>(); byte[] tables = new byte[0x10 * compile_list.Count]; foreach (injectRefs temp_ref in compile_list) { if (File.Exists(directory + "\\" + temp_ref.file_name)) { //lets open the file FileStream fs = new FileStream(directory + "\\" + temp_ref.file_name, FileMode.Append); long size = fs.Position; fs.Close(); //lets load it into memory byte[] meta = new byte[size]; //Filestream imposed some probs StreamReader sr = new StreamReader(directory + "\\" + temp_ref.file_name); //lets read the data sr.BaseStream.Read(meta, 0, (int)size); sr.Dispose(); //rebase the meta meta obj = new meta(meta, temp_ref.type, (int)size, temp_ref.file_name); log += obj.Update_datum_indexes(compile_list, type_ref_list); obj.Rebase_meta(new_base + meta_size); meta_list.Enqueue(meta); //add to the meta list size_list.Enqueue(size); //add to the size_list //tag_table_stuff DATA_READ.WriteTAG_TYPE_LE(temp_ref.type, tag_index * 0x10, tables); DATA_READ.WriteINT_LE(temp_ref.new_datum, tag_index * 0x10 + 4, tables); DATA_READ.WriteINT_LE(new_base + meta_size, tag_index * 0x10 + 8, tables); DATA_READ.WriteINT_LE((int)size, tag_index * 0x10 + 0xC, tables); log += "\n Written tag " + temp_ref.file_name + " with new datum as " + temp_ref.new_datum.ToString("X"); //increase the tag_offset meta_size += (int)size; //increase the tag_count } else { log += "\nFile doesnt exists : " + temp_ref.file_name; } tag_index++; } StreamWriter sw = new StreamWriter(directory + "\\tags.cache"); byte[] temp = new byte[0x4]; byte[] lol = { 0 }; sw.BaseStream.Write(Encoding.ASCII.GetBytes("tag_table"), 0, "tag_table".Length); sw.BaseStream.Write(lol, 0, 1); DATA_READ.WriteINT_LE(0x34, 0, temp); sw.BaseStream.Write(temp, 0, 0x4); DATA_READ.WriteINT_LE(0x10 * compile_list.Count, 0, temp); sw.BaseStream.Write(temp, 0, 0x4); sw.BaseStream.Write(Encoding.ASCII.GetBytes("tag_data"), 0, "tag_data".Length); sw.BaseStream.Write(lol, 0, 1); DATA_READ.WriteINT_LE(0x34 + 0x10 * compile_list.Count, 0, temp); sw.BaseStream.Write(temp, 0, 0x4); DATA_READ.WriteINT_LE(meta_size, 0, temp); sw.BaseStream.Write(temp, 0, 0x4); sw.BaseStream.Write(Encoding.ASCII.GetBytes("tag_maps"), 0, "tag_maps".Length); sw.BaseStream.Write(lol, 0, 1); DATA_READ.WriteINT_LE(0x34 + 0x10 * compile_list.Count + meta_size, 0, temp); sw.BaseStream.Write(temp, 0, 0x4); DATA_READ.WriteINT_LE(tag_scenarios[0].Length + 1, 0, temp); sw.BaseStream.Write(temp, 0, 0x4); sw.BaseStream.Write(tables, 0, 0x10 * compile_list.Count); while (meta_list.Count != 0) { sw.BaseStream.Write(meta_list.Dequeue(), 0x0, (int)size_list.Dequeue()); } sw.BaseStream.Write(Encoding.ASCII.GetBytes(tag_scenarios[0]), 0, tag_scenarios[0].Length); sw.BaseStream.Write(lol, 0, 1); sw.Dispose(); //atleast mention the universally acclaimed tag log += "\ntype referenced tags are :"; foreach (UnisonRefs uni_temp in type_ref_list) { log += "\nReffered " + uni_temp.type + " to " + uni_temp.new_datum.ToString("X") + " file : " + uni_temp.file_name; } //writing log sw = new StreamWriter(directory + "\\compile_log.txt"); sw.Write(log); //lets launch the log box LogBox lb = new LogBox(log); lb.Show(); }
private void Extract_Click(object sender, EventArgs e) { string log = "\nEXTRACTION LOG : ";//or log string rel_path = SID_list[extraction_list[0].datum_index] + "." + extraction_list[0].type; XmlTextWriter xw = new XmlTextWriter(textBox1.Text + "\\" + DATA_READ.Read_File_from_file_location(rel_path) + ".xml", Encoding.UTF8); xw.Formatting = Formatting.Indented; xw.WriteStartElement("config"); if (textBox1.Text.Length > 0) { for (int i = 0; i < extraction_list.Count; i++) { tagRef temp_tagref = extraction_list[i]; int datum = temp_tagref.datum_index; string type = temp_tagref.type; if (datum != -1) { if (!extracted_list.Contains(datum)) { if (File.Exists(Application.StartupPath + "\\plugins\\" + type + ".xml")) { if (SID_list.ContainsKey(datum)) { meta obj = new meta(datum, SID_list[datum], map_stream); obj.Rebase_meta(0x0); if (checkBox1.Checked) { obj.Null_StringID(); } if (radioButton1.Checked == true) { //add recursivity extraction_list.AddRange(obj.Get_all_tag_refs()); } byte[] data = obj.Generate_meta_file(); string path = textBox1.Text + "\\" + obj.Get_Path() + "." + obj.Get_Type(); string directory = DATA_READ.ReadDirectory_from_file_location(path); //lets create our directory System.IO.Directory.CreateDirectory(directory); //create our file StreamWriter sw = new StreamWriter(path); sw.BaseStream.Write(data, 0, obj.Get_Total_size()); sw.Dispose(); //write to configuration xml xw.WriteStartElement("tag"); xw.WriteStartElement("name"); xw.WriteString(obj.Get_Path() + "." + type); //writing in the inner most level ie,name xw.WriteEndElement(); //name level xw.WriteStartElement("datum"); xw.WriteString(datum.ToString("X")); //writing in the inner most level ie here,datum xw.WriteEndElement(); //datum level xw.WriteEndElement(); //tag level //at least mention this in the logs log += "\nExtracted meta " + datum.ToString("X") + " to " + path; //add it to the extracted list extracted_list.Add(datum); } else { log += "\nCouldnot find stringID to datum_index " + datum.ToString("X"); } } else { log += "\nPlugin " + type + ".xml doesnt exist"; extracted_list.Add(datum); } } } } //close the config field and close the xml handle xw.WriteEndElement(); xw.Dispose(); //Log box LogBox lb = new LogBox(log); lb.Show(); //wprk is now done so lets close this stupid box this.Close(); } else { MessageBox.Show("At least Select the Directory", "Error"); } }
/// <summary> /// Sets the post meta. /// </summary> /// <param name="_p">Instatiated post</param> /// <param name="_pcv">program code value</param> /// <param name="_acv">The acv.</param> /// <param name="_sdv">start date value</param> /// <param name="_edv">end date value</param> /// <param name="_hvv">The HVV.</param> /// <param name="_adv">The adv.</param> private static void setPostMeta(ref post _p, String _pcv, String _acv, String _sdv, String _edv, String _hvv, string _adv) { meta _pc = default(meta); meta _ac = default(meta); meta _sd = default(meta); meta _ed = default(meta); meta _hv = default(meta); meta _ad = default(meta); meta _f_pc = default(meta); meta _f_ac = default(meta); meta _f_sd = default(meta); meta _f_ed = default(meta); meta _f_hv = default(meta); meta _f_ad = default(meta); if (!String.IsNullOrEmpty(_pcv)) { _pc.key = key_pc; _pc.value = _pcv; _f_pc.key = key_fpc; _f_pc.value = value_fpc; } if (!String.IsNullOrEmpty(_acv)) { _ac.key = key_ac; _ac.value = _acv; _f_ac.key = key_fac; _f_ac.value = value_fac; } else { _ac.key = key_ac; _ac.value = ""; _f_ac.key = key_fac; _f_ac.value = value_fac; } if (!String.IsNullOrEmpty(_sdv)) { _sd.key = key_sd; _sd.value = _sdv; _f_sd.key = key_fsd; _f_sd.value = value_fsd; } if (!String.IsNullOrEmpty(_edv)) { _ed.key = key_ed; _ed.value = _edv; _f_ed.key = key_fed; _f_ed.value = value_fed; } if (!String.IsNullOrEmpty(_hvv)) { _hv.key = key_hv; _hv.value = _hvv; _f_hv.key = key_fhv; _f_hv.value = value_fhv; } if (!String.IsNullOrEmpty(_adv)) { _ad.key = key_ad; _ad.value = _adv; _f_ad.key = key_fad; _f_ad.value = value_fad; } _p.meta_fields = new meta[] { _pc, _ac, _sd, _ed, _hv, _ad, _f_pc, _f_ac, _f_sd, _f_ed, _f_hv, _f_ad }; }