示例#1
0
        public async Task <IHttpActionResult> Putwindow(int id, window window)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != window.id)
            {
                return(BadRequest());
            }

            db.Entry(window).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!windowExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#2
0
 /*-------------------------------------------------------------------------
  * 삭제
  * ---------------------------------------------------------------------------*/
 public void Remove(window _window)
 {
     try {
         m_windows.Remove(_window);
     } catch {
     }
 }
示例#3
0
    static void Main()
    {
        Application.Init();
        Window window = new window("Hello Gtk");

        window.Show();
        Application.Run();
    }
示例#4
0
        public static ParameterSet ParameterSet(this Setting setting, window window)
        {
            ParameterSet parameterSet = Core.Tas.Create.ParameterSet(setting, window, typeof(Aperture), typeof(window));

            parameterSet.Add("IsUsed", window.isUsed == 1);

            return(parameterSet);
        }
示例#5
0
        public static window ToT3D(this IOpening opening, Building building)
        {
            if (opening == null)
            {
                return(null);
            }

            uint colour;

            if (!Core.Query.TryGetValue(opening, "Color", out colour))
            {
                colour = Core.Convert.ToUint(Color.Black);
            }

            Geometry.Spatial.BoundingBox3D boundingBox3D = opening.Face3D?.GetBoundingBox();

            double width = double.NaN;

            if (!Core.Query.TryGetValue(opening, "Width", out width))
            {
                if (boundingBox3D == null)
                {
                    return(null);
                }
            }

            double height = double.NaN;
            double level  = double.NaN;

            throw new System.NotImplementedException();


            //    double height = double.NaN;
            //double level = double.NaN;

            //PlanarBoundary3D planarBoundary3D = opening.PlanarBoundary3D;
            //if(planarBoundary3D == null)
            //{
            //    if (!Core.Query.TryGetValue(opening, "Width", out width))
            //        return null;

            //    if (!Core.Query.TryGetValue(opening, "Height", out height))
            //        return null;

            //    if (!Core.Query.TryGetValue(opening, "Level", out level))
            //        return null;
            //}
            //else
            //{
            //    width = planarBoundary3D.Width();
            //    height = planarBoundary3D.Height();
            //    level = Analytical.Query.MinElevation(planarBoundary3D);
            //}

            window result = building.AddWindow(opening.Name, Query.OpeningType(opening), colour, height, width, level);

            return(result);
        }
	public static void DecompressExe(ListView contents, bool dbPro, window win, string oldExe, string newExe)
	{
		FileStream fs = null;
		BinaryReader br = null;
		FileStream fsDll = null;
		BinaryWriter bwDll = null;
		int dataLength, exeSection = 0, dataOffset = 0;
		string compressDll = Path.GetTempFileName(); 
		string tempExe = Path.GetTempFileName();
		//save exe
		SaveExe(contents, tempExe, oldExe, dbPro, win);
		try
		{
			fs = new FileStream(tempExe, FileMode.Open);
			br = new BinaryReader(fs);
			SkipExeSection(fs, br);
			exeSection = (int)fs.Position;
			dataLength = br.ReadInt32();
			fs.Seek(dataLength, SeekOrigin.Current);
			dataLength = br.ReadInt32();
			//write compress.dll
			fsDll = new FileStream(compressDll, FileMode.Create);
			bwDll = new BinaryWriter(fsDll);
			bwDll.Write(br.ReadBytes(dataLength));
			dataOffset = (int)fs.Position;
		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.ToString(), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
		}
		finally
		{
			if (br != null)
				br.Close();
			if (fs != null)
				fs.Close();
			if (bwDll != null)
				bwDll.Close();
			if (fsDll != null)
				fsDll.Close();
		}
		try
		{
			DecompressDll(oldExe, exeSection, dataOffset, newExe, compressDll);
		}
		catch(Exception ex)
		{
			MessageBox.Show(ex.ToString(), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);			
		}
		if (File.Exists(compressDll))
			File.Delete(compressDll);
		if (File.Exists(tempExe))
			File.Delete(tempExe);
	}
示例#7
0
        static void m_Click(object sender, EventArgs e)
        {
            window w = (window)(((System.Windows.Forms.Form)sender).Tag);

            if (w.click == null)
            {
                return;
            }
            ExecutionContext.Current = w.inst;
            w.click();
        }
示例#8
0
        public FormFilterWijk(window form, PostgresSQL conn)
        {
            db       = conn;
            mainForm = form;
            InitializeComponent();
            DataTable dt = new DataTable();

            dt.Load(db.QueryDataReader("SELECT DISTINCT stadsdeel FROM wijken"));
            cBoxStadsdeel.DataSource    = dt;
            cBoxStadsdeel.DisplayMember = "stadsdeel"; cBoxStadsdeel.ValueMember = "stadsdeel";
        }
