Ejemplo n.º 1
0
        public FileContentResult Download(string gonderici, string gondericiiki)
        {
            string[] veri       = gonderici.Split('+');
            string   akbit      = veri[0];
            string   birkur     = veri[1];
            string   musteritc  = veri[2];
            string   aktbitdava = veri[3];
            string   davaad     = veri[4];
            string   davaid     = veri[5];

            if (birkur == "k")
            {
                birkur = "bireysel";
            }
            else
            {
                birkur = "kurumsal";
            }
            if (aktbitdava == "s")
            {
                aktbitdava = "aktifdavalar";
            }
            else
            {
                aktbitdava = "bitendavalar";
            }


            //yol oluşturma işlemi
            string sourceyol = "/uploads/" + birkur + "/" + musteritc + "/" + aktbitdava + "/" + davaad + "/" + gondericiiki;
            string random    = randomcharacter2(7);
            string targetyol = "/temp/" + random;
            bool   exists    = System.IO.Directory.Exists(Server.MapPath(targetyol));

            if (!exists)
            {
                System.IO.Directory.CreateDirectory(Server.MapPath(targetyol));
            }
            targetyol += "/" + gondericiiki;
            System.IO.FileInfo file = new System.IO.FileInfo(Server.MapPath(targetyol));

            exists = System.IO.File.Exists(Server.MapPath(targetyol));
            if (!exists)
            {
                System.IO.File.Copy(Server.MapPath(sourceyol), Server.MapPath(targetyol));
            }

            var bytes = System.IO.File.ReadAllBytes(Server.MapPath(targetyol));

            System.IO.Directory.Delete(Server.MapPath(targetyol.Substring(0, 13)), true);

            return(File(bytes, file.GetType().ToString(), gondericiiki));
        }
Ejemplo n.º 2
-1
        public Form1()
        {
            FileInfo fi = new FileInfo(@"c:\temp\DeviceFile.cs");

            InitializeComponent();

            propertyGrid1.SelectedObject = fi;
            propertyGrid2.SelectedObject = fi.GetType();
        }
Ejemplo n.º 3
-1
 /// <summary>
 /// Récupérer les infos du fichier
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 public IExplorerItem GetFileItemInfo(FileInfo fileInfo)
 {
     return new FileItem
     {
         Path = fileInfo.FullName,
         Name = fileInfo.Name,
         ModifiedDate = fileInfo.LastWriteTime,
         Type = fileInfo.GetType().Name,
         Size = fileInfo.Length,
         ChildItems = null
     };
 }
Ejemplo n.º 4
-1
			public File( FileInfo _file ) {
				m_file = _file;
				m_size = _file.Length;
				m_extension = _file.Extension.ToLower();

				try {
					m_fullName = m_file.FullName;
				} catch ( Exception ) {
//					System.Reflection.PropertyInfo	hiddenPathProperty = m_file.GetType().GetProperty( "FullPath", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance );
//					System.Reflection.PropertyInfo[]	hiddenPathProperties = m_file.GetType().GetProperties( System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance );
// 					System.Reflection.FieldInfo[]	hiddenPathFields = m_file.GetType().GetFields( System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance );
// 					System.Reflection.FieldInfo		hiddenPathField = hiddenPathFields.Single( ( pi ) => { return pi.Name == "FullPath"; } );
					System.Reflection.FieldInfo	hiddenPathField = m_file.GetType().GetField( "FullPath", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance );
					m_fullName = hiddenPathField != null ? hiddenPathField.GetValue( m_file ) as string : m_file.Name;
				}
			}
Ejemplo n.º 5
-1
 /**
   * �����ȫ�����Ժ�����ֵ��������дjson��{}������
   * ���ɺ�ĸ�ʽ����
   * "����1":"����ֵ"
   * ����Щ������������ֵд���ַ����б����
   * */
 private List<string> GetObjectProperty(FileInfo o)
 {
     List<string> propertyslist = new List<string>();
     PropertyInfo[] propertys = o.GetType().GetProperties();
     foreach (PropertyInfo p in propertys)
     {
         propertyslist.Add("\"" + p.Name.ToString() + "\":\"" + p.GetValue(o, null) + "\"");
     }
     return propertyslist;
 }
Ejemplo n.º 6
-1
        static void Main(string[] args)
        {
            FileInfo fi = new FileInfo(@"c:\temp\DeviceFile.cs");

            Console.WriteLine(fi.GetType().FullName);
        }