Skip to content

Commit fd1d0eb

Browse files
committed
second chunk
1 parent 8d72d05 commit fd1d0eb

File tree

27 files changed

+79
-1254
lines changed

27 files changed

+79
-1254
lines changed

snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetMessageEnumerator/CPP/mqgetmessageenumerator.cpp

Lines changed: 0 additions & 55 deletions
This file was deleted.

snippets/cpp/VS_Snippets_Remoting/MessageQueue2/cpp/class1.cpp

Lines changed: 12 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ static void CreateQueue(String^ queuePath, bool transactional)
1010
if (!MessageQueue::Exists(queuePath))
1111
{
1212
MessageQueue^ queue = MessageQueue::Create(queuePath, transactional);
13-
queue->Close();
13+
queue->Close();
1414
}
1515
else
1616
{
@@ -127,7 +127,7 @@ void PeekByCorrelationIdStringTimespan()
127127

128128
// Designate a queue to receive the acknowledgement message for this
129129
// message.
130-
msg->AdministrationQueue =
130+
msg->AdministrationQueue =
131131
gcnew MessageQueue(".\\exampleAdminQueue");
132132

133133
// Set the message to generate an acknowledgement message upon its
@@ -144,7 +144,7 @@ void PeekByCorrelationIdStringTimespan()
144144
msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0));
145145

146146
// Connect to the admin queue.
147-
MessageQueue^ adminQueue =
147+
MessageQueue^ adminQueue =
148148
gcnew MessageQueue(".\\exampleAdminQueue");
149149

150150
// Set the admin queue's MessageReadPropertyFilter property to ensure
@@ -287,7 +287,7 @@ void ReceiveByCorrelationIdStringTimespan()
287287

288288
// Designate a queue to receive the acknowledgement message for this
289289
// message.
290-
msg->AdministrationQueue =
290+
msg->AdministrationQueue =
291291
gcnew MessageQueue(".\\exampleAdminQueue");
292292

293293
// Set the message to generate an acknowledgement message upon its
@@ -304,7 +304,7 @@ void ReceiveByCorrelationIdStringTimespan()
304304
msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0));
305305

306306
// Connect to the admin queue.
307-
MessageQueue^ adminQueue =
307+
MessageQueue^ adminQueue =
308308
gcnew MessageQueue(".\\exampleAdminQueue");
309309

310310
// Set the admin queue's MessageReadPropertyFilter property to ensure
@@ -348,7 +348,7 @@ void ReceiveByCorrelationIdStringTransactionType()
348348
msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0));
349349

350350
// Connect to a transactional queue on the local computer.
351-
MessageQueue^ transQueue =
351+
MessageQueue^ transQueue =
352352
gcnew MessageQueue(".\\exampleTransQueue");
353353

354354
// Create a new message in response to the original message.
@@ -404,7 +404,7 @@ void ReceiveByCorrelationIdStringTimespanTransactionType()
404404
msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0));
405405

406406
// Connect to a transactional queue on the local computer.
407-
MessageQueue^ transQueue =
407+
MessageQueue^ transQueue =
408408
gcnew MessageQueue(".\\exampleTransQueue");
409409

410410
// Create a new message in response to the original message.
@@ -457,7 +457,7 @@ void ReceiveByCorrelationIdStringTimespanTransaction()
457457
msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0));
458458

459459
// Connect to a transactional queue on the local computer.
460-
MessageQueue^ transQueue =
460+
MessageQueue^ transQueue =
461461
gcnew MessageQueue(".\\exampleTransQueue");
462462

463463
// Create a new message in response to the original message.
@@ -510,7 +510,7 @@ void ReceiveByCorrelationIdStringTimespanTransaction()
510510
Console::WriteLine("Message.Label: {0}", responseMsg->Label);
511511
Console::WriteLine("Message.CorrelationId: {0}",
512512
responseMsg->CorrelationId);
513-
513+
514514
// </snippet13>
515515
}
516516

@@ -534,7 +534,7 @@ void ReceiveByCorrelationIdStringTransaction()
534534
msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0));
535535

536536
// Connect to a transactional queue on the local computer.
537-
MessageQueue^ transQueue =
537+
MessageQueue^ transQueue =
538538
gcnew MessageQueue(".\\exampleTransQueue");
539539

540540
// Create a new message in response to the original message.
@@ -582,7 +582,7 @@ void ReceiveByCorrelationIdStringTransaction()
582582
// Dispose of the transaction object.
583583
delete transaction;
584584
transQueue->Close();
585-
queue->Close();
585+
queue->Close();
586586
}
587587

588588
// Display the response message's property values.
@@ -822,32 +822,6 @@ void GetAllMessages()
822822
// </snippet21>
823823
}
824824