示例#9
0
 private void OnTriggerExit2D(Collider2D collision)
 {
     if (collision.tag == "hammer")
     {
         touchingHammer = false;
     }
     else if (collision.tag == "window")
     {
         window = null;
     }
 }
示例#10
0
        public async Task <IHttpActionResult> Postwindow(window window)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.windows.Add(window);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = window.id }, window));
        }
示例#11
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "hammer")
     {
         hammerToCatch  = collision.gameObject;
         touchingHammer = true;
     }
     else if (collision.tag == "window")
     {
         window = collision.gameObject.GetComponent <window>();
     }
 }
示例#12
0
        public void ComputerSubWindow(int num, int count, window wd)
        {
            int dx = xPixelEnd - xPixelStrat;
            int dy = yPixelEnd - yPixelStart;
            int nx = count;// Determine how many tiles to use in each dimension, _nx_ and _ny_
            int ny = 1;

            while ((nx & 0x1) == 0 && 2 * dx * ny < dy * nx)
            {
                nx >>= 1;
                ny <<= 1;
            }
        }
示例#13
0
        public async Task <IHttpActionResult> Deletewindow(int id)
        {
            window window = await db.windows.FindAsync(id);

            if (window == null)
            {
                return(NotFound());
            }

            db.windows.Remove(window);
            await db.SaveChangesAsync();

            return(Ok(window));
        }
 public static int window_create(string text)
 {
     int ind = formc++;
     System.Windows.Forms.Form m = new System.Windows.Forms.Form();
     m.Text = text;
     forms.Add(ind, m);
     window w = new window();
     w.inst = LibraryContext.Current.InstanceFactory.CreatePrivateInstance() as RuntimeInstance;
     w.inst.SetLocalVar("window_index", ind);
     m.Tag = w;
     m.Click += new EventHandler(m_Click);
     m.Load += new EventHandler(m_Load);
     return ind;
 }
示例#15
0
        public static window ToT3D(this Aperture aperture, Building building)
        {
            if (aperture == null)
            {
                return(null);
            }

            uint colour;

            if (!Core.Query.TryGetValue(aperture, "Colour", out colour))
            {
                colour = Core.Convert.ToUint(Color.Black);
            }

            double width  = double.NaN;
            double height = double.NaN;
            double level  = double.NaN;

            PlanarBoundary3D planarBoundary3D = aperture.PlanarBoundary3D;

            if (planarBoundary3D == null)
            {
                if (!Core.Query.TryGetValue(aperture, "Width", out width))
                {
                    return(null);
                }

                if (!Core.Query.TryGetValue(aperture, "Height", out height))
                {
                    return(null);
                }

                if (!Core.Query.TryGetValue(aperture, "Level", out level))
                {
                    return(null);
                }
            }
            else
            {
                width  = planarBoundary3D.Width();
                height = planarBoundary3D.Height();
                level  = Analytical.Query.MinElevation(planarBoundary3D);
            }

            window result = building.AddWindow(aperture.Name, Query.OpeningType(aperture), colour, height, width, level);

            return(result);
        }
示例#16
0
 void Awake()
 {
     editwindow = (window)EditorWindow.GetWindow(typeof(window));
     //editwindow.stign = save.safeItem("stign", saveFile.types.STRING).tostring;
     //editwindow.groupEnabled = System.Convert.ToBoolean(save.safeItem("groupEnabled", saveFile.types.STRING).tostring);
     //editwindow.groupEnabled2 = System.Convert.ToBoolean(save.safeItem("groupEnabled2", saveFile.types.STRING).tostring);
     //editwindow.movespeed = save.safeItem("movespeed", saveFile.types.FLOAT).tofloat;
     //editwindow.testbounds = getbounds();
     //editwindow.stopnextto = System.Convert.ToBoolean(save.safeItem("stopnextto", saveFile.types.STRING).tostring);
     //editwindow.recalc = System.Convert.ToBoolean(save.safeItem("recalc", saveFile.types.STRING).tostring);
     //editwindow.recalcwhenidle = save.safeItem("recalcwhenidle", saveFile.types.FLOAT).tofloat;
     //editwindow.deets = save.safeItem("deets", saveFile.types.FLOAT).tofloat;
     //editwindow.rateofAnglechange = save.safeItem("rateofAnglechange", saveFile.types.FLOAT).tofloat;
     //editwindow.dynamicedgesize = save.safeItem("dynamicedgesize", saveFile.types.FLOAT).tofloat;
     //editwindow.theMask.value = save.safeItem("themask", saveFile.types.INT).toint;
 }
