Skip to content

Instantly share code, notes, and snippets.

View imAliAsad's full-sized avatar
:octocat:

Ali Asad imAliAsad

:octocat:
View GitHub Profile
@imAliAsad
imAliAsad / Win32Api.cs
Created March 25, 2018 12:37 — forked from teocomi/Win32Api.cs
Run Revit commands using Win32 API
/// <summary>
/// Run Revit commands using Win32 API
/// </summary>
public class Win32Api
{
[DllImport("user32.dll")]
private static extern IntPtr GetForegroundWindow();
[DllImport("user32.dll")]
static extern bool SetFocus(IntPtr hWnd);
@imAliAsad
imAliAsad / LoadNoHiddenFiles.cs
Created January 17, 2018 08:55
C# don't show the hidden files
var dirs = Directory.GetDirectories(@"C:\")
.Select(d => new { Attr = new DirectoryInfo(d).Attributes, Dir = d })
.Where(x => !x.Attr.HasFlag(FileAttributes.System))
.Where(x => !x.Attr.HasFlag(FileAttributes.Hidden))
.Select(x => x.Dir)
.ToList();
@imAliAsad
imAliAsad / CreateFile.cs
Created January 17, 2018 05:17
Create a file or folder if it doesn't exist in C#
string path = @"E:\FamilyBrowser\";
string FullPath = @"E:\FamilyBrowser\Architecture\Annotation\Cable Tray\Fittings\Channel Horizontal Bend.rfa";
// Extract file path info
var newpath = FullPath.Replace(path, "");
newpath = newpath.Replace(".rfa", "");
newpath = path + @"IMG\" + newpath;
// Store File Path Info
var fileinfo = new System.IO.FileInfo(newpath + ".png");
@imAliAsad
imAliAsad / CopyFiles.bat
Created December 26, 2017 07:20
Copy files to multiple computers in a network by using a batchfile
:: Usage
:: This batch file code is used to copy the files from one computer to all other computers with in a network
:: Make sure you'll have the access to that computer where you wish to copy the file.
:: How to use it
:: Put all the files on the same folder where this batch file is located
:: Put the target.txt file on the same folder where the same batch file is located.
:: target.txt file should contain the target folder address in this format
:: "\\LAE20039\C$\Users\Ali asad\AppData\Roaming\Autodesk\Revit\Addins\2017\"
///
/// Simple pooling for Unity.
/// Author: Martin "quill18" Glaude (quill18@quill18.com)
/// Latest Version: https://gist.github.com/quill18/5a7cfffae68892621267
/// License: CC0 (http://creativecommons.org/publicdomain/zero/1.0/)
/// UPDATES:
/// 2015-04-16: Changed Pool to use a Stack generic.
///
/// Usage:
///