825-
void GetEnumerator()
826-
{
827-
// <snippet22>
828-
829-
// Connect to a queue on the local computer.
830-
MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue");
831-
832-
// Get an IEnumerator object.
833-
System::Collections::IEnumerator^ enumerator =
834-
queue->GetMessageEnumerator2();
835-
836-
// Use the IEnumerator object to loop through the messages.
837-
while(enumerator->MoveNext())
838-
{
839-
// Get a message from the enumerator.
840-
Message^ msg = (Message^)enumerator->Current;
841-
842-
// Display the label of the message.
843-
Console::WriteLine(msg->Label);
844-
}
845-
846-
queue->Close();
847-
848-
// </snippet22>
849-
}
850-
851825
void SetPermissionsStringAccessRights()
852826
{
853827
// <snippet23>
@@ -1098,4 +1072,4 @@ void main()
10981072
// Write the exception information to the console.
10991073
Console::WriteLine(ex->Message);
11001074
}
1101-
}
1075+
}

snippets/csharp/System.IO.IsolatedStorage/IsolatedStorageFile/Close/source.cs

Lines changed: 2 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -85,62 +85,6 @@ public bool NewPrefs
8585
get { return myNewPrefs; }
8686
}
8787

88-
//<snippet4>
89-
private bool GetPrefsForUser()
90-
{
91-
try
92-
{
93-
//<Snippet15>
94-
95-
// Retrieve an IsolatedStorageFile for the current Domain and Assembly.
96-
IsolatedStorageFile isoFile =
97-
IsolatedStorageFile.GetStore(IsolatedStorageScope.User |
98-
IsolatedStorageScope.Assembly |
99-
IsolatedStorageScope.Domain,
100-
null,
101-
null);
102-
103-
IsolatedStorageFileStream isoStream =
104-
new IsolatedStorageFileStream("substituteUsername",
105-
System.IO.FileMode.Open,
106-
System.IO.FileAccess.Read,
107-
System.IO.FileShare.Read);
108-
//</Snippet15>
109-
110-
// The code executes to this point only if a file corresponding to the username exists.
111-
// Though you can perform operations on the stream, you cannot get a handle to the file.
112-
113-
try
114-
{
115-
116-
SafeFileHandle aFileHandle = isoStream.SafeFileHandle;
117-
Console.WriteLine("A pointer to a file handle has been obtained. "
118-
+ aFileHandle.ToString() + " "
119-
+ aFileHandle.GetHashCode());
120-
}
121-
122-
catch (Exception e)
123-
{
124-
// Handle the exception.
125-
Console.WriteLine("Expected exception");
126-
Console.WriteLine(e);
127-
}
128-
129-
StreamReader reader = new StreamReader(isoStream);
130-
// Read the data.
131-
this.NewsUrl = reader.ReadLine();
132-
this.SportsUrl = reader.ReadLine();
133-
reader.Close();
134-
isoFile.Close();
135-
return false;
136-
}
137-
catch (System.IO.FileNotFoundException)
138-
{
139-
// Expected exception if a file cannot be found. This indicates that we have a new user.
140-
return true;
141-
}
142-
}
143-
//</snippet4>
14488
//<snippet3>
14589
public bool GetIsoStoreInfo()
14690
{
@@ -266,7 +210,7 @@ public void DeleteDirectories()
266210
IsolatedStorageScope.Domain,
267211
typeof(System.Security.Policy.Url),
268212
typeof(System.Security.Policy.Url));
269-
//<Snippet16>
213+
//<Snippet16>
270214
String[] dirNames = isoFile.GetDirectoryNames("*");
271215
String[] fileNames = isoFile.GetFileNames("Archive\\*");
272216

@@ -297,7 +241,7 @@ public void DeleteDirectories()
297241
{
298242
Console.WriteLine(e.ToString());
299243
}
300-
//</Snippet16>
244+
//</Snippet16>
301245
}
302246
//</snippet8>
303247
//<snippet7>
@@ -386,7 +330,6 @@ public double SetNewPrefsForUser()
386330
//</Snippet12>
387331
isoStream.Position = 0; // Position to overwrite the old data.
388332
//</snippet7>
389-
//<snippet5>
390333
StreamWriter writer = new StreamWriter(isoStream);
391334
// Update the data based on the new inputs.
392335
writer.WriteLine(this.NewsUrl);
@@ -396,7 +339,6 @@ public double SetNewPrefsForUser()
396339
double d = isoFile.CurrentSize / isoFile.MaximumSize;
397340
Console.WriteLine("CurrentSize = " + isoFile.CurrentSize.ToString());
398341
Console.WriteLine("MaximumSize = " + isoFile.MaximumSize.ToString());
399-
//</snippet5>
400342
// StreamWriter.Close implicitly closes isoStream.
401343
writer.Close();
402344
isoFile.Close();

snippets/csharp/System.Messaging/MessageEnumerator/Overview/Project.csproj

Lines changed: 0 additions & 12 deletions
This file was deleted.

snippets/csharp/System.Messaging/MessageEnumerator/Overview/mqgetmessageenumerator.cs

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)