示例#17
0
        public static int window_create(string text)
        {
            int ind = formc++;

            System.Windows.Forms.Form m = new System.Windows.Forms.Form();
            m.Text = text;
            forms.Add(ind, m);
            window w = new window();

            w.inst = LibraryContext.Current.InstanceFactory.CreatePrivateInstance() as RuntimeInstance;
            w.inst.SetLocalVar("window_index", ind);
            m.Tag    = w;
            m.Click += new EventHandler(m_Click);
            m.Load  += new EventHandler(m_Load);
            return(ind);
        }
        //private PostgresSQL db;
        public FormFilter(window form, PostgresSQL db, string lastPostcode)
        {
            DataTable dt = new DataTable();

            InitializeComponent();
            mainWindow = form;
            dt.Load(db.QueryDataReader("SELECT DISTINCT voorzieningen FROM voorzieningen"));
            cBoxVoorziening.DropDownStyle = ComboBoxStyle.DropDownList;
            cBoxVoorziening.DataSource    = dt;
            cBoxVoorziening.DisplayMember = "voorzieningen";
            cBoxVoorziening.ValueMember   = "voorzieningen";

            if (lastPostcode != null)
            {
                txtPostcode.Text = lastPostcode;
            }
        }
示例#19
0
	public static void CompressExe(ListView contents, bool dbPro, window win, string oldExe, string newExe, string compressDll)
	{
		FileStream fs = null;
		BinaryReader br = null;
		int exeSection = 0, extraData = 0;
		string tempExe = Path.GetTempFileName();
		//save exe
		SaveExe(contents, tempExe, oldExe, dbPro, win);
		try
		{
			fs = new FileStream(tempExe, FileMode.Open);
			br = new BinaryReader(fs);
			SkipExeSection(fs, br);
			exeSection = (int)fs.Position;
			//get size of extra data
			if (contents.Items[contents.Items.Count - 1].SubItems[(int)ListViewOrder.Name].Text == ListViewStrings.ExtraData)
			{
				ListViewFileItem lvi = (ListViewFileItem)contents.Items[contents.Items.Count - 1];
				extraData = lvi.Size;
			}
		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.ToString(), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
		}
		finally
		{
			if (br != null)
				br.Close();
			if (fs != null)
				fs.Close();
		}
		try
		{
			CompressDll(oldExe, exeSection, extraData, newExe, compressDll);
		}
		catch(Exception ex)
		{
			MessageBox.Show(ex.ToString(), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);			
		}
		if (File.Exists(tempExe))
			File.Delete(tempExe);
	}
示例#20
0
    //draws gizmoes when in editor mode
    void OnDrawGizmos()
    {
        //bounds
        if (editwindow == null)
        {
            editwindow = (window)EditorWindow.GetWindow(typeof(window));

            editwindow.stign             = save.safeItem("stign", saveFile.types.STRING).tostring;
            editwindow.groupEnabled      = System.Convert.ToBoolean(save.safeItem("groupEnabled", saveFile.types.STRING).tostring);
            editwindow.groupEnabled2     = System.Convert.ToBoolean(save.safeItem("groupEnabled2", saveFile.types.STRING).tostring);
            editwindow.movespeed         = save.safeItem("movespeed", saveFile.types.FLOAT).tofloat;
            editwindow.testbounds        = getbounds();
            editwindow.stopnextto        = System.Convert.ToBoolean(save.safeItem("stopnextto", saveFile.types.STRING).tostring);
            editwindow.recalc            = System.Convert.ToBoolean(save.safeItem("recalc", saveFile.types.STRING).tostring);
            editwindow.recalcwhenidle    = save.safeItem("recalcwhenidle", saveFile.types.FLOAT).tofloat;
            editwindow.deets             = save.safeItem("deets", saveFile.types.FLOAT).tofloat;
            editwindow.rateofAnglechange = save.safeItem("rateofAnglechange", saveFile.types.FLOAT).tofloat;
            editwindow.dynamicedgesize   = save.safeItem("dynamicedgesize", saveFile.types.FLOAT).tofloat;
            editwindow.theMask.value     = save.safeItem("themask", saveFile.types.INT).toint;
        }

        Gizmos.DrawWireCube(editwindow.testbounds.center, editwindow.testbounds.extents);

        //walkable nodes
        for (int i = 0; i < Path.nodes.Count; i++)
        {
            if (Path.nodes[i].getwalkable())
            {
                Gizmos.color = Color.red;
                Gizmos.DrawCube(Path.nodes[i].returnpos(), new Vector3((Path.detail / 8.0f), (Path.detail / 8.0f), (Path.detail / 8.0f)));
            }
        }

        //path source is taking
        for (int i = 0; i < Path.pathlist.Count; i++)
        {
            Gizmos.color = Color.blue;
            Gizmos.DrawCube(Path.pathlist[i].returnpos(), new Vector3((Path.detail / 4.0f), (Path.detail / 4.0f), (Path.detail / 4.0f)));
        }
    }
