#region License Information (GPL v3)
/*
ShareX - A program that allows you to take screenshots and share any file type
Copyright (C) 2008-2014 ShareX Developers
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Optionally you can also view the license at .
*/
#endregion License Information (GPL v3)
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
namespace ShareXPortable
{
internal class Program
{
private static void Main(string[] args)
{
string parentDir = @"..\..\..\";
string releaseDir = Path.Combine(parentDir, @"ShareX\bin\Release");
string portableDir = Path.Combine(parentDir, @"Output\Portable");
List files = new List();
string[] endsWith = new string[] { ".exe", ".dll", ".css", ".txt" };
string[] ignoreEndsWith = new string[] { ".vshost.exe" };
foreach (string filepath in Directory.GetFiles(releaseDir))
{
if (endsWith.Any(x => filepath.EndsWith(x, StringComparison.InvariantCultureIgnoreCase)) &&
ignoreEndsWith.All(x => !filepath.EndsWith(x, StringComparison.InvariantCultureIgnoreCase)))
{
files.Add(filepath);
}
}
if (Directory.Exists(portableDir))
{
Directory.Delete(portableDir, true);
Console.WriteLine("Directory.Delete: \"{0}\"", portableDir);
}
Directory.CreateDirectory(portableDir);
Console.WriteLine("Directory.Create: \"{0}\"", portableDir);
foreach (string filepath in files)
{
string filename = Path.GetFileName(filepath);
string dest = Path.Combine(portableDir, filename);
File.Copy(filepath, dest);
Console.WriteLine("File.Copy: \"{0}\" -> \"{1}\"", filepath, dest);
}
File.WriteAllText(Path.Combine(portableDir, "PersonalPath.cfg"), "ShareX", Encoding.UTF8);
Console.WriteLine("Created PersonalPath.cfg file.");
Process.Start("explorer.exe", portableDir);
Console.WriteLine("Done.");
//Console.Read();
}
}
}