Get Build Action from Roslyn API? - roslyn

Using the Roslyn (Microsoft.CodeAnalysis) APIs, how do I get the Build Action and Copy to Output Directory File Properties? I'm able to open the project file and get the documents, but not sure how to get the file properties.
Opening the project and looping over the filesis easy enough. I just want to know what the build action is of each.
open Microsoft.CodeAnalysis.MSBuild
use ws = MSBuildWorkspace.Create()
let pr = ws.OpenProjectAsync proj |> Async.RunTask
for doc in pr.Documents do
printfn "file %s" doc.FilePath

Roslyn's API doesn't surface things the compiler doesn't care about or need for language analysis. In this case you'll want to use the MSBuild APIs directly.

Here's one way to retrieve the item type (also known as build action) of an item with just the project id (Guid from Roslyn's ProjectId.Id) and the Document.FilePath: http://www.cazzulino.com/item-type-from-file.html

Related

Change ROOTDRIVE and DIRPROPERTY values for an MSI in InstallShield 2016 if Target Drive Doesn't Exist

I have an MSI I've put together in InstallShield, the default values for the two properties are ROOTDRIVE = D: | DIRPROPERTY1 = D:\
What I'm trying to achieve is on install if the drive isn't found redirect/revert to C: & C:\
I tried using a custom action but I wasnt to good at applying it.
In VBScript, try using following method to set directory with your own logic of drive not found:
Session.TargetPath("INSTALLDIR") = custom value
Also, make sure to schedule this custom action after CostFinalize standard action.

How do I teach WebStorm 9 inspector to recognize Angular Material Design tags/attributes?