示例#21
0
        private void btn_generate_Click(object sender, RoutedEventArgs e)
        {
            string text    = TBX_text.Text;
            string message = "";

            byte[] pic  = null;
            int    size = 0;

            foreach (RadioButton rb in spSize.Children)
            {
                if ((bool)rb.IsChecked)
                {
                    size = Convert.ToInt32(rb.Content);
                    break;
                }
            }

            if (QR.genQR(text, size, out message, out pic))
            {
                window pickWindow = new window(pic, 150, 150);
                pickWindow.Show();
            }
        }
示例#22
0
 return(SumMatch(window, charImages));
示例#23
0
        private void nuevaPestañaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TabPage tab = new window();

            Editor.TabPages.Add(tab);
        }
示例#24
0
 set => SDL_SetWindowTitle(window, value);
示例#25
0
	public static void LoadExe(ListView contents, string fileName, window win)
	{
		FileStream fs = null;
		BinaryReader br = null;
		try
		{
			fs = new FileStream(fileName, FileMode.Open);
			br = new BinaryReader(fs);
			ListViewFileItem lvi;
			//check exe signiture
			if (Encoding.ASCII.GetString(br.ReadBytes(2)) == "MZ")
			{
				SkipExeSection(fs, br);
				//add exe to listview
				lvi = new ListViewFileItem();
				lvi.Text = "Exe section";
				lvi.Offset = 0;
				lvi.Size = (int)fs.Position;
				lvi.SubItems.Add("No");
				lvi.SubItems.Add("No");
				lvi.SubItems.Add("No");
				lvi.SubItems.Add(lvi.Size.ToString("n0"));
				lvi.SubItems.Add("<exe>");
				contents.Items.Add(lvi);
				//Check for exe with no attached data
				if (lvi.Size == (int)fs.Length)
					return;
			}
			else
			{
				//it's a pck file so files start at begining of file
				fs.Seek(0, SeekOrigin.Begin);
			}
			//add attached files
			int nameLength = 1;
			while (nameLength > 0 && nameLength < 50 && fs.Position < fs.Length)
			{
				lvi = new ListViewFileItem();
				nameLength = br.ReadInt32();
				//MessageBox.Show(nameLength.ToString());
				if (nameLength > 0 && nameLength < 50)
				{
					//file
					lvi.Text = Encoding.ASCII.GetString(br.ReadBytes(nameLength));
					lvi.Size = br.ReadInt32();
					lvi.Offset = (int)fs.Position;
					//check for _virtual.dat
					if (lvi.Text == "_virtual.dat")
					{
						//get display settings
						win.displayMode = br.ReadInt32();
						int Width = br.ReadInt32();
						int Height = br.ReadInt32();
						int Depth = br.ReadInt32();
						win.displayWidth = Width;
						win.displayHeight = Height;
						win.displayDepth = Depth;
						contents.ContextMenu.MenuItems[0].Text = proExe.getDisplayString(Width, Height, Depth, win.displayMode);
						contents.ContextMenu.MenuItems[0].Enabled = true;
						fs.Seek(-16, SeekOrigin.Current);
					}
					fs.Seek(lvi.Size, SeekOrigin.Current);
					lvi.SubItems.Add("Yes");
					lvi.SubItems.Add("No");
					lvi.SubItems.Add("No");
					lvi.SubItems.Add(lvi.Size.ToString("n0"));
					lvi.SubItems.Add("<exe>");
				}
				else
				{
					//compressed or extra data
					lvi.Text = "Compressed or extra data";
					lvi.Offset = (int)fs.Position - 4;
					lvi.Size = (int)(fs.Length - (fs.Position - 4));
					lvi.SubItems.Add("No");
					lvi.SubItems.Add("No");
					lvi.SubItems.Add("No");
					lvi.SubItems.Add(lvi.Size.ToString("n0"));
					lvi.SubItems.Add("<exe>");
				}
				contents.Items.Add(lvi);
			}
		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.ToString(), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
		}
		finally
		{
			if (br != null)
				br.Close();
			if (fs != null)
				fs.Close();
		}
	}
