🌸 morgan period 🌸
🌸 morgan period 🌸
CC#
Created by 🌸 morgan period 🌸 on 11/1/2024 in #help
Call function when system time changed
I'm reading the Microsoft SystemEvents.TimeChanged and I'm having trouble understanding how to link my own function to call when the system time changes.
8 replies
CC#
Created by 🌸 morgan period 🌸 on 10/25/2024 in #help
Google Api to C#
Hey I'm trying to connect Places Api to do auto completion on addresses. This is being made on a C# software, I already have the nuget package installed. The error: Error creating Credential from JSON or JSON parameters I'm using the downloaded json key from Google console. The code:
public override async void _Ready() {
PlacesClientBuilder placesClient = new PlacesClientBuilder();
String path = "key.json";
placesClient.CredentialsPath = path;



// Initialize request argument(s)
AutocompletePlacesRequest request = new AutocompletePlacesRequest
{
Input = "address",
LocationBias = new AutocompletePlacesRequest.Types.LocationBias(),
LocationRestriction = new AutocompletePlacesRequest.Types.LocationRestriction(),
IncludedPrimaryTypes = { "", },
IncludedRegionCodes = { "", },
LanguageCode = "",
RegionCode = "",
Origin = new Google.Type.LatLng(),
InputOffset = 0,
IncludeQueryPredictions = false,
SessionToken = "",
};
// Make the request
AutocompletePlacesResponse response = placesClient.Build().AutocompletePlaces(request);

GD.Print(response);

}

private static UserCredential Login (string googleClientID, string googleClientSecret, string[] scopes) {
ClientSecrets secrets = new ClientSecrets () {
ClientId = googleClientID,
ClientSecret = googleClientSecret
};

return GoogleWebAuthorizationBroker.AuthorizeAsync(secrets, scopes, "user", System.Threading.CancellationToken.None).Result;
}
public override async void _Ready() {
PlacesClientBuilder placesClient = new PlacesClientBuilder();
String path = "key.json";
placesClient.CredentialsPath = path;



// Initialize request argument(s)
AutocompletePlacesRequest request = new AutocompletePlacesRequest
{
Input = "address",
LocationBias = new AutocompletePlacesRequest.Types.LocationBias(),
LocationRestriction = new AutocompletePlacesRequest.Types.LocationRestriction(),
IncludedPrimaryTypes = { "", },
IncludedRegionCodes = { "", },
LanguageCode = "",
RegionCode = "",
Origin = new Google.Type.LatLng(),
InputOffset = 0,
IncludeQueryPredictions = false,
SessionToken = "",
};
// Make the request
AutocompletePlacesResponse response = placesClient.Build().AutocompletePlaces(request);

GD.Print(response);

}

private static UserCredential Login (string googleClientID, string googleClientSecret, string[] scopes) {
ClientSecrets secrets = new ClientSecrets () {
ClientId = googleClientID,
ClientSecret = googleClientSecret
};

return GoogleWebAuthorizationBroker.AuthorizeAsync(secrets, scopes, "user", System.Threading.CancellationToken.None).Result;
}
1 replies
CC#
Created by 🌸 morgan period 🌸 on 10/17/2024 in #help
✅ SMTP server broke
We used to be able to connect using SMTP outlook.office365.com 587 but all of a sudden it no longer will connect. Error
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.57 Client not authenticated to send mail. Error: 535 5.7.139 Authentication unsuccessful, basic authentication is disabled. [MW4PR04CA0249.namprd04.prod.outlook.com 2024-10-16T23:46:33.247Z 08DCEE0C14048537]
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.57 Client not authenticated to send mail. Error: 535 5.7.139 Authentication unsuccessful, basic authentication is disabled. [MW4PR04CA0249.namprd04.prod.outlook.com 2024-10-16T23:46:33.247Z 08DCEE0C14048537]
My Code
client = new SmtpClient("outlook.office365.com", 587);

client.Timeout = 20000;

client.EnableSsl = true;

client.DeliveryMethod = SmtpDeliveryMethod.Network;

client.UseDefaultCredentials = false;

client.Credentials = new System.Net.NetworkCredential("username", "password");
client = new SmtpClient("outlook.office365.com", 587);

client.Timeout = 20000;

client.EnableSsl = true;

client.DeliveryMethod = SmtpDeliveryMethod.Network;

client.UseDefaultCredentials = false;

client.Credentials = new System.Net.NetworkCredential("username", "password");
11 replies
CC#
Created by 🌸 morgan period 🌸 on 9/20/2024 in #help
Better way to check a list of characters?
There has to be a better way than doing this
myWord == "-" || myWord == "~" || myWord == "—"...
myWord == "-" || myWord == "~" || myWord == "—"...
I also don't really want to make a array and have to loop through them all because that seems like code would pile up quickly. I'm hoping for a function that does what I'm looking for?
8 replies
CC#
Created by 🌸 morgan period 🌸 on 9/11/2024 in #help
JsonSerializer escaping '&'
I looked at https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/character-encoding and I still got nothing, I don't understand why these few symbols don't work in json format?
9 replies
CC#
Created by 🌸 morgan period 🌸 on 9/4/2024 in #help
RFC3339 to DateTime
Title says it, I can't find anything online for RFC3339 to Datetime, only the reverse
41 replies
CC#
Created by 🌸 morgan period 🌸 on 8/24/2024 in #help
confused on this error
I'm having trouble understanding what this error is trying to tell me
void square_manager+<ListInvoices>d__5.MoveNext(): System.NullReferenceException: Object reference not set to an instance of an object.
void square_manager+<ListInvoices>d__5.MoveNext(): System.NullReferenceException: Object reference not set to an instance of an object.
manager_invoices.cs
ListInvoicesResponse result = await square_manager.ListInvoices();
ListInvoicesResponse result = await square_manager.ListInvoices();
square_manager.cs
public static async Task<ListInvoicesResponse> ListInvoices() {
try {
var result = await client.InvoicesApi.ListInvoicesAsync(locationId: null);
return result;
}
public static async Task<ListInvoicesResponse> ListInvoices() {
try {
var result = await client.InvoicesApi.ListInvoicesAsync(locationId: null);
return result;
}
3 replies
CC#
Created by 🌸 morgan period 🌸 on 8/24/2024 in #help
Async Task Help
How am I supposed to make this work, I'm unsure where to go from here.
Cannot implicitly convert type 'System.Threading.Tasks.Task<Square.Models.ListInvoicesResponse>' to 'Square.Models.ListInvoicesResponse
Cannot implicitly convert type 'System.Threading.Tasks.Task<Square.Models.ListInvoicesResponse>' to 'Square.Models.ListInvoicesResponse
5 replies
CC#
Created by 🌸 morgan period 🌸 on 7/30/2024 in #help
YouTube Api
I want to make a program for a YouTuber that displays any new comments. Is it possible to have the API run a function once it receives a comment? Or do I have to check for any new comments every interval?
15 replies
CC#
Created by 🌸 morgan period 🌸 on 7/19/2024 in #help
Dictionary help (its confusing)
I turn a json file into a dictionary, how do I get sub data? (Getting "c") All I can do is dictionary["a"] not dictionary["a"]["b"]
{
"a": {
"b": {
"c": true
}
}
}
{
"a": {
"b": {
"c": true
}
}
}
35 replies