|
thanks for your reply
Could you tell me how can I add the breakpoint in doc?
|
|
|
|
|
Hi,
i am looking for a way to extract the entire content of a zip file into a folder without using any external dependencies like Interop.Shell32.dll or 3rd-Party Libs like DotNetZip etc. The entire thing should run from within a single assembly. I personally would like to use the Windows build-in ZIP-Shell extension available from windows XP to Win10 by accessing it with preferably late binding via .NET/C#, but i am kinda stuck on how to do it and what the COM-Interfaces/Types for that should look like. Any help would be really higly appreciated.
best
K.
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
-----------------------
"This reply is provided as is, without warranty express or implied."
|
|
|
|
|
Zipping using System.IO.Compression[^]
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Hi Eddy,
thanks for the answer. I forgot one thing to mention here, that the application is using the 2.0 .NET Framework and cant compiled against anything else for compatibility use with other libraries/references included. The System.IO.Compression needs at least 4.5 Framework.
best
K.
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
-----------------------
"This reply is provided as is, without warranty express or implied."
|
|
|
|
|
Kerem Guemruekcue wrote: I forgot one thing to mention here, that the application is using the 2.0 .NET Framework and cant compiled against anything else for compatibility use with other libraries/references included. The System.IO.Compression needs at least 4.5 Framework. It doesn't; it is part of 2.0.
See MSDN[^].
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
This is true in terms of availability of the namespace, but the unzipping zip file classes are available starting 4.5 FW. See for yourself: ZipFile Class (System.IO.Compression)[^]
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
-----------------------
"This reply is provided as is, without warranty express or implied."
|
|
|
|
|
Kerem Guemruekcue wrote: This is true in terms of availability of the namespace, but the unzipping zip file classes are available starting 4.5 FW. See for yourself You are referring to a helper-class that simplifies the tasks. The GZipStream is available in 2.0, and you could zip/unzip in 2.0 without using third-party libraries. Example on MSDN[^].
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I am not sure how this will help me to unpack a zip file into a folder. The example there only shows how to compress/decompress a single file with GZip compression. I am familiar with that mechanism and it would be overkill to reinvent a library from Deflate/GZip classes in .NET to create a unpacker for folders packet into a zip container file. The example works just fine on a single file, but not on a Zip archive.
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
-----------------------
"This reply is provided as is, without warranty express or implied."
|
|
|
|
|
Kerem Guemruekcue wrote: I am not sure how this will help me to unpack a zip file into a folder. The example there only shows how to compress/decompress a single file with GZip compression. I am familiar with that mechanism and it would be overkill to reinvent a library from Deflate/GZip classes in .NET to create a unpacker for folders packet into a zip container file. Then use one of the existing libraries. Did you not state you did not want a dependency on things like SharpZipLib and DotNetZip?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Quote: Then use one of the existing libraries. Did you not state you did not want a dependency on things like SharpZipLib and DotNetZip?
Yes, i did and thats why i was prefering the late binding option to the shell zip functionality build into windows. As said, the entire thing should be running from a single exe file with no extra libs attached. the zip com extension is available from XP up to 10. using the GZip/Deflate classes in that namespace supporting .NET 2.0 would require to implement a full unzipper for zip containers in zip format like implemented in the helper classes available starting 4.5 FW. that would be a total overkill.
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
-----------------------
"This reply is provided as is, without warranty express or implied."
|
|
|
|
|
|
Hi Richard,
thanks for the answer. Yes, i have seen that article before, but this uses early binding with a com wrapper. Thats the easy way, but i am looking for late binding at runtime with no additionall assembly file, like this project uses.
best
K.
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
-----------------------
"This reply is provided as is, without warranty express or implied."
|
|
|
|
|
I have a MEF plugin that runs test for a medical instrument. The instrument starts the test service, and that service loads the MEF plugin and calls it's Execute method. This all runs in another thread.
The MEF plugin gets its settings from a Config file. Changes are made to the Config file using an editor designed for it. This editor is a stand alone EXE not connected to the instrument in any way.
The configuration can be set to run the tests for [n] times. This gives techs time to look at the instrument while its running.
1) Instrument starts the test process.
2) Test process loads the MEF plugin.
3) MEF plugin reads config file.
4) Tests inside the plugin execute using settings from config file.
5) At end of test, start next iteration until [n] is reached. Goto step 4.
What I'm wondering is this... Is it possible for an external EXE to somehow get data from the MEF plugin in real time? And, it also could commands be sent into the plugin, such as stop, pause, etc?
Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
You could easily use self-hosted WCF to do this. Set it up to publish messages via named pipes and it'll run no problem.
This space for rent
|
|
|
|
|
Thanks, I'll look into that
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
I don't like the bloat of WCF, but you can do secure named pipes pretty trivially without it.
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
Self hosted WCF doesn't add much at all. It's incredibly trivial.
This space for rent
|
|
|
|
|
I've never used PredicateBuilder before. If anyone has used it, I could use some help
List<PurchasingEntity> results = null;
IQueryable<PurchasingEntity> query = (from c in db.Companies
join p in db.Projects on c.Id equals p.CompanyId
join j in db.Jobs on p.Id equals j.ProjectId
select new PurchasingEntity
{
CompanyId = c.Id,
ProjectId = p.Id,
JobId = j.Id,
Phase = j.Phase,
Quantity = j.Quantity.HasValue ? j.Quantity.Value : 0,
StartDate = j.StartDate.HasValue ? j.StartDate : null
});
var predicate = PredicateBuilder.True<Purchasing>();
if (companyId > 0)
{
predicate = predicate.And(i => i.CompanyId == companyId);
}
if (projectId > 0)
{
predicate = predicate.And(i => i.ProjectId == projectId);
}
if (startDate != null)
{
predicate = predicate.And(i => i.StartDate >= startDate);
}
if (endDate != null)
{
predicate = predicate.And(i => i.StartDate <= endDate);
}
results = query.Where(predicate);
return results.ToList();
The compilation error is
cannot convert from 'System.Linq.Expressions.Expression<System.Func<Jayhawk.DAL.DataContext.Purchasing, bool>>' to 'System.Linq.Expressions.Expression<System.Func<Jayhawk.Entities.PurchasingEntity, int, bool>>'
Not quitre sure what's wrong here? Can anyone help?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
List<PurchasingEntity> results = null;
<pre>IQueryable<PurchasingEntity> query =
var predicate = PredicateBuilder.True<Purchasing>();
results = query.Where(predicate);
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
I must have stared at that for an hour. Just didn't see it
var predicate = PredicateBuilder.True<PurchasingEntity>();
.
.
.
results = query.Where(predicate).ToList();
This works now
Thanks!
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Bugger that looked really useful but it is in c#7, VS 2017. We are stuck with 2015.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
public static class PredicateBuilder
{
public static Expression<Func<T, bool>> True<T>() { return f => true; }
public static Expression<Func<T, bool>> False<T>() { return f => false; }
public static Expression<Func<T, bool>> Or<T>(this Expression<Func<T, bool>> expr1,
Expression<Func<T, bool>> expr2)
{
var invokedExpr = Expression.Invoke(expr2, expr1.Parameters.Cast<Expression>());
return Expression.Lambda<Func<T, bool>>
(Expression.OrElse(expr1.Body, invokedExpr), expr1.Parameters);
}
public static Expression<Func<T, bool>> And<T>(this Expression<Func<T, bool>> expr1,
Expression<Func<T, bool>> expr2)
{
var invokedExpr = Expression.Invoke(expr2, expr1.Parameters.Cast<Expression>());
return Expression.Lambda<Func<T, bool>>
(Expression.AndAlso(expr1.Body, invokedExpr), expr1.Parameters);
}
}
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
It will cause an error because you are assigning IQueryable to List.
You can try this:
results = query.Where(predicate).ToList();
return results
I didn't used PredicateBuilder but i used System.Linq.Dynamic to create dynamic filtering or order by.
[Signature space for sale]
|
|
|
|
|
Hi All
I have an xml file.
<?xml version="1.0" encoding="utf-8"?>
<Achievements>
<Achievement number="208">
<Target>100</Target>
<CurrentStatus>0</CurrentStatus>
<AchievementText>Collect 150 Stars</AchievementText>
<Header>Star Genius</Header>
<Reward>500</Reward>
<Experience>10</Experience>
<AchievementCollected>False</AchievementCollected>
<AchievementCompleted>False</AchievementCompleted>
<Test>7</Test>
</Achievement>
<Achievement number="209">
<Target>100</Target>
<CurrentStatus>0</CurrentStatus>
<AchievementText>Collect 200 Stars</AchievementText>
<Header>Star Genius</Header>
<Reward>500</Reward>
<Experience>10</Experience>
<AchievementCollected>False</AchievementCollected>
<AchievementCompleted>False</AchievementCompleted>
<Test>8</Test>
</Achievement>
<Achievement number="210">
<Target>100</Target>
<CurrentStatus>0</CurrentStatus>
<AchievementText>Collect 250 Stars</AchievementText>
<Header>Star Genius</Header>
<Reward>500</Reward>
<Experience>10</Experience>
<AchievementCollected>False</AchievementCollected>
<AchievementCompleted>False</AchievementCompleted>
<Test>9</Test>
</Achievement>
<Achievement number="211">
<Target>100</Target>
<CurrentStatus>0</CurrentStatus>
<AchievementText>Collect 300 Stars</AchievementText>
<Header>Star Genius</Header>
<Reward>500</Reward>
<Experience>10</Experience>
<AchievementCollected>False</AchievementCollected>
<AchievementCompleted>False</AchievementCompleted>
<Test>10</Test>
</Achievement>
<Achievement number="6">
<Target>1</Target>
<CurrentStatus>1</CurrentStatus>
<AchievementText>Collect 1 Star </AchievementText>
<Header>Star Collector</Header>
<Reward>100</Reward>
<Experience>10</Experience>
<AchievementCollected>True</AchievementCollected>
<AchievementCompleted>True</AchievementCompleted>
<Test>200</Test>
</Achievement>
<Achievement number="7">
<Target>5</Target>
<CurrentStatus>5</CurrentStatus>
<AchievementText>Collect 5 Star </AchievementText>
<Header>Star Collector</Header>
<Reward>100</Reward>
<Experience>10</Experience>
<AchievementCollected>True</AchievementCollected>
<AchievementCompleted>True</AchievementCompleted>
<Test>300</Test>
</Achievement>
<Achievement number="8">
<Target>10</Target>
<CurrentStatus>10</CurrentStatus>
<AchievementText>Collect 10 Star </AchievementText>
<Header>Star Collector</Header>
<Reward>100</Reward>
<Experience>10</Experience>
<AchievementCollected>True</AchievementCollected>
<AchievementCompleted>True</AchievementCompleted>
<Test>400</Test>
</Achievement>
<Achievement number="9">
<Target>25</Target>
<CurrentStatus>25</CurrentStatus>
<AchievementText>Collect 25 Star </AchievementText>
<Header>Star Collector</Header>
<Reward>100</Reward>
<Experience>10</Experience>
<AchievementCollected>True</AchievementCollected>
<AchievementCompleted>True</AchievementCompleted>
<Test>500</Test>
</Achievement>
<Achievement number="10">
<Target>30</Target>
<CurrentStatus>30</CurrentStatus>
<AchievementText>Collect 50 Star </AchievementText>
<Header>Star Collector</Header>
<Reward>100</Reward>
<Experience>10</Experience>
<AchievementCollected>True</AchievementCollected>
<AchievementCompleted>True</AchievementCompleted>
<Test>600</Test>
</Achievement>
<Achievement number="11">
<Target>40</Target>
<CurrentStatus>40</CurrentStatus>
<AchievementText>Collect 100 Stars</AchievementText>
<Header>Star Genius</Header>
<Reward>500</Reward>
<Experience>10</Experience>
<AchievementCollected>True</AchievementCollected>
<AchievementCompleted>True</AchievementCompleted>
<Test>700</Test>
</Achievement>
</Achievements>
In the Achievement number is randomly printed. So i have to avoid this. Whatever no may there. it should be reprinted by 1 to end no . that means
<?xml version="1.0" encoding="utf-8"?>
<Achievements>
<Achievement number="1">
<Target>100</Target>
<CurrentStatus>0</CurrentStatus>
<AchievementText>Collect 150 Stars</AchievementText>
<Header>Star Genius</Header>
<Reward>500</Reward>
<Experience>10</Experience>
<AchievementCollected>False</AchievementCollected>
<AchievementCompleted>False</AchievementCompleted>
<Test>7</Test>
</Achievement>
<Achievement number="2">
<Target>100</Target>
<CurrentStatus>0</CurrentStatus>
<AchievementText>Collect 200 Stars</AchievementText>
<Header>Star Genius</Header>
<Reward>500</Reward>
<Experience>10</Experience>
<AchievementCollected>False</AchievementCollected>
<AchievementCompleted>False</AchievementCompleted>
<Test>8</Test>
</Achievement>
<Achievement number="3">
<Target>100</Target>
<CurrentStatus>0</CurrentStatus>
<AchievementText>Collect 250 Stars</AchievementText>
<Header>Star Genius</Header>
<Reward>500</Reward>
<Experience>10</Experience>
<AchievementCollected>False</AchievementCollected>
<AchievementCompleted>False</AchievementCompleted>
<Test>9</Test>
</Achievement>
<Achievement number="4">
<Target>100</Target>
<CurrentStatus>0</CurrentStatus>
<AchievementText>Collect 300 Stars</AchievementText>
<Header>Star Genius</Header>
<Reward>500</Reward>
<Experience>10</Experience>
<AchievementCollected>False</AchievementCollected>
<AchievementCompleted>False</AchievementCompleted>
<Test>10</Test>
</Achievement>
<Achievement number="5">
<Target>1</Target>
<CurrentStatus>1</CurrentStatus>
<AchievementText>Collect 1 Star </AchievementText>
<Header>Star Collector</Header>
<Reward>100</Reward>
<Experience>10</Experience>
<AchievementCollected>True</AchievementCollected>
<AchievementCompleted>True</AchievementCompleted>
<Test>200</Test>
</Achievement>
<Achievement number="6">
<Target>5</Target>
<CurrentStatus>5</CurrentStatus>
<AchievementText>Collect 5 Star </AchievementText>
<Header>Star Collector</Header>
<Reward>100</Reward>
<Experience>10</Experience>
<AchievementCollected>True</AchievementCollected>
<AchievementCompleted>True</AchievementCompleted>
<Test>300</Test>
</Achievement>
<Achievement number="7">
<Target>10</Target>
<CurrentStatus>10</CurrentStatus>
<AchievementText>Collect 10 Star </AchievementText>
<Header>Star Collector</Header>
<Reward>100</Reward>
<Experience>10</Experience>
<AchievementCollected>True</AchievementCollected>
<AchievementCompleted>True</AchievementCompleted>
<Test>400</Test>
</Achievement>
<Achievement number="8">
<Target>25</Target>
<CurrentStatus>25</CurrentStatus>
<AchievementText>Collect 25 Star </AchievementText>
<Header>Star Collector</Header>
<Reward>100</Reward>
<Experience>10</Experience>
<AchievementCollected>True</AchievementCollected>
<AchievementCompleted>True</AchievementCompleted>
<Test>500</Test>
</Achievement>
<Achievement number="9">
<Target>30</Target>
<CurrentStatus>30</CurrentStatus>
<AchievementText>Collect 50 Star </AchievementText>
<Header>Star Collector</Header>
<Reward>100</Reward>
<Experience>10</Experience>
<AchievementCollected>True</AchievementCollected>
<AchievementCompleted>True</AchievementCompleted>
<Test>600</Test>
</Achievement>
<Achievement number="10">
<Target>40</Target>
<CurrentStatus>40</CurrentStatus>
<AchievementText>Collect 100 Stars</AchievementText>
<Header>Star Genius</Header>
<Reward>500</Reward>
<Experience>10</Experience>
<AchievementCollected>True</AchievementCollected>
<AchievementCompleted>True</AchievementCompleted>
<Test>700</Test>
</Achievement>
</Achievements>
How can i make the C# code for that.... How to check the achivement number
start to end...
start 1 to end = how much count ...
C#...
how can i do it..
code project is very weell
|
|
|
|
|
What code have you got so far? Have you read the XML in yet?
This space for rent
|
|
|
|