示例#26
0
	public static void SaveExe(ListView contents, string fileName, string oldName, window win)
	{
		FileStream fsIn = null;
		BinaryReader brIn = null;
		FileStream fsOut = null;
		BinaryWriter bwOut = null;
		FileStream fsExt = null;
		BinaryReader brExt = null;
		bool overWrite = false; //has oldName been overwritten
		int exeSection = -1;    //size of exeSection
		try
		{
			if (fileName == oldName)
			{
				//Trying to overwrite file so move old name to %temp% before opening
				File.Move(oldName, Path.GetTempPath() + Path.GetFileName(oldName));
				oldName = Path.GetTempPath() + Path.GetFileName(oldName);
				overWrite = true;
			}
			if (oldName != "")
			{
				fsIn = new FileStream(oldName, FileMode.Open);
				brIn = new BinaryReader(fsIn);
			}
			fsOut = new FileStream(fileName, FileMode.Create);
			bwOut = new BinaryWriter(fsOut);
			foreach (ListViewFileItem lvi in contents.Items)
			{
				if (lvi.SubItems[5].Text == "<exe>")
				{
					//internal file
					//seek to data start
					fsIn.Seek(lvi.Offset, SeekOrigin.Begin);
					//name
					if (lvi.SubItems[1].Text == "Yes")
					{
						//is a normal file so write name and filedata length
						bwOut.Write(lvi.Text.Length);
						bwOut.Write(Encoding.ASCII.GetBytes(lvi.Text));
					}
					else
					{
						if (lvi.Text == "Exe section")
						{
							exeSection = lvi.Size;
						}
					}
					//check for _virtual.dat
					if (lvi.Text == "_virtual.dat")
					{
						//size
						bwOut.Write(lvi.Size);
						//write display settings
						bwOut.Write(win.displayMode);
						bwOut.Write(win.displayWidth);
						bwOut.Write(win.displayHeight);
						bwOut.Write(win.displayDepth);
						//write data
						fsIn.Seek(16, SeekOrigin.Current);
						bwOut.Write(brIn.ReadBytes(lvi.Size - 16));
					}
					else
					{
						//write data
						if (lvi.SubItems[1].Text == "No" && lvi.Text == "Compressed or extra data")
						{
							//write exeSection size at end of extra data
							bwOut.Write(brIn.ReadBytes(lvi.Size - 4));
							bwOut.Write(exeSection);
						}
						else
						{
							WriteData(fsIn, brIn, lvi, bwOut);
						}
					}
				}
				else
				{
					//external files
					//name
					if (lvi.SubItems[1].Text == "Yes")
					{
						//is a normal file so write name and filedata length
						bwOut.Write(lvi.Text.Length);
						bwOut.Write(Encoding.ASCII.GetBytes(lvi.Text));
					}
					fsExt = new FileStream(lvi.SubItems[5].Text, FileMode.Open);
					brExt = new BinaryReader(fsExt);
					//check for _virtual.dat
					if (lvi.Text == "_virtual.dat")
					{
						//size
						bwOut.Write((int) fsExt.Length);
						//write display settings
						bwOut.Write(win.displayMode);
						bwOut.Write(win.displayWidth);
						bwOut.Write(win.displayHeight);
						bwOut.Write(win.displayDepth);
						fsExt.Seek(16, SeekOrigin.Begin);
						bwOut.Write(brExt.ReadBytes((int)fsExt.Length - 16));
					}
					else
					{
						if (lvi.SubItems[1].Text == "No" && lvi.Text == "Compressed or extra data")
						{
							//write exeSection size at end of extra data
							bwOut.Write(brExt.ReadBytes((int)fsExt.Length - 4));
							bwOut.Write(exeSection);
						}
						else
						{
							//data
							WriteData(fsExt, brExt, lvi, bwOut);
						}
					}
				}
			}
		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.ToString(), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
		}
		finally
		{
			if (brIn != null)
				brIn.Close();
			if (fsIn != null)
				fsIn.Close();
			if (bwOut != null)
				bwOut.Close();
			if (fsOut != null)
				fsOut.Close();
			if (brExt != null)
				brExt.Close();
			if (fsExt != null)
				fsExt.Close();
			//delete oldName in temp dir if required
			if (overWrite == true)
			{
				File.Delete(oldName);
			}
		}
	}
示例#27
0
 /*-------------------------------------------------------------------------
  * 추가
  * ---------------------------------------------------------------------------*/
 public window Add(window _window)
 {
     _window.ctrl = this;
     m_windows.Add(_window);
     return(_window);
 }
示例#28
0
文件: jQuery.cs 项目: JimmyJune/blade
 public extern static jQuery Select(window window);