Currently, all my angular material HTML attributes are highlighted in yellow with WebStorm 9 (Mac OS X Yosemite) warning: "Attribute [name] is not allowed here".
How can I teach WS to automatically recognize these attributes as valid? I am aware that I can add each one one-by-one to the list of custom attributes, but was hoping that there would be a better way to do this.
UPDATE:
Just wanted to clarify that this issue applies to Angular Material project, and not the AngularJS itself.
You need to add the angular-material.js file as a Library in WebStorm:
Open Preferences (Mac: Cmd+,, Win/Linux: Ctrl+Alt+S)
Go to Languages & Frameworks > JavaScript > Libraries
Click Add and then press the + icon
Find angular-material.js in your node_modules folder
Add a Name and a version and press Ok
Now you will have completions for all elements and attributes that have an #ngdoc documentation in the angular-material source code.
Usage
Start typing and you will see the completions:
Pressing F1 (Ctrl+Q on Win/Linux) will also show some docs, if available in the source code:
Important note
Not all features are properly documented, the following won't show up (unless you already used them) cause they are defined dynamically in a loop, with no #ngdoc for them:
var API_WITH_VALUES = [ "layout", "flex", "flex-order", "flex-offset", "layout-align" ];
var API_NO_VALUES = [ "show", "hide", "layout-padding", "layout-margin" ];
So for these you'd have to add them as a custom attribute (Alt+Enter > "Add flex to custom html attributes").
Environment
Tested on a Mac OS X 10.11.4 using WebStorm 2016.1.1, but this should work for older versions as well.
I am using PHPStorm, which is a sister Project of WebStorm, but it should work the same way.
You maybe need to add the Library:
File
Settings
Languages & Frameworks
Javascript
Librarys
Add here AngularJS
If this does not work, you can add them manually:
Follow this Steps:
File
Default Settings
Editor
Inspection
HTML
Unknown HTML tag attributes
To the right you will see in Options "Custom HTML tag attributes". Enter here the attributes you want to allow.
I highly recomend you to install the Angular.js plugin:
Go to menu File > Settings (or ctrl + alt + S if you're on Windows);
Select Plugins in the window that'll open;
Click in the Browse Repositories button;
Type AngularJS in the search field. Select the plugin;
Click Install Plugin.
The plugin is incumbed to read #ngdoc annotations present in ngMaterial sources and create documentation for their directives.
It seems to support WebStorm and other IDEs, but I could not find it in the plugin registry while filtering by other IDEs. Maybe it'll work inside WebStorm...
Anyway, this is what you get:
You have also a plugin that helps a lot, check it out. It helps a lot
Angular material v2, Teradata covalent v1, Angular flex layout v1 & Material icon live templates
And with the solution provided by #Alex Ilyaev gives a lot of help.
But its no perfect.
Hope it helps.
Currently I don't think that idea's AngularJS plugin understands angular-materials attribute extensions.
It does understand the directives i.e. control click <md-button ...> and the directive (custom tag) is found.
For now you will have to add the attributes af custom attributes in order to get a "green" page.

Possible to add tags to custom file?

For MS Office files, like a docx file, image files etc you can set searchable tags from properties in Windows Explorer, see image.
If I have my own custom file format, how can I add that to the details page of my file?
I've been looking at shell extensions, but that doesn't seem to be the way to go. My custom file format is a compound file, so basically a zip archive.
And if it is a shell extension that I should use to enable that for my own custom file, then please which one is it? I've been looking at "The Complete Idiot's Guide to Writing Shell Extensions" but I didn't find anything there, only how to add a new property page.
I'm using MFC.
Thanks!
For Vista and later:
1) Create shell extension implements IPropertyStore, IPropertyStoreCapabilities and IInitializeWithStream. if your cannot work with stream implement IInitializeWithFile instead of IInitializeWithStream. A lot of details.
2) IPropertyStore.GetCount must return number of properties you need. In case you described it must return 1.
3) IPropertyStore.GetAt must return PKEY of your properties. In case you described it must return PKEY_Keywords.
4) Inside IPropertyStore.GetValue you must read your Tags from your zip file and return them in function result.
5) Inside IPropertyStore.SetValue you must store new value in internal memory storage.
6) Inside IPropertyStore.Commin you must store new value from internal memory storage to your real zip file.
7) IPropertyStoreCapabilities.IsPropertyWritable must return S_OK if you want user to edit your property.
8) Create reg value:
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SystemFileAssociations\.myzip]
"FullDetails"="prop:System.PropGroup.Description;System.Keywords;System.PropGroup.FileSystem;System.ItemNameDisplay;System.ItemTypeText;System.ItemFolderPathDisplay;System.Size;System.DateCreated;System.DateModified;System.FileAttributes;*System.OfflineAvailability;*System.OfflineStatus;*System.SharedWith;*System.FileOwner;*System.ComputerName"
You can try to replace HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SystemFileAssociations.myzip with HKEY_CLASSES_ROOT.myzip. Don`t forget to change .myzip to your extension.
9) Enjoy the result:
For XP:
1) Create shell extension implements IColumnProvider. Part VIII of The Complete Idiot's Guide to Writing Shell Extensions.
2) If you want user to edit your Tags you must create Property Sheet shell extension.

JSX script to Photoshop action - Is it possible?

I wonder if there exist a method to convert a simple JSX script to an action.
I have created an action and converted it to jsx in order to clean and edit it. Now, I want to convert it back to atn in order to use a keybord shorcut.
PS: I did create an action (with ctrl+F12 assigned) that calls the script, but I'd like to have a not dependant action.
Copy the JSX file into your Photoshop Script folder (PHOTOSHOP_INSTALL_FOLDER/Presets/Scripts).
For example:
C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)\Presets\Scripts
/Applications/Adobe Photoshop CC 2018/Presets/Scripts
Once your script is there, restart Photoshop and you see it under File > Scripts and you should be able assign keyboard shortcut to that easily using Edit -> Keyboard Shortcuts -> File (expand this) -> Scripts (expand this)
Note: If you place text like this at the top of your .jsx file, YOUR DESCRIPTION will show up on the Scripts menu:
<javascriptresource>
<name>$$$/JavaScripts/YOURNAME/Menu=YOUR DESCRIPITION</name>
<category>Scripts</category>
</javascriptresource>
#target photoshop
You can simply create an action to load the script. That's it.
You can do this by navigating Files>Scripts>Browse while recording an action, then you can assign Shortcut to it.
Hope it will help you.
record an action (with ctrl-f12 assigned) running the script.
The script needs to be in the above stated folder.

File downloader suggestions

I need to provide non-techie user ability to reliable download a few large files (3Gb) from URL without revealing the source URL of the file. Ideally I need single exe (without dependencies) that will download file from URL, specified inside exe: when user click on exe it just need show prompt where to save the file, and(optionally) will provide the user with some progress bar, for instance. The target URL can be specified directly in
the resource section, so I can edit URL path with HEX editor when I need set another path.
Wget are not suitable in my case, as its command line utility and requires user to specify an URL.
You could use the URLDownloadToFile function. Implement the IBindStatusCallback interface to receive progress information.
You really can't hide the source URL. Why are you trying to do that? If an end user runs tcpdump while they are running your program, they'll see where packets are coming from and going to.
I'd just provide them with a small batch file which calls ftp.exe. Tell your end user to drop the .BAT file where the downloaded file should go, and click it.
That solves quite a few problems, e.g. you know that your end user will be able to find the directory.