This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuote from: PumamanQuote from: monkey_05_06Edit: BTW Chris, what is this Game.agf.user file that seems to have cropped up?
It's for storing any settings that are specific to you (the user of the AGS Editor) and not game settings.
At the moment it's only used to store source control information, but in future it might also contain which windows you had open when you closed the editor, etc.
public static bool CreateHardLink(string destFileName, string sourceFileName, bool overwrite)
{
if (File.Exists(destFileName))
{
if (overwrite) File.Delete(destFileName);
else return false;
}
List<char> invalidFileNameChars = new List<char>(Path.GetInvalidFileNameChars());
if (Path.GetFileName(destFileName).IndexOfAny(invalidFileNameChars.ToArray()) != -1)
{
throw new ArgumentException("Cannot create hard link! Invalid destination file name.");
}
if (Path.GetFileName(sourceFileName).IndexOfAny(invalidFileNameChars.ToArray()) != -1)
{
throw new ArgumentException("Cannot create hard link! Invalid source file name.");
}
if (!File.Exists(sourceFileName))
{
throw new FileNotFoundException("Cannot create hard link! Source file does not exist.");
}
ProcessStartInfo si = new ProcessStartInfo("cmd.exe");
si.RedirectStandardInput = false;
si.RedirectStandardOutput = false;
si.RedirectStandardError = false;
si.UseShellExecute = false;
si.Arguments = string.Format("/c mklink /h \"{0}\" \"{1}\"", destFileName, sourceFileName);
si.CreateNoWindow = true;
si.WindowStyle = ProcessWindowStyle.Hidden;
if (IsMonoRunning())
{
si.FileName = "ln";
si.Arguments = string.Format("\"{0}\" \"{1}\"", sourceFileName, destFileName);
}
Process process = Process.Start(si);
bool result = (process != null);
if (result)
{
process.EnableRaisingEvents = true;
process.WaitForExit();
if (process.ExitCode != 0) return false;
process.Close();
// by default the new hard link will be accessible to the current user only
// instead, we'll change it to be accessible to the entire "Users" group
FileSecurity fsec = File.GetAccessControl(destFileName);
fsec.AddAccessRule
(
new FileSystemAccessRule
(
new SecurityIdentifier(WellKnownSidType.BuiltinUsersSid, null),
FileSystemRights.Modify,
AccessControlType.Allow
)
);
File.SetAccessControl(destFileName, fsec);
}
return result;
}
public static bool CreateHardLink(string destFileName, string sourceFileName, bool overwrite)
{
if (File.Exists(destFileName))
{
if (overwrite) File.Delete(destFileName);
else return false;
}
ProcessStartInfo si = new ProcessStartInfo("cmd.exe");
si.RedirectStandardInput = false;
si.RedirectStandardOutput = false;
si.UseShellExecute = false;
si.Arguments = string.Format("/c mklink /h {0} {1}", destFileName, sourceFileName);
si.CreateNoWindow = true;
si.WindowStyle = ProcessWindowStyle.Hidden;
if (IsMonoRunning())
{
si.FileName = "ln";
si.Arguments = string.Format("{0} {1}", sourceFileName, destFileName);
}
bool result = (Process.Start(si) != null);
if (result)
{
// by default the new hard link will be accessible to the current user only
// instead, we'll change it to be accessible to the entire "Users" group
FileSecurity fsec = File.GetAccessControl(destFileName);
fsec.AddAccessRule
(
new FileSystemAccessRule
(
new SecurityIdentifier(WellKnownSidType.BuiltinUsersSid, null),
FileSystemRights.Modify,
AccessControlType.Allow
)
);
File.SetAccessControl(destFileName, fsec);
}
return result;
}
Quote from: Gurok on Sun 26/10/2014 02:36:52AGS will automatically close one of your text files when you close the editor. Not sure why this happens. I believe it's an editor issue and I'm looking into it
Quote from: Crimson Wizard on Fri 24/10/2014 13:45:01For a real timer you would need to use DateTime class.
int GetApproxMSInGameLoops(int targetMS, RoundDirection dir) // dir default is eRoundNearest
{
float fresult = (IntToFloat(targetMS) / IntToFloat(GetGameSpeed())) / 1000.0; // (ms*40)/1000 for default game speed
return FloatToInt(fresult, dir);
}
Quote from: Crimson Wizard on Tue 21/10/2014 17:48:03When the C# code will fully work, the code that is not used for saved games could be removed from engine all at once.
By continuing to use this site you agree to the use of cookies. Please visit this page to see exactly how we use these.
Page created in 2.852 seconds with 15 queries.