示例#29
0
	public static void LoadExe(ListView contents, string fileName, window win)
	{
		//debugLog.StartSection("LoadExe");
		int exeSectionSize = 0, extraDataSize = 0;
		FileStream fs = null;
		BinaryReader br = null;
		try
		{
			fs = new FileStream(fileName, FileMode.Open);
			br = new BinaryReader(fs);
			ListViewFileItem lvi;
			//debugLog.Log("Loading " + Path.GetFileName(fileName));
			//check exe signiture
			if (Encoding.ASCII.GetString(br.ReadBytes(2)) == "MZ")
			{
				//debugLog.Log("Found exe signiture");
				SkipExeSection(fs, br);
				//add exe to listview
				lvi = new ListViewFileItem();
				lvi.SubItems[(int)ListViewOrder.Name].Text = ListViewStrings.ExeSection;
				lvi.Offset = 0;
				lvi.Size = (int)fs.Position;
				exeSectionSize = lvi.Size;
				lvi.SubItems[(int)ListViewOrder.FileType].Text = ListViewStrings.No;
				lvi.SubItems[(int)ListViewOrder.Upx].Text = ListViewStrings.No;
				lvi.SubItems[(int)ListViewOrder.NullString].Text = ListViewStrings.No;
				lvi.SubItems[(int)ListViewOrder.FileSize].Text = lvi.Size.ToString("n0");
				lvi.SubItems[(int)ListViewOrder.Location].Text = ListViewStrings.LocationExe;
				contents.Items.Add(lvi);
				//debugLog.Log("Exe section size = " + lvi.Size.ToString("n0"));
				//Check for exe with no attached data
				if (lvi.Size == (int)fs.Length)
				{
					//debugLog.Log("Exe has no appended data");
					return;
				}
			}
			else
			{
				//it's a pck file so files start at begining of file
				//debugLog.Log("Exe signiture not found, assuming .pck");
				fs.Seek(0, SeekOrigin.Begin);
			}
			//add attached files
			int nameLength = 1;
			while (nameLength > 0 && nameLength < 500 && fs.Position < fs.Length)
			{
				lvi = new ListViewFileItem();
				nameLength = br.ReadInt32();
				//MessageBox.Show(nameLength.ToString());
				if (nameLength > 0 && nameLength < 500)
				{
					//file
					lvi.SubItems[(int)ListViewOrder.Name].Text = Encoding.ASCII.GetString(br.ReadBytes(nameLength));
					lvi.Size = br.ReadInt32();
					lvi.Offset = (int)fs.Position;
					//debugLog.Log(DbcRemoveNull(lvi.Text).PadRight(26, ' ') + " Size :" + lvi.Size.ToString("n0").PadRight(10, ' ') +
					//			 " Offset :" + lvi.Offset.ToString("n0"));
					//check for _virtual.dat
					if (lvi.SubItems[(int)ListViewOrder.Name].Text == ListViewStrings.VirtualDat)
					{
						//get display settings
						win.displayMode = br.ReadInt32();
						int Width = br.ReadInt32();
						int Height = br.ReadInt32();
						int Depth = br.ReadInt32();
						win.displayWidth = Width;
						win.displayHeight = Height;
						win.displayDepth = Depth;
						contents.ContextMenu.MenuItems[window.MENU_DISPLAY].Text =
							proExe.getDisplayString(Width, Height, Depth, win.displayMode);
						contents.ContextMenu.MenuItems[window.MENU_DISPLAY].Enabled = true;
						fs.Seek(-16, SeekOrigin.Current);
					}
					fs.Seek(lvi.Size, SeekOrigin.Current);
					lvi.SubItems[(int)ListViewOrder.FileType].Text = ListViewStrings.Yes;
					lvi.SubItems[(int)ListViewOrder.Upx].Text = ListViewStrings.No;
					lvi.SubItems[(int)ListViewOrder.NullString].Text = ListViewStrings.No;
					lvi.SubItems[(int)ListViewOrder.FileSize].Text = lvi.Size.ToString("n0");
					lvi.SubItems[(int)ListViewOrder.Location].Text = ListViewStrings.LocationExe;
				}
				else
				{
					//compressed or extra data
					lvi.SubItems[(int)ListViewOrder.Name].Text = ListViewStrings.ExtraData;
					lvi.Offset = (int)fs.Position - 4;
					lvi.Size = (int)(fs.Length - (fs.Position - 4));
					lvi.SubItems[(int)ListViewOrder.FileType].Text = ListViewStrings.No;
					lvi.SubItems[(int)ListViewOrder.Upx].Text = ListViewStrings.No;
					lvi.SubItems[(int)ListViewOrder.NullString].Text = ListViewStrings.No;
					lvi.SubItems[(int)ListViewOrder.FileSize].Text = lvi.Size.ToString("n0");
					lvi.SubItems[(int)ListViewOrder.Location].Text = ListViewStrings.LocationExe;
					fs.Seek(-4, SeekOrigin.End);
					extraDataSize = br.ReadInt32();
					//debugLog.Log("Extra data size :" + lvi.Size.ToString("n0") + " reported exe section size :" +
					//			 extraDataSize.ToString("n0"));
					//if (extraDataSize != exeSectionSize)
					//	debugLog.Log("Warning exe section size reported in extra data does not match actual exe section size");
				}
				contents.Items.Add(lvi);
			}
		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.ToString(), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
		}
		finally
		{
			if (br != null)
				br.Close();
			if (fs != null)
				fs.Close();
		}
		//debugLog.StopSection();
	}
