Example #1
0
        private static void AddLocallyCompiled(string[] args)
        {
            // figure out which arg is the file
            string builderFilePath = null;

            foreach (string a in args)
            {
                if (File.Exists(a))
                {
                    builderFilePath = a;
                    break;
                }
            }

            if (builderFilePath == null)
            {
                Logger.WriteLine("File path to " + typeof(PluginBuilder).Name + " file not found", logTo: Logger.LogTo.File | Logger.LogTo.StandardOut);
                return;
            }

            PluginBuilder builder;

            if (!TryDeserialize(builderFilePath, out builder))
            {
                return;
            }

            if (builder == null)
            {
                // I don't really expect this
                throw new NullReferenceException("no idea what happened");
            }

            if (builder.oAuthToken != null)
            {
                Logger.WriteLine("WARNING: OAuth Token specified in builder file. Be sure to keep your OAuth Token secret!", logTo: Logger.LogTo.File | Logger.LogTo.StandardOut);
            }

            if (!AmmendPluginBuilder(args, builderFilePath, builder))
            {
                return;
            }

            if (builder.files == null || builder.files.Length == 0)
            {
                Logger.WriteLine("No files to include in plugin", logTo: Logger.LogTo.File | Logger.LogTo.StandardOut);
                return;
            }

            if (!ResolveFilePath(builder, builderFilePath))
            {
                return;
            }

            Logger.WriteLine("Command line accepted.", logTo: Logger.LogTo.File | Logger.LogTo.StandardOut);
            Loader.AddLocallyCompiledPlugin(builder);
        }