示例#30
0
	public static void SaveExe(ListView contents, string fileName, string oldName, bool dbPro, window win)
	{
		FileStream fsExe = null;   //old dbpro exe
		BinaryReader brExe = null;
		FileStream fsOut = null;   //new dbpro exe
		BinaryWriter bwOut = null;
		FileStream fsFile;         //current file being written
		BinaryReader brFile;
		string name;
		bool overWrite = false; //has oldName been overwritten
		int exeSection = -1;    //size of exeSection
		try
		{
			if (fileName == oldName)
			{
				//Trying to overwrite file so move old name to %temp% before opening
				File.Move(oldName, Path.GetTempPath() + Path.GetFileName(oldName));
				oldName = Path.GetTempPath() + Path.GetFileName(oldName);
				overWrite = true;
			}
			if (oldName != "")
			{
				//if there is an old dbpro exe load it
				fsExe = new FileStream(oldName, FileMode.Open);
				brExe = new BinaryReader(fsExe);
			}
			//open new exe
			fsOut = new FileStream(fileName, FileMode.Create);
			bwOut = new BinaryWriter(fsOut);
			foreach (ListViewFileItem lvi in contents.Items)
			{
				if (lvi.SubItems[(int)ListViewOrder.Location].Text == ListViewStrings.LocationExe)
				{
					//internal file
					fsFile = fsExe;
					brFile = brExe;
				}
				else
				{
					//external file
					fsFile = new FileStream(lvi.SubItems[(int)ListViewOrder.Location].Text, FileMode.Open);
					brFile = new BinaryReader(fsFile);
				}
				//seek to data start
				fsFile.Seek(lvi.Offset, SeekOrigin.Begin);
				//name
				if (lvi.SubItems[(int)ListViewOrder.FileType].Text == ListViewStrings.Yes)
				{
					//is a normal file so write name and filedata length
					name = DbcRemoveNull(lvi.Text);
					if (dbPro == false)
						name = DbcAddNull(name);
					bwOut.Write(name.Length);
					bwOut.Write(Encoding.ASCII.GetBytes(name));
				}
				//check for _virtual.dat
				if (lvi.Text == ListViewStrings.VirtualDat)
				{
					//size
					bwOut.Write(lvi.Size);
					//write display settings
					bwOut.Write(win.displayMode);
					bwOut.Write(win.displayWidth);
					bwOut.Write(win.displayHeight);
					bwOut.Write(win.displayDepth);
					//write data
					fsFile.Seek(16, SeekOrigin.Current);
					bwOut.Write(brFile.ReadBytes(lvi.Size - 16));
				}
				else
				{
					//not _virtual.dat
					if (lvi.SubItems[(int)ListViewOrder.FileType].Text == ListViewStrings.No &&
						lvi.SubItems[(int)ListViewOrder.Name].Text == ListViewStrings.ExtraData)
					{
						//extra data so write exeSection size at end of extra data
						bwOut.Write(brFile.ReadBytes(lvi.Size - 4));
						bwOut.Write(exeSection);
					}
					else
					{
						//not _virtual.dat or extra data
						int written = WriteData(fsFile, brFile, lvi, bwOut);
						if (lvi.SubItems[(int)ListViewOrder.Name].Text == ListViewStrings.ExeSection)
						{
							//set exeSection size if it was written
							exeSection = written;
						}
					}
				}
				if (lvi.SubItems[(int)ListViewOrder.Location].Text != ListViewStrings.LocationExe)
				{
					//close external file
					brFile.Close();
					fsFile.Close();
				}
			}
		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.ToString(), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
		}
		finally
		{
			if (brExe != null)
				brExe.Close();
			if (fsExe != null)
				fsExe.Close();
			if (bwOut != null)
				bwOut.Close();
			if (fsOut != null)
				fsOut.Close();
			//delete oldName in temp dir if required
			if (overWrite == true)
			{
				File.Delete(oldName);
			}
		}
	}
示例#31
0
 => Error.ThrowLastErrorIfFalse(Imports.CreateCaret(window, bitmap, size.Width, size.Height));
示例#32
0
 public static void Load(window w)
 {
     win = w;
     Log = new Queue <char>();
 }
示例#33
0
        static void Main(string[] args)
        {
            //new
            string        path = @"C:\Users\utesh\Desktop\PP2"; // path of the root directory
            DirectoryInfo dir  = new DirectoryInfo(path);       // information about root directory

            Stack <window> windows = new Stack <window>();      // create a stack of windows to be able to restore previous windows

            windows.Push(new window(dir.GetFileSystemInfos())); // add a window for a root

            while (true)
            {
                window cur = windows.Peek();          // get current window from top of the stack
                cur.draw();                           // print this window
                ConsoleKeyInfo k = Console.ReadKey(); // read from keyboard
                if (k.Key == ConsoleKey.UpArrow)
                {                                     // if key is upArrow
                    if (cur.cursor > 0)               // if it will not go out of the bounderies
                    {
                        cur.cursor--;                 // move cursor up
                    }
                }
                if (k.Key == ConsoleKey.DownArrow)
                {                                         // if key is downArrow
                    if (cur.cursor + 1 < cur.list.Length) // if it will not go out of the bounderies
                    {
                        cur.cursor++;                     // move cursor down
                    }
                }
                if (k.Key == ConsoleKey.Enter)                      // if key is enter
                {
                    string newpath = cur.list[cur.cursor].FullName; // created a path for a file under cursor
                    if (Directory.Exists(newpath))                  // if it's directory, create new window in directory path
                    {
                        windows.Push(new window((new DirectoryInfo(newpath)).GetFileSystemInfos()));
                    }
                    else
                    {
                        var p = new Process();                       // create a process
                        p.StartInfo = new ProcessStartInfo(newpath); // set path for the process
                        p.StartInfo.UseShellExecute = true;          // make it executable
                        p.Start();                                   // open it promptly
                    }
                }
                if (k.Key == ConsoleKey.Backspace) // if key is backspace
                {
                    if (windows.Count > 1)         // if the number of windows is larger than 1
                    // there must be always at least one window in the stack
                    {
                        windows.Pop(); // pop the current window, and return to the previous directory (from which we entered)
                    }
                }
                if (k.Key == ConsoleKey.F2)                                                         // if key is F2, rename the filename under the cursor
                {
                    Console.WriteLine("Enter new name:");                                           // ask an user to enter the new name
                    string name = Console.ReadLine();                                               // new name is red
                    string prev = cur.list[cur.cursor].FullName;                                    // old name

                    string next = Path.Combine(Path.GetDirectoryName(prev), name);                  // path for the new name
                    Directory.Move(prev, next);                                                     // move from old name to the new name (ala rename)
                    cur.list = new DirectoryInfo(Path.GetDirectoryName(prev)).GetFileSystemInfos(); // update current list of files in the current window
                }
                if (k.Key == ConsoleKey.Delete)                                                     // if the key is delete, delete under the cursor
                {
                    FileSystemInfo x     = cur.list[cur.cursor];                                    // get info about file under the cursor
                    string         xpath = x.FullName;                                              // get file path
                    Console.Clear();                                                                // clear the console
                    Console.WriteLine("Do you want to delete {0} ?\nPress [Y/N]", x.Name);          // Ask user to whether to proceed or not.
                    ConsoleKeyInfo res = Console.ReadKey();                                         // reading a key to obtain an answer for the question
                    while (res.Key != ConsoleKey.Y && res.Key != ConsoleKey.N)                      // if the pressed key isn't defined in the question then keep pressing the key until Y or N not pressed
                    {
                        res = Console.ReadKey();                                                    // read the key
                    }
                    if (res.Key == ConsoleKey.Y)
                    {
                        string prDir = Path.GetDirectoryName(xpath); // parent directory of the file
                        if (Directory.Exists(xpath))                 // if it's directory
                        {
                            Directory.Delete(xpath, true);           // delete directory and all subfiles in it recusrively
                        }
                        else // if it's a file
                        {
                            File.Delete(xpath);                                   // delete the file
                        }
                        cur.list = new DirectoryInfo(prDir).GetFileSystemInfos(); // update a list of files in the current window
                    }
                }
            }
            // ConsoleKeyInfo x;
            // x.Key = ConsoleKey.ctrl
            // // when the programm is over, return default color of the window
            // Console.BackgroundColor = ConsoleColor.Black;
        }
示例#34
0
 ShowWindow(window, createMode);
示例#35
0
 private set => SetProperty(ref window, value);
示例#36
0
 CreateSizeDependentResources(window, newSize);
示例#37
0
        public static Building ToT3D(this RelationCluster relationCluster, Building building)
        {
            if (building == null || relationCluster == null)
            {
                return(null);
            }

            Dictionary <Guid, Aperture> dictionary_Apertures = new Dictionary <Guid, Aperture>();

            List <Panel> panels = relationCluster.GetObjects <Panel>();

            if (panels != null)
            {
                foreach (Panel panel in panels)
                {
                    if (panel == null)
                    {
                        continue;
                    }

                    List <Aperture> apertures_Panel = panel.Apertures;
                    if (apertures_Panel != null)
                    {
                        foreach (Aperture aperture in apertures_Panel)
                        {
                            dictionary_Apertures[aperture.Guid] = aperture;
                        }
                    }

                    if (panel.PanelType == PanelType.Shade)
                    {
                        shade shade = panel.ToT3D_Shade(building);
                    }
                    else
                    {
                        Element element = panel.ToT3D(building);
                    }
                }
            }

            List <Aperture> apertures = relationCluster.GetObjects <Aperture>();

            if (apertures != null)
            {
                foreach (Aperture aperture in apertures)
                {
                    if (aperture == null)
                    {
                        continue;
                    }

                    dictionary_Apertures[aperture.Guid] = aperture;
                }
            }

            foreach (Aperture aperture in dictionary_Apertures.Values)
            {
                window widnow = aperture.ToT3D(building);
            }

            return(building);
        }